From 9f696c9809cb1c9d6f4b8d2cd43dcf866825f4e3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 21 Mar 2015 22:04:42 +0200 Subject: [PATCH] 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. --- Lib/test/_mock_backport.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/_mock_backport.py b/Lib/test/_mock_backport.py index d3948310bba..f85becb06b5 100644 --- a/Lib/test/_mock_backport.py +++ b/Lib/test/_mock_backport.py @@ -24,6 +24,7 @@ __all__ = ( __version__ = '1.0' +import __builtin__ import inspect import pprint import sys @@ -32,7 +33,7 @@ from types import ModuleType 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: