[pypy-commit] pypy python-numpy: export demi-module names in numpy.core by modifying numpy.core.__all__

mattip noreply at buildbot.pypy.org
Thu Aug 23 14:10:57 CEST 2012


Author: Matti Picus <matti.picus at gmail.com>
Branch: python-numpy
Changeset: r56818:9a5c26ab3b2b
Date: 2012-08-23 12:42 +0300
http://bitbucket.org/pypy/pypy/changeset/9a5c26ab3b2b/

Log:	export demi-module names in numpy.core by modifying
	numpy.core.__all__

diff --git a/lib_pypy/numpypy/__init__.py b/lib_pypy/numpypy/__init__.py
--- a/lib_pypy/numpypy/__init__.py
+++ b/lib_pypy/numpypy/__init__.py
@@ -1,5 +1,4 @@
-#from _numpypy import *
-#from .core import *
+
 
 import sys
 import math as _math
@@ -9,7 +8,9 @@
 umath = _numpypy
 
 import multiarray
+sys.modules['multiarray'] = multiarray
 sys.modules['numpy.core.multiarray'] = multiarray
+sys.modules['umath'] = umath
 sys.modules['numpy.core.umath'] = _numpypy
 
 import numerictypes
@@ -20,6 +21,11 @@
 sys.modules['scalarmath'] = scalarmath
 sys.modules['numpy.core.scalarmath'] = scalarmath
 
+import _compiled_base
+sys.modules['_compiled_base'] = _compiled_base
+sys.modules['numpy.lib._compiled_base'] = _compiled_base
+
+
 umath.ERR_IGNORE = 0
 umath.ERR_WARN  = 1
 umath.ERR_RAISE = 2
@@ -48,6 +54,11 @@
 umath.NAN = float('nan')
 umath.pi = _math.pi
 
+#mangle the __all__ of numpy.core so that import numpy.core.numerictypes works
+from numpy import core
+core.__all__ += ['multiarray', 'numerictypes', 'umath']
+core.numerictypes = numerictypes
+
 del _math
 
 def not_implemented_func(*args, **kwargs):
@@ -55,3 +66,5 @@
 
 setattr(_numpypy, 'frompyfunc', not_implemented_func)
 setattr(_numpypy, 'mod', not_implemented_func)
+
+core.complexfloating = None


More information about the pypy-commit mailing list