[issue13557] exec of list comprehension fails on NameError

2011-12-12 Thread Stephan R.A. Deibel
Stephan R.A. Deibel added the comment: Here's a patch to the docs that notes the issue and refers the reader to the relevant execution model docs page. I have also attempted to clarify the "interaction with dynamic features" section of the execution model page. -- keywords: +patch ve

[issue13591] import_module potentially imports a module twice

2011-12-12 Thread Ryan Twitchell
New submission from Ryan Twitchell : Use of importlib's import_module function with modules belonging to a library can cause some modules to be imported twice, if such a module is referenced from sibling modules, and from __init__ in the package. I suspect this is a bug, or at best a nuance of p

[issue13591] import_module potentially imports a module twice

2011-12-12 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +brett.cannon, ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue13505] Bytes objects pickled in 3.x with protocol <=2 are unpickled incorrectly in 2.x

2011-12-12 Thread sbt
sbt added the comment: I now realise latin_1_encode won't work because it returns a pair (bytes_obj, length). I have done a patch using _codecs.encode instead -- the pickles turn out to be exactly the same size anyway. >>> pickletools.dis(pickle.dumps(b"abc", 2)) 0: \x80 PROTO 2

[issue7163] IDLE suppresses sys.stdout.write() return value

2011-12-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: Re-verified on 3.2.2, win 7. #13532 shows a worse problem with sys.stdout.write on the above. -- versions: +Python 3.3 -Python 3.1 ___ Python tracker __

[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object

2011-12-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: We should like the IDLE shell to give the same results as the standard shell. See #7163 On 3.2.2 on Win7, the problem is worse: sys.stdout.write(100) crashes IDLE -- as in it just fades away after a short (1/2 sec?) delay. sys.stdout.write(sys) gives me the

[issue13538] Improve doc for str(bytesobject)

2011-12-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: I think Eric's suggestion is the proper approach. -- nosy: +terry.reedy ___ Python tracker ___ ___

[issue13538] Improve doc for str(bytesobject)

2011-12-12 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue13540] Document the Action API in argparse

2011-12-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: The doc specified the Action API as the interface inherited from argparse.Action plus the addition of a custom __call__ method with 4 params (5 with self) as described. That seems mostly adequate to me, unless there is something missing in the parameter descr

[issue13516] Gzip old log files in rotating handlers

2011-12-12 Thread Raul Morales
Raul Morales added the comment: Interesting, then I will wait your post. Thanks. -- ___ Python tracker ___ ___ Python-bugs-list maili

[issue13548] Invalid 'line' tracer event on pass within else clause

2011-12-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: (Snippet examples can be made 2/3 agnostic with from __future__ import print_function) 3.2.2 on win7, IDLE, gives me F:\Python\mypy\tem.py 7 call F:\Python\mypy\tem.py 8 line F:\Python\mypy\tem.py 10 line F:\Python\mypy\tem.py 11 line F:\Python\mypy\tem.py 13

[issue13585] Add contextlib.CleanupManager

2011-12-12 Thread Julian Berman
Julian Berman added the comment: For reference, the implementation that I posted in the other thread is: @contextlib.contextmanager def maybe(got, contextfactory, *args, checkif=bool, **kwargs): if checkif(got): yield got else: with contextfactory

[issue13521] Make dict.setdefault() atomic

2011-12-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I would like to continue working on this test, but incoming week is > pretty intensive for me. Is it ok if I returned to working on this > during the weekend? Of course. There's no rush. (I'm really not sure it should go in 2.7 and 3.2; this looks more like a

[issue13505] Bytes objects pickled in 3.x with protocol <=2 are unpickled incorrectly in 2.x

2011-12-12 Thread Meador Inge
Meador Inge added the comment: On Sun, Dec 11, 2011 at 12:17 PM, sbt wrote: >> I don't really know that much about pickle, but Antoine mentioned that >> 'bytearray' >> works fine going from 3.2 to 2.7.  Given that, can't we just compose 'bytes' >> with >> 'bytearray'? > > Yes, although it wo

[issue7163] IDLE suppresses sys.stdout.write() return value

2011-12-12 Thread Roger Serwy
Roger Serwy added the comment: If you add "return len(s)" to PseudoFile::write in PyShell.py, then it will work. However, this approach may not be "the right thing to do." -- nosy: +serwy ___ Python tracker __

[issue13532] In IDLE, sys.stdout.write and sys.stderr can write any pickleable object

2011-12-12 Thread Roger Serwy
Roger Serwy added the comment: The crash can be prevented by using #13582. The RPCProxy object would need to be subclassed so that it raises TypeError for the "write" method when it is not given a string. -- nosy: +serwy ___ Python tracker

[issue13505] Bytes objects pickled in 3.x with protocol <=2 are unpickled incorrectly in 2.x

