[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: It is actually documented, at the bottom of http://docs.python.org/dev/library/__builtin__.html "import builtin" is the correct thing to do. ___ Python tracker <[EMAIL PROTECTED]>

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: 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 t

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Selon Amaury Forgeot d'Arc <[EMAIL PROTECTED]>: > > 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

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: 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\

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: On Tue, Jul 29, 2008 at 10:29 AM, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > > Antoine Pitrou <[EMAIL PROTECTED]> added the comment: > > Well except that it would be better spelt as: >__builtins__._ = None __builtins__ is a dict here,

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: Ok. Thanks! Applied in r65285. -- resolution: -> fixed status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Well except that it would be better spelt as: __builtins__._ = None ___ Python tracker <[EMAIL PROTECTED]> ___

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: The doctest patch looks fine to me. ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-b

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: 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/docte

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: I vote for fixing doctest then! -- components: +Library (Lib), Tests type: -> behavior ___ Python tracker <[EMAIL PROTECTED]>

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: 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. ___ Python tracker <[EMAIL PROTE

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: 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. ___ Python tracker <[EMAIL PROTECTED]>

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: On Tue, Jul 29, 2008 at 8:30 AM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> wrote: > > Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: > > Bingo! doctest sets the __builtins__._ variable, > and the last doctest in decimal.py (in l

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> 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 s

[issue3462] test_builtin fails after test_decimal

2008-07-29 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: 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

[issue3462] test_builtin fails after test_decimal

2008-07-28 Thread Benjamin Peterson
New submission from Benjamin Peterson <[EMAIL PROTECTED]>: 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() F