Issue3462
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008-07-29 02:06 by benjamin.peterson, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (16) | |||
---|---|---|---|
msg70374 - (view) | Author: Benjamin Peterson (benjamin.peterson) * | Date: 2008-07-29 02:06 | |
In Py3k: $ ./python Lib/test/regrtest.py test_decimal test_builtin test_decimal test_builtin test test_builtin failed -- Traceback (most recent call last): File "Lib/test/regrtest.py", line 603, in runtest_inner indirect_test() File "/temp/python/py3k/Lib/test/test_builtin.py", line 1252, in test_main run_unittest(*test_classes) File "/temp/python/py3k/Lib/test/support.py", line 717, in run_unittest _run_suite(suite) File "/temp/python/py3k/Lib/test/support.py", line 700, in _run_suite raise TestFailed(err) test.support.TestFailed: Traceback (most recent call last): File "/temp/python/py3k/Lib/test/test_builtin.py", line 390, in test_general_eval self.assertEqual(eval('globals()', g, m), g) AssertionError: {'unittest': <module 'unittest' from '/temp/python/py3k/Lib/unittest.py'>, 'random': <module 'random' from '/temp/python/py3k/Lib/random.py'>, 'test_conv_no_sign': [('0', 0), ('1', 1), ('9', 9), ('10', 10), ('99', 99), ('100', 100), ('314', 314), (' 314', 314), ('314 ', 314), (' \t\t 314 \t\t ', 314), ('2147483647', 2147483647), (' 1x', <class 'ValueError'>), (' 1 ', 1), (' 1\x02 ', <class 'ValueError'>), ('', <class 'ValueError'>), (' ', <class 'ValueError'>), (' \t\t ', <class 'ValueError'>), ('\u0663\u0661\u0664 ', 314), ('\u0200', <class 'ValueError'>)], 'test_conv_sign': [('0', 0), ('1', 1), ('9', 9), ('10', 10), ('99', 99), ('100', 100), ('314', 314), (' 314', <class 'ValueError'>), ('314 ', 314), (' \t\t 314 \t\t ', <class 'ValueError'>), ('2147483647', 2147483647), (' 1x', <class 'ValueError'>), (' 1 ', <class 'ValueError'>), (' 1\x02 ', <class 'ValueError'>), ('', <class 'ValueError'>), (' ', <class 'ValueError'>), (' \t\t ', <class 'ValueError'>), ('\u0663\u0661\u0664 ', 314), ('\u0200', <class 'ValueError'>)], 'run_with_locale': <function run_with_locale at 0x10b0390>, 'io': <module 'io' from '/temp/python/py3k/Lib/io.py'>, 'Squares': <class 'test.test_builtin.Squares'>, 'neg': <built-in function neg>, '__package__': None, 'collections': <module 'collections' from '/temp/python/py3k/Lib/collections.py'>, 'TestFailingIter': <class 'test.test_builtin.TestFailingIter'>, 'run_unittest': <function run_unittest at 0x10b0540>, '__doc__': None, 'test_main': <function test_main at 0x1474390>, 'fractions': <module 'fractions' from '/temp/python/py3k/Lib/fractions.py'>, 'StrSquares': <class 'test.test_builtin.StrSquares'>, 'warnings': <module 'warnings' from '/temp/python/py3k/Lib/warnings.py'>, '__builtins__': {'bytearray': <class 'bytearray'>, 'IndexError': <class 'IndexError'>, 'all': <built-in function all>, 'help': Type help() for interactive help, or help(object) for help about object., 'vars': <built-in function vars>, 'SyntaxError': <class 'SyntaxError'>, 'UnicodeDecodeError': <class 'UnicodeDecodeError'>, 'memoryview': <class 'memoryview'>, 'isinstance': <built-in function isinstance>, '__build_class__': <built-in function __build_class__>, 'copyright': Copyright (c) 2001-2008 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved., 'NameError': <class 'NameError'>, 'BytesWarning': <class 'BytesWarning'>, 'dict': <class 'dict'>, 'IOError': <class 'IOError'>, 'oct': <built-in function oct>, 'bin': <built-in function bin>, 'SystemExit': <class 'SystemExit'>, 'format': <built-in function format>, 'repr': <built-in function repr>, 'sorted': <built-in function sorted>, 'False': False, 'RuntimeWarning': <class 'RuntimeWarning'>, 'list': <class 'list'>, 'iter': <built-in function iter>, 'Warning': <class 'Warning'>, '__package__': None, 'round': <built-in function round>, 'dir': <built-in function dir>, 'cmp': <built-in function cmp>, 'set': <class 'set'>, 'bytes': <class 'bytes'>, 'UnicodeTranslateError': <class 'UnicodeTranslateError'>, 'issubclass': <built-in function issubclass>, 'EOFError': <class 'EOFError'>, 'locals': <built-in function locals>, 'BufferError': <class 'BufferError'>, 'slice': <class 'slice'>, 'FloatingPointError': <class 'FloatingPointError'>, 'sum': <built-in function sum>, 'getattr': <built-in function getattr>, 'abs': <built-in function abs>, 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit, 'print': <built-in function print>, 'True': True, 'FutureWarning': <class 'FutureWarning'>, 'ImportWarning': <class 'ImportWarning'>, 'None': None, 'hash': <built-in function hash>, 'ReferenceError': <class 'ReferenceError'>, 'len': <built-in function len>, 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information., 'frozenset': <class 'frozenset'>, '__name__': 'builtins', 'ord': <built-in function ord>, 'super': <class 'super'>, '_': Decimal('NaN123'), 'TypeError': <class 'TypeError'>, 'license': Type license() to see the full license text, 'KeyboardInterrupt': <class 'KeyboardInterrupt'>, 'UserWarning': <class 'UserWarning'>, 'filter': <class 'filter'>, 'range': <class 'range'>, 'staticmethod': <class 'staticmethod'>, 'SystemError': <class 'SystemError'>, 'BaseException': <class 'BaseException'>, 'pow': <built-in function pow>, 'RuntimeError': <class 'RuntimeError'>, 'float': <class 'float'>, 'MemoryError': <class 'MemoryError'>, 'StopIteration': <class 'StopIteration'>, 'globals': <built-in function globals>, 'divmod': <built-in function divmod>, 'enumerate': <class 'enumerate'>, 'Ellipsis': Ellipsis, 'LookupError': <class 'LookupError'>, 'open': <class 'io.OpenWrapper'>, 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit, 'UnicodeError': <class 'UnicodeError'>, 'zip': <class 'zip'>, 'hex': <built-in function hex>, 'next': <built-in function next>, 'ImportError': <class 'ImportError'>, 'chr': <built-in function chr>, 'type': <class 'type'>, '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", 'Exception': <class 'Exception'>, 'tuple': <class 'tuple'>, 'reversed': <class 'reversed'>, 'UnicodeEncodeError': <class 'UnicodeEncodeError'>, 'input': <built-in function input>, 'hasattr': <built-in function hasattr>, 'delattr': <built-in function delattr>, 'setattr': <built-in function setattr>, 'SyntaxWarning': <class 'SyntaxWarning'>, 'compile': <built-in function compile>, 'ArithmeticError': <class 'ArithmeticError'>, 'str': <class 'str'>, 'property': <class 'property'>, 'GeneratorExit': <class 'GeneratorExit'>, 'int': <class 'int'>, '__import__': <built-in function __import__>, 'KeyError': <class 'KeyError'>, 'PendingDeprecationWarning': <class 'PendingDeprecationWarning'>, 'EnvironmentError': <class 'EnvironmentError'>, 'ascii': <built-in function ascii>, 'id': <built-in function id>, 'OSError': <class 'OSError'>, 'DeprecationWarning': <class 'DeprecationWarning'>, 'min': <built-in function min>, 'UnicodeWarning': <class 'UnicodeWarning'>, 'any': <built-in function any>, 'complex': <class 'complex'>, 'bool': <class 'bool'>, 'ValueError': <class 'ValueError'>, 'NotImplemented': NotImplemented, 'map': <class 'map'>, 'exec': <built-in function exec>, 'max': <built-in function max>, 'object': <class 'object'>, 'TabError': <class 'TabError'>, 'ZeroDivisionError': <class 'ZeroDivisionError'>, 'eval': <built-in function eval>, '__debug__': True, 'IndentationError': <class 'IndentationError'>, 'AssertionError': <class 'AssertionError'>, 'classmethod': <class 'classmethod'>, 'UnboundLocalError': <class 'UnboundLocalError'>, 'NotImplementedError': <class 'NotImplementedError'>, 'AttributeError': <class 'AttributeError'>, 'OverflowError': <class 'OverflowError'>}, '__file__': '/temp/python/py3k/Lib/test/test_builtin.py', 'BuiltinTest': <class 'test.test_builtin.BuiltinTest'>, 'TestFailingBool': <class 'test.test_builtin.TestFailingBool'>, 'sys': <module 'sys' (built-in)>, 'test': <module 'test' from '/temp/python/py3k/Lib/test/__init__.py'>, '__name__': 'test.test_builtin', 'unlink': <function unlink at 0x7a5540>, 'TESTFN': '@test', 'TestSorted': <class 'test.test_builtin.TestSorted'>, 'BitBucket': <class 'test.test_builtin.BitBucket'>, 'fcmp': <function fcmp at 0x7ad540>} != {'unittest': <module 'unittest' from '/temp/python/py3k/Lib/unittest.py'>, 'random': <module 'random' from '/temp/python/py3k/Lib/random.py'>, 'test_conv_no_sign': [('0', 0), ('1', 1), ('9', 9), ('10', 10), ('99', 99), ('100', 100), ('314', 314), (' 314', 314), ('314 ', 314), (' \t\t 314 \t\t ', 314), ('2147483647', 2147483647), (' 1x', <class 'ValueError'>), (' 1 ', 1), (' 1\x02 ', <class 'ValueError'>), ('', <class 'ValueError'>), (' ', <class 'ValueError'>), (' \t\t ', <class 'ValueError'>), ('\u0663\u0661\u0664 ', 314), ('\u0200', <class 'ValueError'>)], 'test_conv_sign': [('0', 0), ('1', 1), ('9', 9), ('10', 10), ('99', 99), ('100', 100), ('314', 314), (' 314', <class 'ValueError'>), ('314 ', 314), (' \t\t 314 \t\t ', <class 'ValueError'>), ('2147483647', 2147483647), (' 1x', <class 'ValueError'>), (' 1 ', <class 'ValueError'>), (' 1\x02 ', <class 'ValueError'>), ('', <class 'ValueError'>), (' ', <class 'ValueError'>), (' \t\t ', <class 'ValueError'>), ('\u0663\u0661\u0664 ', 314), ('\u0200', <class 'ValueError'>)], 'run_with_locale': <function run_with_locale at 0x10b0390>, 'io': <module 'io' from '/temp/python/py3k/Lib/io.py'>, 'Squares': <class 'test.test_builtin.Squares'>, 'neg': <built-in function neg>, '__package__': None, 'collections': <module 'collections' from '/temp/python/py3k/Lib/collections.py'>, 'TestFailingIter': <class 'test.test_builtin.TestFailingIter'>, 'run_unittest': <function run_unittest at 0x10b0540>, '__doc__': None, 'test_main': <function test_main at 0x1474390>, 'fractions': <module 'fractions' from '/temp/python/py3k/Lib/fractions.py'>, 'StrSquares': <class 'test.test_builtin.StrSquares'>, 'warnings': <module 'warnings' from '/temp/python/py3k/Lib/warnings.py'>, '__builtins__': {'bytearray': <class 'bytearray'>, 'IndexError': <class 'IndexError'>, 'all': <built-in function all>, 'help': Type help() for interactive help, or help(object) for help about object., 'vars': <built-in function vars>, 'SyntaxError': <class 'SyntaxError'>, 'UnicodeDecodeError': <class 'UnicodeDecodeError'>, 'memoryview': <class 'memoryview'>, 'isinstance': <built-in function isinstance>, '__build_class__': <built-in function __build_class__>, 'copyright': Copyright (c) 2001-2008 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved., 'NameError': <class 'NameError'>, 'BytesWarning': <class 'BytesWarning'>, 'dict': <class 'dict'>, 'IOError': <class 'IOError'>, 'oct': <built-in function oct>, 'bin': <built-in function bin>, 'SystemExit': <class 'SystemExit'>, 'format': <built-in function format>, 'repr': <built-in function repr>, 'sorted': <built-in function sorted>, 'False': False, 'RuntimeWarning': <class 'RuntimeWarning'>, 'list': <class 'list'>, 'iter': <built-in function iter>, 'Warning': <class 'Warning'>, '__package__': None, 'round': <built-in function round>, 'dir': <built-in function dir>, 'cmp': <built-in function cmp>, 'set': <class 'set'>, 'bytes': <class 'bytes'>, 'UnicodeTranslateError': <class 'UnicodeTranslateError'>, 'issubclass': <built-in function issubclass>, 'EOFError': <class 'EOFError'>, 'locals': <built-in function locals>, 'BufferError': <class 'BufferError'>, 'slice': <class 'slice'>, 'FloatingPointError': <class 'FloatingPointError'>, 'sum': <built-in function sum>, 'getattr': <built-in function getattr>, 'abs': <built-in function abs>, 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit, 'print': <built-in function print>, 'True': True, 'FutureWarning': <class 'FutureWarning'>, 'ImportWarning': <class 'ImportWarning'>, 'None': None, 'hash': <built-in function hash>, 'ReferenceError': <class 'ReferenceError'>, 'len': <built-in function len>, 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information., 'frozenset': <class 'frozenset'>, '__name__': 'builtins', 'ord': <built-in function ord>, 'super': <class 'super'>, '_': Decimal('NaN123'), 'TypeError': <class 'TypeError'>, 'license': Type license() to see the full license text, 'KeyboardInterrupt': <class 'KeyboardInterrupt'>, 'UserWarning': <class 'UserWarning'>, 'filter': <class 'filter'>, 'range': <class 'range'>, 'staticmethod': <class 'staticmethod'>, 'SystemError': <class 'SystemError'>, 'BaseException': <class 'BaseException'>, 'pow': <built-in function pow>, 'RuntimeError': <class 'RuntimeError'>, 'float': <class 'float'>, 'MemoryError': <class 'MemoryError'>, 'StopIteration': <class 'StopIteration'>, 'globals': <built-in function globals>, 'divmod': <built-in function divmod>, 'enumerate': <class 'enumerate'>, 'Ellipsis': Ellipsis, 'LookupError': <class 'LookupError'>, 'open': <class 'io.OpenWrapper'>, 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit, 'UnicodeError': <class 'UnicodeError'>, 'zip': <class 'zip'>, 'hex': <built-in function hex>, 'next': <built-in function next>, 'ImportError': <class 'ImportError'>, 'chr': <built-in function chr>, 'type': <class 'type'>, '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", 'Exception': <class 'Exception'>, 'tuple': <class 'tuple'>, 'reversed': <class 'reversed'>, 'UnicodeEncodeError': <class 'UnicodeEncodeError'>, 'input': <built-in function input>, 'hasattr': <built-in function hasattr>, 'delattr': <built-in function delattr>, 'setattr': <built-in function setattr>, 'SyntaxWarning': <class 'SyntaxWarning'>, 'compile': <built-in function compile>, 'ArithmeticError': <class 'ArithmeticError'>, 'str': <class 'str'>, 'property': <class 'property'>, 'GeneratorExit': <class 'GeneratorExit'>, 'int': <class 'int'>, '__import__': <built-in function __import__>, 'KeyError': <class 'KeyError'>, 'PendingDeprecationWarning': <class 'PendingDeprecationWarning'>, 'EnvironmentError': <class 'EnvironmentError'>, 'ascii': <built-in function ascii>, 'id': <built-in function id>, 'OSError': <class 'OSError'>, 'DeprecationWarning': <class 'DeprecationWarning'>, 'min': <built-in function min>, 'UnicodeWarning': <class 'UnicodeWarning'>, 'any': <built-in function any>, 'complex': <class 'complex'>, 'bool': <class 'bool'>, 'ValueError': <class 'ValueError'>, 'NotImplemented': NotImplemented, 'map': <class 'map'>, 'exec': <built-in function exec>, 'max': <built-in function max>, 'object': <class 'object'>, 'TabError': <class 'TabError'>, 'ZeroDivisionError': <class 'ZeroDivisionError'>, 'eval': <built-in function eval>, '__debug__': True, 'IndentationError': <class 'IndentationError'>, 'AssertionError': <class 'AssertionError'>, 'classmethod': <class 'classmethod'>, 'UnboundLocalError': <class 'UnboundLocalError'>, 'NotImplementedError': <class 'NotImplementedError'>, 'AttributeError': <class 'AttributeError'>, 'OverflowError': <class 'OverflowError'>}, '__file__': '/temp/python/py3k/Lib/test/test_builtin.py', 'BuiltinTest': <class 'test.test_builtin.BuiltinTest'>, 'TestFailingBool': <class 'test.test_builtin.TestFailingBool'>, 'sys': <module 'sys' (built-in)>, 'test': <module 'test' from '/temp/python/py3k/Lib/test/__init__.py'>, '__name__': 'test.test_builtin', 'unlink': <function unlink at 0x7a5540>, 'TESTFN': '@test', 'TestSorted': <class 'test.test_builtin.TestSorted'>, 'BitBucket': <class 'test.test_builtin.BitBucket'>, 'fcmp': <function fcmp at 0x7ad540>} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "Lib/test/regrtest.py", line 1197, in <module> main() File "Lib/test/regrtest.py", line 411, in main testdir, huntrleaks) File "Lib/test/regrtest.py", line 570, in runtest testdir, huntrleaks) File "Lib/test/regrtest.py", line 623, in runtest_inner print("test", test, "failed --", msg) File "/temp/python/py3k/Lib/io.py", line 1459, in write b = encoder.encode(s) File "/temp/python/py3k/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] UnicodeEncodeError: 'ascii' codec can't encode characters in position 697-699: ordinal not in range(128) |
|||
msg70387 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2008-07-29 12:42 | |
My wild uneducated guess is that it's due to a nan-like value being in the globals, and comparing unequal to itself: >>> d = {1: float('nan')} >>> d {1: nan} >>> d == d False >>> import decimal >>> nan = decimal.Decimal('nan') >>> d = {1: nan} >>> d == d False |
|||
msg70391 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * | Date: 2008-07-29 13:30 | |
Bingo! doctest sets the __builtins__._ variable, and the last doctest in decimal.py (in lexicographic order) is Decimal.__round__, which ends with >>> round(Decimal('sNaN123'), 0) Decimal('NaN123') This is the value you see in Benjamin's output. Here is a trivial patch: Index: Lib/test/regrtest.py =================================================================== --- Lib/test/regrtest.py (revision 65283) +++ Lib/test/regrtest.py (working copy) @@ -647,6 +647,8 @@ def cleanup_test_droppings(testname, verbose): import shutil + __builtins__._ = None + # Try to clean up junk commonly left behind. While tests shouldn't leave # any files or directories behind, when a test fails that can be tedious # for it to arrange. The consequences can be especially nasty on Windows, |
|||
msg70392 - (view) | Author: Benjamin Peterson (benjamin.peterson) * | Date: 2008-07-29 13:32 | |
On Tue, Jul 29, 2008 at 8:30 AM, Amaury Forgeot d'Arc <report@bugs.python.org> wrote: > > Amaury Forgeot d'Arc <amauryfa@gmail.com> added the comment: > > Bingo! doctest sets the __builtins__._ variable, > and the last doctest in decimal.py (in lexicographic order) is > Decimal.__round__, which ends with > >>> round(Decimal('sNaN123'), 0) > Decimal('NaN123') > This is the value you see in Benjamin's output. > > Here is a trivial patch: Shouldn't this be fixed in test_decimal so it cleans properly after it's self? |
|||
msg70393 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2008-07-29 13:45 | |
I think the cleanup should either be in regrtest.py as Amaury proposes, or in doctest itself. There's nothing wrong in decimal and its test suite. |
|||
msg70394 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * | Date: 2008-07-29 13:45 | |
I was leaning towards the "doctest should not pollute the __builtins__ module" side. test_decimal might not be the only test that leaks one object outside the module. |
|||
msg70395 - (view) | Author: Benjamin Peterson (benjamin.peterson) * | Date: 2008-07-29 13:47 | |
I vote for fixing doctest then! |
|||
msg70396 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * | Date: 2008-07-29 14:28 | |
Here is another patch that modifies doctest itself. Note that the _ is cleared only if "clear_globs" is True, which makes sense IMO. Index: Lib/doctest.py =================================================================== --- Lib/doctest.py (revision 65283) +++ Lib/doctest.py (working copy) @@ -1360,6 +1360,7 @@ linecache.getlines = self.save_linecache_getlines if clear_globs: test.globs.clear() + __builtins__['_'] = None #///////////////////////////////////////////////////////////////// # Summarization |
|||
msg70398 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2008-07-29 15:15 | |
The doctest patch looks fine to me. |
|||
msg70399 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2008-07-29 15:29 | |
Well except that it would be better spelt as: __builtins__._ = None |
|||
msg70400 - (view) | Author: Benjamin Peterson (benjamin.peterson) * | Date: 2008-07-29 15:35 | |
Ok. Thanks! Applied in r65285. |
|||
msg70401 - (view) | Author: Benjamin Peterson (benjamin.peterson) * | Date: 2008-07-29 15:39 | |
On Tue, Jul 29, 2008 at 10:29 AM, Antoine Pitrou <report@bugs.python.org> wrote: > > Antoine Pitrou <pitrou@free.fr> added the comment: > > Well except that it would be better spelt as: > __builtins__._ = None __builtins__ is a dict here, though. > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue3462> > _______________________________________ > -- Cheers, Benjamin Peterson "There's no place like 127.0.0.1." |
|||
msg70402 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * | Date: 2008-07-29 15:42 | |
You know what? It's a mess. - from the __main__ module, __builtins__ is a module. - in all other modules, __builtins__ is a dict. The fix is correct for most modules: ./python Lib\test\test_decimal.py but fails for ./python Lib\doctest.py |
|||
msg70403 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2008-07-29 15:52 | |
Selon Amaury Forgeot d'Arc <report@bugs.python.org>: > > You know what? It's a mess. > - from the __main__ module, __builtins__ is a module. > - in all other modules, __builtins__ is a dict. (why is it so? :-O) Anyway: import builtins as b b._ = None |
|||
msg70404 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2008-07-29 15:59 | |
Ok, I've found it: « But why is __builtins__ a module in __main__ and a dict elsewhere? Because in *interactive* mode, printing vars() would include __builtins__, which would be rather large. Code that incorrectly assumes it's always one or the other is incorrect and has always been incorrect; the wart was present when this feature first appeared. Since this has never been documented AFAIK, it's probably just been (incorrectly) reverse-engineered and copied around. » http://mail.python.org/pipermail/python-3000/2007-March/006170.html :-S |
|||
msg70405 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * | Date: 2008-07-29 16:02 | |
It is actually documented, at the bottom of http://docs.python.org/dev/library/__builtin__.html "import builtin" is the correct thing to do. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:37 | admin | set | github: 47712 |
2008-07-29 16:02:12 | amaury.forgeotdarc | set | messages: + msg70405 |
2008-07-29 15:59:33 | pitrou | set | messages: + msg70404 |
2008-07-29 15:52:36 | pitrou | set | messages: + msg70403 |
2008-07-29 15:42:46 | amaury.forgeotdarc | set | messages: + msg70402 |
2008-07-29 15:39:38 | benjamin.peterson | set | messages: + msg70401 |
2008-07-29 15:35:37 | benjamin.peterson | set | status: open -> closed resolution: fixed messages: + msg70400 |
2008-07-29 15:29:35 | pitrou | set | messages: + msg70399 |
2008-07-29 15:15:20 | pitrou | set | messages: + msg70398 |
2008-07-29 14:28:06 | amaury.forgeotdarc | set | messages: + msg70396 |
2008-07-29 13:47:03 | benjamin.peterson | set | type: behavior messages: + msg70395 components: + Library (Lib), Tests |
2008-07-29 13:45:57 | amaury.forgeotdarc | set | messages: + msg70394 |
2008-07-29 13:45:34 | pitrou | set | messages: + msg70393 |
2008-07-29 13:32:11 | benjamin.peterson | set | messages: + msg70392 |
2008-07-29 13:30:16 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg70391 |
2008-07-29 12:42:37 | pitrou | set | nosy:
+ pitrou messages: + msg70387 |
2008-07-29 02:06:34 | benjamin.peterson | create |