summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/__init__.py5
-rw-r--r--numpy/_import_tools.py8
-rw-r--r--numpy/core/include/numpy/ndarrayobject.h2
3 files changed, 11 insertions, 4 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py
index f75b74f4d..c7a7b80d4 100644
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -29,7 +29,10 @@ else:
from version import version as __version__
from _import_tools import PackageLoader
- pkgload = PackageLoader()
+
+ def pkgload(*packages, **options):
+ loader = PackageLoader(infunc=True)
+ return loader(*packages, **options)
import testing
from testing import ScipyTest, NumpyTest
diff --git a/numpy/_import_tools.py b/numpy/_import_tools.py
index 48dc6372d..21c406961 100644
--- a/numpy/_import_tools.py
+++ b/numpy/_import_tools.py
@@ -7,11 +7,15 @@ from glob import glob
__all__ = ['PackageLoader']
class PackageLoader:
- def __init__(self, verbose=False):
+ def __init__(self, verbose=False, infunc=False):
""" Manages loading packages.
"""
- self.parent_frame = frame = sys._getframe(1)
+ if infunc:
+ _level = 2
+ else:
+ _level = 1
+ self.parent_frame = frame = sys._getframe(_level)
self.parent_name = eval('__name__',frame.f_globals,frame.f_locals)
parent_path = eval('__path__',frame.f_globals,frame.f_locals)
if isinstance(parent_path, str):
diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h
index b86f7bdd7..a9f66b487 100644
--- a/numpy/core/include/numpy/ndarrayobject.h
+++ b/numpy/core/include/numpy/ndarrayobject.h
@@ -1761,7 +1761,7 @@ typedef struct {
#define PyDataType_ISNOTSWAPPED(d) PyArray_ISNBO(((PyArray_Descr *)(d))->byteorder)
-
+#define PyDataType_ISBYTESWAPPED(d) (!PyDataType_ISNOTSWAPPED(d))
/* This is the form of the struct that's returned pointed by the