[pypy-commit] pypy py3.5: obscure fixes for test___all__.py

arigo pypy.commits at gmail.com
Thu Jan 12 13:26:38 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89522:048d4b329858
Date: 2017-01-12 18:07 +0100
http://bitbucket.org/pypy/pypy/changeset/048d4b329858/

Log:	obscure fixes for test___all__.py

diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -220,4 +220,9 @@
 for constant in dir(os):
     value = getattr(os, constant)
     if constant.isupper() and type(value) is int:
+        if constant in ['SEEK_SET', 'SEEK_CUR', 'SEEK_END',
+                        'P_NOWAIT', 'P_NOWAITO', 'P_WAIT']:
+            # obscure, but these names are not in CPython's posix module
+            # and if we put it here then they end up twice in 'os.__all__'
+            continue
         Module.interpleveldefs[constant] = "space.wrap(%s)" % value
diff --git a/pypy/module/token/__init__.py b/pypy/module/token/__init__.py
--- a/pypy/module/token/__init__.py
+++ b/pypy/module/token/__init__.py
@@ -22,6 +22,11 @@
     Module.interpleveldefs["tok_name"] = "space.wrap(%r)" % (tok_name,)
     Module.interpleveldefs["N_TOKENS"] = "space.wrap(%d)" % len(tok_name)
     all_names = Module.interpleveldefs.keys()
+    # obscure, but these names are not in CPython's token module
+    # so we remove them from 'token.__all__' otherwise they end up
+    # twice in 'tokenize.__all__'
+    all_names.remove('COMMENT')
+    all_names.remove('NL')
     Module.interpleveldefs["__all__"] = "space.wrap(%r)" % (all_names,)
 
 _init_tokens()


More information about the pypy-commit mailing list