548ad7
From 64f64b517153a6b3de48c5b911920239b3eb1e18 Mon Sep 17 00:00:00 2001
548ad7
From: "Bradley M. Froehle" <brad.froehle@gmail.com>
548ad7
Date: Sun, 24 Feb 2013 21:31:28 -0800
548ad7
Subject: [PATCH] BUG: Choose a more unique PY_ARRAY_UNIQUE_SYMBOL in f2py.
548ad7
548ad7
In a few exceptional cases where symbols are shared between different
548ad7
Python modules the use of `PyArray_API` in f2py (fortranobject.h)
548ad7
conflicts with the regular use of the same symbol in the multiarray
548ad7
module. Generally the symptom of this conflicting use is a segfault
548ad7
when importing a f2py'ed module. This occurs because the module init
548ad7
code somehow overwrites the first element of `PyArray_API` with the
548ad7
location of `PyArray_API`, causing a crash when
548ad7
`PyArray_GetNDArrayCVersion` is called.
548ad7
548ad7
Closes gh-2521.
548ad7
---
548ad7
 numpy/f2py/src/fortranobject.h | 2 +-
548ad7
 1 file changed, 1 insertion(+), 1 deletion(-)
548ad7
548ad7
diff --git a/numpy/f2py/src/fortranobject.h b/numpy/f2py/src/fortranobject.h
548ad7
index 283021a..07e810f 100644
548ad7
--- a/numpy/f2py/src/fortranobject.h
548ad7
+++ b/numpy/f2py/src/fortranobject.h
548ad7
@@ -9,7 +9,7 @@ extern "C" {
548ad7
 #ifdef FORTRANOBJECT_C
548ad7
 #define NO_IMPORT_ARRAY
548ad7
 #endif
548ad7
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API
548ad7
+#define PY_ARRAY_UNIQUE_SYMBOL _npy_f2py_ARRAY_API
548ad7
 #include "numpy/arrayobject.h"
548ad7
 
548ad7
 /*
548ad7
-- 
548ad7
2.7.4
548ad7