summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-03-12 10:35:09 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-03-12 10:35:09 +0000
commit0c436ea6d48135bc14edf760f1cecc53f1c5d5a9 (patch)
tree1bea0986162c3f2193d0536633b92cd312a6e029
parentb865aac8749105b59fc8567790d2510cd4f0638f (diff)
downloadnumpy-0c436ea6d48135bc14edf760f1cecc53f1c5d5a9.tar.gz
Fixed segfault on multiarray import in install directory. Now, it just raises an error.
-rw-r--r--numpy/core/_internal.py9
-rw-r--r--numpy/core/src/multiarraymodule.c10
2 files changed, 10 insertions, 9 deletions
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py
index 4b2e4eaca..66eff15f7 100644
--- a/numpy/core/_internal.py
+++ b/numpy/core/_internal.py
@@ -154,7 +154,6 @@ class flagsobj(dict):
farray = property(get_farray, None, "")
-
# make sure the tuple entries are PyArray_Descr
# or convert them
#
@@ -255,7 +254,6 @@ def _reconstruct(subtype, shape, dtype):
# format_re and _split were taken from numarray by J. Todd Miller
-format_re = re.compile(r'(?P<repeat> *[(]?[ ,0-9]*[)]? *)(?P<dtype>[><|A-Za-z0-9.]*)')
def _split(input):
"""Split the input formats string into field formats without splitting
@@ -291,7 +289,10 @@ def _split(input):
return newlist
-# str is a string (perhaps comma separated)
+format_re = re.compile(r'(?P<repeat> *[(]?[ ,0-9]*[)]? *)(?P<dtype>[><|A-Za-z0-9.]*)')
+
+# astr is a string (perhaps comma separated)
+
def _commastring(astr):
res = _split(astr)
if (len(res)) == 1:
@@ -311,3 +312,5 @@ def _commastring(astr):
result.append(newitem)
return result
+
+
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c
index 3e3f71527..d55987959 100644
--- a/numpy/core/src/multiarraymodule.c
+++ b/numpy/core/src/multiarraymodule.c
@@ -29,7 +29,7 @@
static PyObject *typeDict=NULL; /* Must be explicitly loaded */
static PyObject *_numpy_internal=NULL; /* A Python module for callbacks */
-
+static int _multiarray_module_loaded=0;
static PyArray_Descr *
_arraydescr_fromobj(PyObject *obj)
@@ -5822,7 +5822,9 @@ set_flaginfo(PyObject *d)
DL_EXPORT(void) initmultiarray(void) {
PyObject *m, *d, *s;
PyObject *c_api;
-
+
+ if (_multiarray_module_loaded) return;
+ _multiarray_module_loaded = 1;
/* Create the module and add the functions */
m = Py_InitModule("multiarray", array_module_methods);
if (!m) goto err;
@@ -5872,10 +5874,6 @@ DL_EXPORT(void) initmultiarray(void) {
Py_INCREF(&PyArrayDescr_Type);
PyDict_SetItemString(d, "dtype", (PyObject *)&PyArrayDescr_Type);
- /* Doesn't need to be exposed to Python
- Py_INCREF(&PyArrayMapIter_Type);
- PyDict_SetItemString(d, "mapiter", (PyObject *)&PyArrayMapIter_Type);
- */
set_flaginfo(d);
if (set_typeinfo(d) != 0) goto err;