Merge lp:~barry/ubuntu/natty/python-numpy/685469-crash into lp:ubuntu/natty/python-numpy

Proposed by Barry Warsaw
Status: Merged
Merged at revision: 13
Proposed branch: lp:~barry/ubuntu/natty/python-numpy/685469-crash
Merge into: lp:ubuntu/natty/python-numpy
Diff against target: 96 lines (+76/-0)
3 files modified
debian/changelog (+9/-0)
debian/patches/changeset_r8394.diff (+66/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~barry/ubuntu/natty/python-numpy/685469-crash
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+43986@code.launchpad.net

Description of the change

python-numpy (1:1.4.1-5ubuntu4) natty; urgency=low

  * Fix pymvpa crash caused by numpy incompatibility with Python 2.7.
    This is a back port of the numpy upstream changeset:
    http://projects.scipy.org/numpy/changeset/8394
    (LP: #685469)

 -- Barry Warsaw <email address hidden> Thu, 16 Dec 2010 15:57:29 -0500

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2010-12-11 01:02:18 +0000
+++ debian/changelog 2010-12-16 22:22:13 +0000
@@ -1,3 +1,12 @@
1python-numpy (1:1.4.1-5ubuntu4) natty; urgency=low
2
3 * Fix pymvpa crash caused by numpy incompatibility with Python 2.7.
4 This is a back port of the numpy upstream changeset:
5 http://projects.scipy.org/numpy/changeset/8394
6 (LP: #685469)
7
8 -- Barry Warsaw <barry@ubuntu.com> Thu, 16 Dec 2010 15:57:29 -0500
9
1python-numpy (1:1.4.1-5ubuntu3) natty; urgency=low10python-numpy (1:1.4.1-5ubuntu3) natty; urgency=low
211
3 * Rebuild with python2.7 as the default python version.12 * Rebuild with python2.7 as the default python version.
413
=== added file 'debian/patches/changeset_r8394.diff'
--- debian/patches/changeset_r8394.diff 1970-01-01 00:00:00 +0000
+++ debian/patches/changeset_r8394.diff 2010-12-16 22:22:13 +0000
@@ -0,0 +1,66 @@
1--- a/numpy/core/src/multiarray/numpyos.c
2+++ b/numpy/core/src/multiarray/numpyos.c
3@@ -418,6 +418,32 @@
4 return 0;
5 }
6
7+/*
8+ * _NumPyOS_ascii_strtod_plain:
9+ *
10+ * PyOS_ascii_strtod work-alike, with no enhanced features,
11+ * for forward compatibility with Python >= 2.7
12+ */
13+static double
14+NumPyOS_ascii_strtod_plain(const char *s, char** endptr)
15+{
16+ double result;
17+#if PY_VERSION_HEX >= 0x02070000
18+ NPY_ALLOW_C_API_DEF
19+ NPY_ALLOW_C_API
20+ result = PyOS_string_to_double(s, endptr, NULL);
21+ if (PyErr_Occurred()) {
22+ if (endptr) {
23+ *endptr = (char*)s;
24+ }
25+ PyErr_Clear();
26+ }
27+ NPY_DISABLE_C_API
28+#else
29+ result = PyOS_ascii_strtod(s, endptr);
30+#endif
31+ return result;
32+}
33
34 /*
35 * NumPyOS_ascii_strtod:
36@@ -506,7 +532,7 @@
37 }
38 memcpy(buffer, s, n);
39 buffer[n] = '\0';
40- result = PyOS_ascii_strtod(buffer, &q);
41+ result = NumPyOS_ascii_strtod_plain(buffer, &q);
42 if (endptr != NULL) {
43 *endptr = (char*)(s + (q - buffer));
44 }
45@@ -515,7 +541,7 @@
46 }
47 /* End of ##2 */
48
49- return PyOS_ascii_strtod(s, endptr);
50+ return NumPyOS_ascii_strtod_plain(s, endptr);
51 }
52
53
54--- a/numpy/core/tests/test_regression.py
55+++ b/numpy/core/tests/test_regression.py
56@@ -1235,6 +1235,10 @@
57 assert_(np.isfinite(np.log1p(np.exp2(-53))))
58
59
60+ def test_fromstring_crash(self):
61+ # Ticket #1345: the following should not cause a crash
62+ np.fromstring(asbytes('aa, aa, 1.0'), sep=',')
63+
64 if __name__ == "__main__":
65 run_module_suite()
66 def test_duplicate_title_and_name(self):
067
=== modified file 'debian/patches/series'
--- debian/patches/series 2010-10-07 10:19:13 +0000
+++ debian/patches/series 2010-12-16 22:22:13 +0000
@@ -8,3 +8,4 @@
8changeset_r8511.diff8changeset_r8511.diff
9changeset_r8526.diff9changeset_r8526.diff
10changeset_r8364.diff10changeset_r8364.diff
11changeset_r8394.diff

Subscribers

People subscribed via source and target branches

to all changes: