[Python-checkins] cpython (2.7): Issue #23075: Whether __builtins__ is a module or a dict is undefined in
serhiy.storchaka
python-checkins at python.org
Sat Mar 21 21:05:34 CET 2015
https://hg.python.org/cpython/rev/d0b497c86c60
changeset: 95117:d0b497c86c60
branch: 2.7
parent: 95077:447794596266
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sat Mar 21 22:04:42 2015 +0200
summary:
Issue #23075: Whether __builtins__ is a module or a dict is undefined in
CPython. Use the reliably well defined `import __builtin__` instead.
Patch by Alex Gaynor.
files:
Lib/test/_mock_backport.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Lib/test/_mock_backport.py b/Lib/test/_mock_backport.py
--- a/Lib/test/_mock_backport.py
+++ b/Lib/test/_mock_backport.py
@@ -24,6 +24,7 @@
__version__ = '1.0'
+import __builtin__
import inspect
import pprint
import sys
@@ -32,7 +33,7 @@
from functools import wraps, partial
-_builtins = {name for name in __builtins__ if not name.startswith('_')}
+_builtins = {name for name in dir(__builtin__) if not name.startswith('_')}
BaseExceptions = (BaseException,)
if 'java' in sys.platform:
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list