2011-12-12 Thread sbt
sbt added the comment: > Which is fine. 'bytes' and byte literals were not introduced until > 2.6 [1,2]. So *any* solution we come > up with is for >= 2.6. In 2.6 and 2.7, bytes is just an alias for str. In all 2.x versions with codecs.encode, the result will be str. (Although I haven't ac

[issue13591] import_module potentially imports a module twice

2011-12-12 Thread Meador Inge
Changes by Meador Inge : -- nosy: +meador.inge ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue13585] Add contextlib.CleanupManager

2011-12-12 Thread Nick Coghlan
Nick Coghlan added the comment: Given the existence of tempfile.TemporaryDirectory in recent Python versions, I suggest finding a new cleanup function example that doesn't duplicate native stdlib functionality :) I do see value in the feature itself though - I believe the precedent of both t

[issue1785] "inspect" gets broken by some descriptors

2011-12-12 Thread Meador Inge
Changes by Meador Inge : -- nosy: +meador.inge ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

[issue13585] Add contextlib.CleanupManager

2011-12-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: I think you guys need to post your code somewhere (perhaps on PyPi or the ASPN Cookbook). It needs to mature beyond the stage of "I just whipped-up this code and think it would be great if everybody used it". I've seen nothing like this being used in prod

[issue13585] Add contextlib.CleanupManager

2011-12-12 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger resolution: -> later ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue13591] import_module potentially imports a module twice

2011-12-12 Thread Nick Coghlan
Nick Coghlan added the comment: At first glance, I thought this might be just the circular import problem (#992389) appearing in a different guise. However, if that was the case, switching to an import statement or __import__ shouldn't have made any difference. What do you see if you put an

[issue13521] Make dict.setdefault() atomic

2011-12-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks, I'll look at it over the next few days. -- ___ Python tracker ___ ___ Python-bugs-list m

[issue13585] Add contextlib.CleanupManager

2011-12-12 Thread Nick Coghlan
Nick Coghlan added the comment: TestCase.setUp() and TestCase.tearDown() were amongst the precursors to__enter__() and __exit__(). addCleanUp() fills exactly the same role here - and I've seen *plenty* of positive feedback directed towards Michael for that addition to the unittest API. For i

[issue13585] Add contextlib.CleanupManager

2011-12-12 Thread Nick Coghlan
Nick Coghlan added the comment: Given the history of API design errors in contextlib (cf. contextlib.nested in general, making contextlib._GeneratorContextManager a subclass of contextlib.ContextDecorator), I've realised Raymond is right in wanting to see this idea more thoroughly vetted befo

[issue13585] Add contextlib.CleanupManager

2011-12-12 Thread Nick Coghlan
Nick Coghlan added the comment: In the meantime, I put my version up as a cookbook recipe: http://code.activestate.com/recipes/577981-cleanupmanager-for-with-statements/ -- ___ Python tracker

[issue13589] Aifc float serialization fix

2011-12-12 Thread Oleg Plakhotnyuk
Changes by Oleg Plakhotnyuk : Removed file: http://bugs.python.org/file23935/aifc_numbers_fix.patch ___ Python tracker ___ ___ Python-bugs-lis

[issue13589] Aifc float serialization fix

2011-12-12 Thread Oleg Plakhotnyuk
Changes by Oleg Plakhotnyuk : Added file: http://bugs.python.org/file23939/aifc_numbers_fix.patch ___ Python tracker ___ ___ Python-bugs-list

[issue13589] Aifc float serialization fix

2011-12-12 Thread Oleg Plakhotnyuk
Changes by Oleg Plakhotnyuk : Removed file: http://bugs.python.org/file23939/aifc_numbers_fix.patch ___ Python tracker ___ ___ Python-bugs-lis

[issue13589] Aifc float serialization fix

2011-12-12 Thread Oleg Plakhotnyuk
Changes by Oleg Plakhotnyuk : Added file: http://bugs.python.org/file23940/aifc_numbers_fix.patch ___ Python tracker ___ ___ Python-bugs-list

[issue13589] Aifc low level serialization primitives fix

2011-12-12 Thread Oleg Plakhotnyuk
Changes by Oleg Plakhotnyuk : -- title: Aifc float serialization fix -> Aifc low level serialization primitives fix ___ Python tracker ___ __

[issue13394] Patch to increase aifc lib test coverage

2011-12-12 Thread Oleg Plakhotnyuk
Changes by Oleg Plakhotnyuk : -- title: Patch to increase aifc lib test coverage with couple of minor fixes -> Patch to increase aifc lib test coverage ___ Python tracker ___ __

[issue13577] __qualname__ is not present on builtin methods and functions

2011-12-12 Thread Meador Inge
Meador Inge added the comment: For the most part this looks OK, but I am not sure about this hunk: diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3724,7 +3724,7 @@ add_methods(PyTypeObject *type, PyMethod descr = P

<    1   2