[pypy-commit] pypy default: clean up numpypy __builtin__ aliases
bdkearns
noreply at buildbot.pypy.org
Sat Feb 23 09:25:39 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r61646:247421a6850b
Date: 2013-02-23 02:48 -0500
http://bitbucket.org/pypy/pypy/changeset/247421a6850b/
Log: clean up numpypy __builtin__ aliases
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
@@ -2,6 +2,8 @@
from .core import *
from .lib import *
+from __builtin__ import bool, int, long, float, complex, object, unicode, str
+
import _numpypy
__all__ = _numpypy.__all__
diff --git a/pypy/module/micronumpy/__init__.py b/pypy/module/micronumpy/__init__.py
--- a/pypy/module/micronumpy/__init__.py
+++ b/pypy/module/micronumpy/__init__.py
@@ -27,9 +27,6 @@
'True_': 'types.Bool.True',
'False_': 'types.Bool.False',
- 'bool': 'space.w_bool',
- 'int': 'space.w_int',
-
'typeinfo': 'interp_dtype.get_dtype_cache(space).w_typeinfo',
'generic': 'interp_boxes.W_GenericBox',
@@ -170,8 +167,6 @@
all_list = sorted(Module.interpleveldefs.keys() + \
Module.appleveldefs.keys())
# found by set(numpypy.__all__) - set(numpy.__all__)
- all_list.remove('bool')
- all_list.remove('int')
all_list.remove('abs')
all_list.remove('typeinfo')
w_all = space.wrap(all_list)
diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -638,9 +638,6 @@
def test_various_types(self):
import _numpypy as numpy
- assert numpy.bool is bool
- assert numpy.int is int
-
assert numpy.int16 is numpy.short
assert numpy.int8 is numpy.byte
assert numpy.bool_ is numpy.bool8
diff --git a/pypy/module/test_lib_pypy/numpypy/test_numpy.py b/pypy/module/test_lib_pypy/numpypy/test_numpy.py
--- a/pypy/module/test_lib_pypy/numpypy/test_numpy.py
+++ b/pypy/module/test_lib_pypy/numpypy/test_numpy.py
@@ -31,3 +31,13 @@
assert max is not __builtin__.max
assert min is amin
assert max is amax
+
+ def test_builtin_aliases(self):
+ import __builtin__
+ import numpypy
+ from numpypy import *
+
+ for name in ['bool', 'int', 'long', 'float', 'complex', 'object',
+ 'unicode', 'str']:
+ assert name not in locals()
+ assert getattr(numpypy, name) is getattr(__builtin__, name)
More information about the pypy-commit
mailing list