summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2007-03-31 22:56:19 +0000
committerTravis Oliphant <oliphant@enthought.com>2007-03-31 22:56:19 +0000
commitf80ab5e1c4c5b51a7d02a22e6b8cb6f86daa3563 (patch)
tree3e03bb4ecad2400b0854a7e78017a9fc04c42702
parentdad871430574802f8d32cd515d19df77d0a006af (diff)
downloadnumpy-f80ab5e1c4c5b51a7d02a22e6b8cb6f86daa3563.tar.gz
Add new MACRO. Fix ticket #454 by changing pkgload to a function instead of an object.
-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