[issue3693] Obscure array.array error message
Alexandre Vassalotti added the comment: Here's a patch to fix the exception. -- keywords: +patch Added file: http://bugs.python.org/file29949/fix_array_err_msg.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3693 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Nick Coghlan added the comment: I'll create a separate issue for the tp_del - __del__ question, since that's a language design decision that *does* need Guido's input, but doesn't relate to the broader question of generators, cycles and potential memory leaks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17800] Expose __del__ when tp_del is populated from C code
New submission from Nick Coghlan: This came up in issue 17468: currently, populating tp_del from C (as generators now do) doesn't automatically create a __del__ wrapper visible from Python. The rationale given in the initial commit is that there's no need to define a wrapper, since tp_del won't be populated from C code (that will use tp_dealloc instead), but there's now at least one case where it *is* populated from C (generators), which means it behaves *as if* __del__ is defined (since the interpreter actually checks the tp_del slot), but *looks* like __del__ *isn't* defined (since there is no wrapper created). Independent of the memory leak concerns with generators defining tp_del, it would be better if a wrapper function was defined so the existence of the method was at least visible from Python code. -- components: Interpreter Core messages: 187409 nosy: ncoghlan priority: low severity: normal stage: needs patch status: open title: Expose __del__ when tp_del is populated from C code type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Nick Coghlan added the comment: Issue 17800 is anyone wants to weigh in on the tp_del - __del__ question (I ended up not adding Guido back to that one either, since the original design was based on an assumption that's now demonstrably false, so it makes sense to update the behaviour) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17801] Tools/scripts/gprof2html.py: `#! /usr/bin/env python32.3`
New submission from C Anthony Risinger: http://hg.python.org/cpython/file/d499189e7758/Tools/scripts/gprof2html.py#l1 ...should be self explanatory. i didn't run into this myself, but i saw that the Archlinux package was fixing it via `sed`, without the customary link to upstream... so here it is ;) -- components: Demos and Tools messages: 187411 nosy: C.Anthony.Risinger priority: normal severity: normal status: open title: Tools/scripts/gprof2html.py: `#! /usr/bin/env python32.3` versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17801 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17800] Expose __del__ when tp_del is populated from C code
Richard Oudkerk added the comment: Would this mean that the destructor could be run more than once (or prematurely)? -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Anssi Kääriäinen added the comment: I wonder if it would be better to reword the garbage collection docs to mention that Python can't collect objects if they are part of a reference cycle, and some of the objects in the reference cycle need to run code at gc time. Then mention that such objects include objects with __del__ and also generators if they do have some other blocks than loops in them (for example try or with blocks). To me it seems this issue could be mitigated somewhat by collecting the objects if there is just one object with finalizer code in the cycle. It should be safe to run the single finalizer, then collect the whole cycle, right? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1635741] Interpreter seems to leak references after finalization
Changes by Martin Morrison m...@ensoft.co.uk: -- nosy: +isoschiz, pconnell ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1635741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17408] second python execution fails when embedding
Changes by Martin Morrison m...@ensoft.co.uk: -- nosy: +isoschiz, pconnell ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17408 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17802] html.HTMLParser raises UnboundLocalError:
New submission from Baptiste Mispelon: When trying to parse the string `ab`, the parser raises an UnboundLocalError: {{{ from html.parser import HTMLParser p = HTMLParser() p.feed('ab') p.close() Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.3/html/parser.py, line 149, in close self.goahead(1) File /usr/lib/python3.3/html/parser.py, line 252, in goahead if k = i: UnboundLocalError: local variable 'k' referenced before assignment }}} Granted, the HTML is invalid, but this error looks like it might have been an oversight. -- components: Library (Lib) messages: 187414 nosy: bmispelon priority: normal severity: normal status: open title: html.HTMLParser raises UnboundLocalError: type: crash versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17802 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9634] Add timeout parameter to Queue.join()
Changes by Martin Morrison m...@ensoft.co.uk: -- nosy: +isoschiz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9634 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Antoine Pitrou added the comment: I wonder if it would be better to reword the garbage collection docs to mention that Python can't collect objects if they are part of a reference cycle, and some of the objects in the reference cycle need to run code at gc time. Then mention that such objects include objects with __del__ and also generators if they do have some other blocks than loops in them (for example try or with blocks). To me it seems this issue could be mitigated somewhat by collecting the objects if there is just one object with finalizer code in the cycle. It should be safe to run the single finalizer, then collect the whole cycle, right? This is tricky because it relies on the fact that the object with finalizer will be collected before any objects the finalizer relies on. For a generator, this means it has to be finalized before its frame object is cleared (otherwise, the finally block can't execute correctly). However, the GC doesn't collect those objects directly. It calls tp_clear on each of them, hoping that tp_clear will break the reference cycle (and at the same time collect some of the objects in the cycle). But it's difficult to influence which objects are collected first. In gcgen.py's case, the reference cycle is comprised of the MyObj instance, the generator, and the generator's frame: `self` (MyObj) - generator - frame - `self` (MyObj) So if `self` is collected first, it will collect the generator before the frame, and the generator's finally block can execute fine. But if the frame is collected first, it will clear itself and it will be too late for the generator's finally block to execute. And if the generator is collected first... well, it can't, as it doesn't have a tp_clear slot; but if it had, that would clear the frame and make the finally block uncallable. One might argue that a generator's tp_clear should call the finally block *before* clearing the frame. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17545] os.listdir and os.path.join inconsistent on empty path
Changes by R. David Murray rdmur...@bitdance.com: -- keywords: +easy stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17545 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17802] html.HTMLParser raises UnboundLocalError:
R. David Murray added the comment: Thanks for the report. Yes, that's in a complicated bit of error recovery code, and clearly you found a path through it that doesn't have a corresponding test :) -- keywords: +easy nosy: +ezio.melotti, r.david.murray stage: - needs patch type: crash - behavior versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17802 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17800] Expose __del__ when tp_del is populated from C code
Antoine Pitrou added the comment: Sounds reasonable to me. Note that it won't remove the special-casing in gcmodule.c: static int has_finalizer(PyObject *op) { if (PyGen_CheckExact(op)) return PyGen_NeedsFinalizing((PyGenObject *)op); else return op-ob_type-tp_del != NULL; } -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17802] html.HTMLParser raises UnboundLocalError:
Changes by Ezio Melotti ezio.melo...@gmail.com: -- assignee: - ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17802 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17803] Calling Tkinter.Tk() with a baseName keyword argument throws UnboundLocalError
New submission from Yasuhiro Fujii: Calling Tkinter.Tk() with baseName keyword argument throws UnboundLocalError on Python 2.7.4. A process to reproduce the bug: import Tkinter Tkinter.Tk(baseName=test) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.7/lib-tk/Tkinter.py, line 1748, in __init__ if not sys.flags.ignore_environment: UnboundLocalError: local variable 'sys' referenced before assignment A patch to fix the bug: --- Lib/lib-tk/Tkinter.py.orig +++ Lib/lib-tk/Tkinter.py @@ -1736,7 +1736,7 @@ # ensure that self.tk is always _something_. self.tk = None if baseName is None: -import sys, os +import os baseName = os.path.basename(sys.argv[0]) baseName, ext = os.path.splitext(baseName) if ext not in ('.py', '.pyc', '.pyo'): -- components: Tkinter messages: 187418 nosy: y-fujii priority: normal severity: normal status: open title: Calling Tkinter.Tk() with a baseName keyword argument throws UnboundLocalError type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17803 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Anssi Kääriäinen added the comment: I was imagining that the collection should happen in two passes. First check for tp_dels and call them if safe (single tp_del in cycle allowed). Then free the memory. The first pass is already there, it just doesn't collect callable tp_dels. If it would be possible to turn an object into inaccessible state after tp_del was called it would be possible to call multiple tp_dels in a cycle. If the del tries to use already deleted object you will get some sort of runtime exception indicating access of already collected object (another option is to allow access to object which has already had __del__ called, but that seems problematic). Now, both of the above are likely way more complicated to implement than what I imagine. I have very little knowledge of the technical details involved. If I understand correctly your idea was to do something similar to above, but only for generators. The current situation is somewhat ugly. First, I can imagine people wishing to do try-finally or something with self.lock: in a generator. These will leak in circular reference cases. The generator case is surprising, so surprising that even experienced programmers will do such mistakes (see the django ticket for one example). Second, from application programmers perspective the fact that __del__ wasn't called is usually similar to having a silent failure in their code - for example this can result in leaking database connections or other resources, not to mention possible problems if one has a with self.lock: block in a generator. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14531] Backtrace should not attempt to open stdin file
Changes by Martin Morrison m...@ensoft.co.uk: -- nosy: +isoschiz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14531 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17272] request.full_url: unexpected results on assignment
R. David Murray added the comment: Thanks for working on this, Demian. I made some review comments, mostly style things about the tests. There's one substantial comment about the change in behaivor of the full_url property though (before patch it does not include the fragment, after the patch it does). We need to think about the implications of that change in terms of backward compatibility. It makes more sense, but how likely is it to break working code? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17272 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17795] backwards-incompatible change in SysLogHandler with unix domain sockets
Changes by Vinay Sajip vinay_sa...@yahoo.co.uk: -- hgrepos: +183 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17795 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17795] backwards-incompatible change in SysLogHandler with unix domain sockets
Changes by Vinay Sajip vinay_sa...@yahoo.co.uk: Added file: http://bugs.python.org/file29950/6e46f4e08717.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17795 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17795] backwards-incompatible change in SysLogHandler with unix domain sockets
Vinay Sajip added the comment: I've attached an alternative patch. The default socktype stays as socket.SOCK_DGRAM, but you can specify socktype=None to get the SOCK_DGRAM falling back to SOCK_STREAM behaviour. Can you confirm that this alternative approach works in your environment? (This patch is against the default branch.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17795 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17803] Calling Tkinter.Tk() with a baseName keyword argument throws UnboundLocalError
R. David Murray added the comment: Thanks for the report and patch. It would be nice to turn that test into a unit test. I've run the test on 3.4; this appears to be a 2.7 only bug. -- nosy: +r.david.murray stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17803 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Benjamin Peterson added the comment: In a sense, doing something like with self.lock in a generator is already a leak. Even if there wasn't a cycle, collection could be arbitrarily delayed (in partincular on non-CPython VMs). I wonder if making generators context managers which call close() on exit would help. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Antoine Pitrou added the comment: Those are two different issues: - not calling the finalizer in a timely manner - never calling the finalizer and creating a memory leak through gc.garbage -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14621] Hash function is not randomized properly
Changes by Martin Morrison m...@ensoft.co.uk: -- nosy: +isoschiz, pconnell ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14621 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Benjamin Peterson added the comment: I realize, but if people were responsible and closed their generators, the second one would be as much of a problem. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6359] pyexpat.c calls trace function incorrectly for exceptions
Ned Batchelder added the comment: Attached a patch which simply removes the code that invokes the trace function. -- keywords: +patch Added file: http://bugs.python.org/file29951/6539.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6359 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17192] libffi-3.0.13 import
koobs added the comment: These break what was addressed in #11729 for default, 3,x and 3.3. 2.7 seems to have made it through unscathed. I'm not sure where or how the old code was introduced, but the clang fix has been upstreamed and is correct in the pure libffi 3.0.13 sources Failure to build ctypes can be seen here: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%2Bclang%203.x/builds/1246/steps/test/logs/stdio http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%2Bclang%203.x/builds/1245/steps/test/logs/stdio http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%2Bclang%203.3/builds/538/steps/test/logs/stdio -- nosy: +koobs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17192 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17800] Expose __del__ when tp_del is populated from C code
Benjamin Peterson added the comment: What exactly would calling such a wrapper do? -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17646] traceback.py has a lot of code duplication
Martin Morrison added the comment: On 20/04/2013 03:54, Benjamin Peterson wrote: It would be great to have a test for that. :) I was afraid you'd say that. ;-) I'll look at adding test cases to cover the functions not currently covered (seems most of the print functions aren't, and all of the 'stack' functions aren't). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17646 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17800] Expose __del__ when tp_del is populated from C code
Changes by Martin Morrison m...@ensoft.co.uk: -- nosy: +isoschiz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17192] libffi-3.0.13 import
Changes by R. David Murray rdmur...@bitdance.com: -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17192 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17656] Python 2.7.4 breaks ZipFile extraction of zip files with unicode member paths
koobs added the comment: heads-up: Tests are still failing on FreeBSD (gcc clang) buildbots: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%202.7/builds/472/steps/test/logs/stdio http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%2Bclang%202.7/builds/468/steps/test/logs/stdio -- nosy: +koobs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17800] Expose __del__ when tp_del is populated from C code
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Nick Coghlan added the comment: We can't make ordinary generators innately context managers, as it makes the error too hard to detect when you accidentally leave out @contextmanager when using a generator to write a custom one. You can already use contextlib.closing to forcibly close them when appropriate, so providing a decorator to implicitly map __exit__ to close wouldn't really save much. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue968063] Add fileinput.islastline()
Mark Lawrence added the comment: The latest patch still applies cleanly, can we have it reviewed please. -- nosy: +BreamoreBoy versions: +Python 3.4 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue968063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target
Barry A. Warsaw added the comment: Ezio, the problem with your patch is that it also gives a warning on this code, which is totally safe: def good(): exc = None try: bar(int(sys.argv[1])) except KeyError as e: print('ke') exc = e except ValueError as e: print('ve') exc = e print(exc) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17792 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Nick Coghlan added the comment: To get back to Anssi's original suggestion... I think Anssi's proposal to allow finalisation to be skipped for try/except/else is legitimate. It's only finally clauses that we try to guarantee will execute, there's no such promise implied for ordinary except clauses. We *don't care* if the generator *would* have caught the thrown GeneratorExit, we only care about ensuring that finally blocks are executed (including those implied by with statements). So if there aren't any finally clauses or with statements in the block stack, we should be able to just let the generator and frame get collected (as Anssi suggested), without trying to allow execution to complete. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17800] Expose __del__ when tp_del is populated from C code
Nick Coghlan added the comment: Calling __del__ explicitly shouldn't be any worse than doing the same thing for any other type implemented in Python (or, in the case of generators, calling close() multiple times). What I'm mostly interested in is the can this type cause uncollectable cycles introspection aspect. However, as Antoine noted, generators are an interesting special case because the GC is able to *skip* finalising them in some cases, so exposing __del__ isn't right for them either (as that suggests they will *always* be uncollectable in a cycle, when that isn't the case). So now I'm wondering if a better answer may be to generalise the current generator special case to a __needsdel__ protocol: provide a __del__ method, but always make it possible for the GC to skip it when it wouldn't do anything (e.g. if you've already called close() explicitly). PyGenerator_NeedsFinalizing would then become the __needsdel__ impl for generators, and we could lose the special casing in the GC code. From Python, you could detect the three cases through: __del__ only: can cause uncollectable cycles __del__and __needsdel__: can cause uncollectable cycles, but it depends on the instance state Neither: can't cause uncollectable cycles -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17800] Expose __del__ when tp_del is populated from C code
Benjamin Peterson added the comment: I don't understand why we need to invent a protocol for this. The gc module already has methods and members for introspecting the collection. I don't think the gen special casing currently needs to be generalized. (What would use it?) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Antoine Pitrou added the comment: We *don't care* if the generator *would* have caught the thrown GeneratorExit, we only care about ensuring that finally blocks are executed (including those implied by with statements). So if there aren't any finally clauses or with statements in the block stack, we should be able to just let the generator and frame get collected (as Anssi suggested), without trying to allow execution to complete. That's a good point. I'm also contemplating that the generator close() could be done from the *frame*'s tp_clear, which would sidestep the issue of collect order entirely: the finally block doesn't actually need the generator to execute, it only needs the frame and its locals. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17800] Add gc.needs_finalizing() to check if an object needs finalising
Nick Coghlan added the comment: Yeah, I've figured out that rather than exposing __del__ if tp_del is populated, or generalising the generator special case, the simplest way to make this info accessible is to be able to ask the *garbage collector* if it thinks an object needs finalising. That actually makes this a pretty easy issue (as C issues go) - it's just a matter of exposing http://hg.python.org/cpython/file/default/Modules/gcmodule.c#l525 (has_finalizer) as gc.needs_finalizing. It will be easier once #17468 is done though, since that will make it clearer what the documentation should say. -- dependencies: +Generator memory leak keywords: +easy title: Expose __del__ when tp_del is populated from C code - Add gc.needs_finalizing() to check if an object needs finalising ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17547] checking whether gcc supports ParseTuple __format__... erroneously returns yes with gcc 4.8
Alex Leach added the comment: The configure.ac patch works for me, on x86_64 Arch Linux. I just updated to GCC-4.8.0 and came across an overwhelming number of these warnings when compiling extension modules. Thanks for the simple fix David. Tested on hg branch 2.7; the testsuite completes without error. -- nosy: +Alex.Leach versions: -Python 2.6, Python 2.7, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17547 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16694] Add pure Python operator module
Roundup Robot added the comment: New changeset 97834382c6cc by Antoine Pitrou in branch 'default': Issue #16694: Add a pure Python implementation of the operator module. http://hg.python.org/cpython/rev/97834382c6cc -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16694] Add pure Python operator module
Antoine Pitrou added the comment: I've now commited the latest patch. Thank you very much, Zachary! -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17409] resource.setrlimit doesn't respect -1
Roundup Robot added the comment: New changeset 186f6bb3e46a by R David Murray in branch '3.3': #17409: Document RLIM_INFINITY and use it to clarify the setrlimit docs. http://hg.python.org/cpython/rev/186f6bb3e46a New changeset 9c4db76d073e by R David Murray in branch '2.7': #17409: Document RLIM_INFINITY and use it to clarify the setrlimit docs. http://hg.python.org/cpython/rev/9c4db76d073e New changeset f1d95b0ab66e by R David Murray in branch 'default': Merge #17409: Document RLIM_INFINITY and use it to clarify the setrlimit docs. http://hg.python.org/cpython/rev/f1d95b0ab66e -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17409 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17409] resource.setrlimit doesn't respect -1
R. David Murray added the comment: There being no objection :) I've committed the patch. -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17409 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16942] urllib still doesn't support persistent connections
Senthil Kumaran added the comment: Agree with Demian Brecht. This issue is being closed in when two issues cover the requirements discussed here. * issue# 16901 - For Enhancing FileCookieJar * issue# 9740 - For supporting persistant HTTP 1.1 connections. (:-( on me) -- nosy: +orsenthil resolution: - duplicate stage: needs patch - committed/rejected status: open - closed superseder: - In http.cookiejar.FileCookieJar() the .load() and .revert() methods don't work ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16942 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17646] traceback.py has a lot of code duplication
Serhiy Storchaka added the comment: Could print_exception() in Lib/idlelib/run.py reuse new traceback functions? -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17646 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14805] Support display of both __cause__ and __context__
Serhiy Storchaka added the comment: And don't forget about print_exception() in Lib/idlelib/run.py. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17409] resource.setrlimit doesn't respect -1
Paul Price added the comment: Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17409 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9682] socket.create_connection error message for domain subpart with invalid length is very confusing
R. David Murray added the comment: The message in both branches of the if talk about empty labels, which is probably my fault since I got the sense of the if wrong in my suggestion. One of them should be about the label being too long. The one that should be the 'empty' message also doesn't read right to my eyes. As I said I think it should be something like: 'empty label in %r % result.decode()'. Also, in looking at the module code, there are several other places where the size check and simple message are used. In all of these cases the string has already been confirmed to be (or converted to, in the case of the punycoding) ASCII. So we can abstract this check into a function and call it from all those locations. Do you want to update the patch accordingly, Mike? It will need more tests. -- assignee: loewis - type: enhancement - behavior versions: +Python 3.3, Python 3.4 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17795] backwards-incompatible change in SysLogHandler with unix domain sockets
Mike Lundy added the comment: It doesn't fix it unless I change the configuration (and in some cases the code) for every SyslogHandler across all of our projects, plus every single library we use. Google around For SysLogHandler /dev/log socktype and then compare with SysLogHandler /dev/log. You won't find many hits where people set socktype, because people knew that SyslogHandler just Did The Right Thing when presented with an AF_UNIX. That has been the behavior since the logging module was introduced in 2.3. I'm just asking that you preserve the default behavior that has existed since python 2.3- that was the purpose of my patch. I'm not tied to how I implemented it (I mean, it is kind of ugly) but I believe preserving the behavior is important, and I also believe that it will break less code than what is currently there (because, after all, socktype was only introduced in 2.7, the SysLogHandler doesn't care if it's None, and subclasses couldn't have relied on it in the AF_UNIX case because the original fallback didn't update it) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17795 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4934] tp_del and tp_version_tag undocumented
Alex Leach added the comment: I've just ran into tp_version_tag, when running the boost python testsuite and wondered what it was... Since upgrading to GCC 4.8, I've started to get a lot more warnings with Python extensions, e.g.:- boost/python/opaque_pointer_converter.hpp:122:14: warning: missing initializer for member ‘_typeobject::tp_version_tag’ [-Wmissing-field-initializers] In this instance the testsuite was made to compile with the '-Wextra' flag. The fix was pretty simple; add another zero to the opaque_pointer_convert struct. I have used the following preprocessor macro to test whether or not to do this. Would this be a good way to test for the addition? #if PY_VERSION_HEX = 0x0206 0,/* tp_version_tag */ #endif Cheers, Alex -- nosy: +Alex.Leach ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4934 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14805] Support display of both __cause__ and __context__
Philip Jenvey added the comment: and the code module (after #17442 is resolved) -- nosy: +pjenvey ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17656] Python 2.7.4 breaks ZipFile extraction of zip files with unicode member paths
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17785] Use faster URL shortener for perf.py
Roundup Robot added the comment: New changeset 1488e1f55f61 by Alexandre Vassalotti in branch 'default': Issue #17785: Use a faster URL shortener for perf.py http://hg.python.org/benchmarks/rev/1488e1f55f61 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17785 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17785] Use faster URL shortener for perf.py
Changes by Alexandre Vassalotti alexan...@peadrop.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17785 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17656] Python 2.7.4 breaks ZipFile extraction of zip files with unicode member paths
Christian Heimes added the comment: it seems like file() can't handle unicode file names on FreeBSD. The FS encoding is 'US-ASCII' on Snakebite's FreeBSD box. /home/cpython/users/christian.heimes/2.7/Lib/zipfile.py(1078)_extract_member() - with self.open(member, pwd=pwd) as source, \ (Pdb) self.open(member, pwd=pwd) zipfile.ZipExtFile object at 0x801eb5fd0 (Pdb) n /home/cpython/users/christian.heimes/2.7/Lib/zipfile.py(1079)_extract_member() - file(targetpath, wb) as target: (Pdb) file(targetpath, wb) *** UnicodeEncodeError: 'ascii' codec can't encode characters in position 47-48: ordinal not in range(128) (Pdb) sys.getfilesystemencoding() 'US-ASCII' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17720] pickle.py's load_appends should call append() on objects other than lists
Roundup Robot added the comment: New changeset 37139694aed0 by Alexandre Vassalotti in branch '3.3': Isuse #17720: Fix APPENDS handling in the Python implementation of Unpickler http://hg.python.org/cpython/rev/37139694aed0 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17720 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17720] pickle.py's load_appends should call append() on objects other than lists
Changes by Alexandre Vassalotti alexan...@peadrop.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17720 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
New submission from Antoine Pitrou: For certain applications, you want to unpack repeatedly the same pattern. This came in issue17618 (base85 decoding), where you want to unpack a stream of bytes as 32-bit big-endian unsigned ints. The solution adopted in issue17618 patch (struct.Struct(!{}I)) is clearly suboptimal. I would suggest something like a iter_unpack() function which would repeatedly yield tuples until the bytes object is over. -- components: Library (Lib) messages: 187455 nosy: mark.dickinson, meador.inge, pitrou, serhiy.storchaka priority: normal severity: normal status: open title: streaming struct unpacking type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17530] pprint could use line continuation for long bytes literals
Antoine Pitrou added the comment: Ok, I hadn't noticed that pretty-printing a single string didn't add the parentheses as desired: pprint.pprint(abcd * 6, width=15) 'abcd abcd ' 'abcd abcd ' 'abcd abcd ' On the other hand, the added parentheses aren't needed when inside a container (line continuations will work without them). (and of course the same rules should apply to bytes objects :-)) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17530 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Antoine Pitrou added the comment: (my initial intuition here was to use memoryview.cast() but it doesn't support non-native formats) -- nosy: +skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17787] Optimize pickling function dispatch in hot loops.
Alexandre Vassalotti added the comment: Are you asking why do we need to call both PyMemoTable_Get and memo_get? Or, why do we fetching the memo was moved to the save functions? For the former, there is no real reason. The extra call could be removed though profiling doesn't show this call as a hot spot. If the latter, we need this because the patch allow save(), which is where the memo was fetched, to be skipped. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17787 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17801] Tools/scripts/gprof2html.py: `#! /usr/bin/env python32.3`
Roundup Robot added the comment: New changeset 0c308d65d7bc by Ned Deily in branch '2.7': Issue #17801: fix shebang line of gprof2html.py http://hg.python.org/cpython/rev/0c308d65d7bc New changeset 354e4d096c34 by Ned Deily in branch '3.3': Issue #17801: fix shebang line of gprof2html.py http://hg.python.org/cpython/rev/354e4d096c34 New changeset 47f392d6547d by Ned Deily in branch 'default': Issue #17801: fix shebang line of gprof2html.py http://hg.python.org/cpython/rev/47f392d6547d -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17801 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17801] Tools/scripts/gprof2html.py: `#! /usr/bin/env python32.3`
Ned Deily added the comment: Thanks for the report! -- nosy: +ned.deily resolution: - fixed stage: - committed/rejected status: open - closed versions: -Python 2.6, Python 3.1, Python 3.2, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17801 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17656] Python 2.7.4 breaks ZipFile extraction of zip files with unicode member paths
Serhiy Storchaka added the comment: Here is a patch which skips test_extract_unicode_filenames if no Unicode filesystem semantics on this platform. -- Added file: http://bugs.python.org/file29952/test_extract_unicode_filenames_skip.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17646] traceback.py has a lot of code duplication
Martin Morrison added the comment: On 20 Apr 2013, at 18:55, Serhiy Storchaka rep...@bugs.python.org wrote: Serhiy Storchaka added the comment: Could print_exception() in Lib/idlelib/run.py reuse new traceback functions? Actually, cleaning up code like that in Idle and the code module and import.c was what I was aiming to solve when I stumbled upon the duplication in traceback.py - once this patch is in, I plan to raise a separate issue with my suggestion for that clean up. To answer your question directly, the changes I've made here don't solve the problem, no. More invasive changes are required, which is why I raised this cleanup portion of my change separately (on the assumption this change alone wouldn't be controversial, but my wider change might be). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17646 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17547] checking whether gcc supports ParseTuple __format__... erroneously returns yes with gcc 4.8
Ned Deily added the comment: Dave, any reason this shouldn't go into the imminent 2.7.5 and 3.3.2 releases? -- nosy: +ned.deily stage: patch review - commit review versions: +Python 2.7, Python 3.3, Python 3.4 -Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17547 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17795] backwards-incompatible change in SysLogHandler with unix domain sockets
Vinay Sajip added the comment: Does that mean that if I just change the default back to socktype=None, that will be good enough? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17795 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Antoine Pitrou added the comment: Here is a patch (still lacking docs). Comments welcome. -- keywords: +patch Added file: http://bugs.python.org/file29953/iter_unpack.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +isoschiz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17547] checking whether gcc supports ParseTuple __format__... erroneously returns yes with gcc 4.8
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +benjamin.peterson, georg.brandl, larry priority: normal - release blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17547 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17805] No such class: multiprocessing.pool.AsyncResult
New submission from Takafumi Arakaki: Document mentions AsyncResult but there is no such class. http://docs.python.org/2/library/multiprocessing.html#multiprocessing.pool.AsyncResult You can check it by simply running: python -c 'from multiprocessing.pool import AsyncResult' I think it means ApplyResult so I made a patch (attached). Note that there managers.py also uses name 'AsyncResult': % hg grep AsyncResult Doc/library/multiprocessing.rst:83232:.. class:: AsyncResult Lib/multiprocessing/managers.py:81039:'apply_async': 'AsyncResult', Lib/multiprocessing/managers.py:81039:'map_async': 'AsyncResult', Lib/multiprocessing/managers.py:81039:'starmap_async': 'AsyncResult', Lib/multiprocessing/managers.py:81039:SyncManager.register('AsyncResult', create_method=False) Probably renaming them would be better? -- assignee: docs@python components: Documentation files: ApplyResult.patch keywords: patch messages: 187466 nosy: docs@python, tkf priority: normal severity: normal status: open title: No such class: multiprocessing.pool.AsyncResult versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file29954/ApplyResult.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Serhiy Storchaka added the comment: Perhaps we need not iter_unpack(), but a grouper (some sort of)? def grouper(seq, size): for i in range(0, len(seq), size): yield seq[i: i + size] unpack = struct.Struct('!I').unpack for chunk in grouper(data, 4): word, = unpack(chunk) ... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Antoine Pitrou added the comment: Well, according to a quick benchmark, iter_unpack() is 3x to 6x faster than the grouper() + unpack() recipe. (it's also a bit more user-friendly) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Antoine Pitrou added the comment: For the record, here is the benchmark script. -- Added file: http://bugs.python.org/file29955/bench_unpack.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Martin Morrison added the comment: I like the idea of this. Two comments: - I'm no expert on the C API, but in s_iter_unpack do you not need to check for failure of PyType_GenericAlloc before calling PyObject_GetBuffer? - I'm not a fan of separate iter_ functions (and there seemed to be a general move away from them elsewhere in Python3; obviously here we have to maintain backwards compat though). Perhaps a boolean keyword asiter arg to the regular unpack() instead? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17805] No such class: multiprocessing.pool.AsyncResult
Changes by Ned Deily n...@acm.org: -- nosy: +sbt versions: -Python 2.6, Python 3.1, Python 3.2, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17805 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Martin Morrison added the comment: On 20 Apr 2013, at 23:01, Martin Morrison rep...@bugs.python.org wrote: - I'm not a fan of separate iter_ functions (and there seemed to be a general move away from them elsewhere in Python3; obviously here we have to maintain backwards compat though). Perhaps a boolean keyword asiter arg to the regular unpack() instead? Thinking about this more, the functionality is probably too radically different to overload the same function, so I withdraw the suggestion. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Antoine Pitrou added the comment: - I'm no expert on the C API, but in s_iter_unpack do you not need to check for failure of PyType_GenericAlloc before calling PyObject_GetBuffer? Yes, good catch. - I'm not a fan of separate iter_ functions (and there seemed to be a general move away from them elsewhere in Python3; obviously here we have to maintain backwards compat though). Perhaps a boolean keyword asiter arg to the regular unpack() instead? We generally consider it bad API design when a parameter changes the return *type* of the function. iter_unpack may not be terrific as a name but it describes the semantics quite clearly (and it's not too annoying to type). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17787] Optimize pickling function dispatch in hot loops.
Antoine Pitrou added the comment: Thanks for the explanation. I guess I don't like the code duplication that this patch adds. Perhaps a macro hiding the memo_get code blocks? Also, adding your explanation as a comment would be nice too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17787 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17804] streaming struct unpacking
Changes by Phil Connell pconn...@gmail.com: -- nosy: +pconnell ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17804 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17762] platform.linux_distribution() should honor /etc/os-release
Changes by Christian Heimes li...@cheimes.de: -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17762 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17656] Python 2.7.4 breaks ZipFile extraction of zip files with unicode member paths
STINNER Victor added the comment: I guess that test_extract_unicode_filenames_skip.patch will not fix the failing test. The test fails because u\xf6.txt cannot be encoded to sys.getfilesystemencoding() (which is ASCII on the FreeBSD buildbot). You should test u\xf6.txt. You should move the try/except inside the function. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17656 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16754] Incorrect shared library extension on linux
Changes by kent fuzzba...@comcast.net: -- nosy: +Thekent ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16754 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17795] backwards-incompatible change in SysLogHandler with unix domain sockets
Mike Lundy added the comment: On top of your patch? Yeah, I think so. (I wrote it the way I did so it could handle syslog configuration changes, but that's kind of an uncommon case). Thanks! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17795 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17742] Add _PyBytesWriter API
STINNER Victor added the comment: The patch contains a special case for writing only one bytes object. This is very unlikely case. The patch only modify a few functions to make them use the new _PyBytesWriter API. Other functions can use it. A few examples: - PyBytes_FromObject() - binascii: binascii_rledecode_hqx() - bz2, lzma and zlib modules - marshal and pickle modules - datetime.datetime.strftime() - Python/compile.c: assemble_lnotab() - more Unicode decoders But I agree that the readonly hack can be removed from _PyBytesWriter API since the bytes type has no format method (no bytes%args nor bytes.format(args)). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17618] base85 encoding
Serhiy Storchaka added the comment: There are some bugs in ascii85 end base85 implementations (see in Rietveld for details). Besides, ascii85 implementation was too slow. I've prepared a patch that corrects errors and speeds up encoding and decoding. Microbenchmarks: ./python -m timeit -r 1 -n 1 -s from base64 import a85encode as encode; data = open('python', 'rb').read(101) encode(data) ./python -m timeit -r 1 -n 1 -s from base64 import b85encode as encode; data = open('python', 'rb').read(101) encode(data) ./python -m timeit -r 1 -n 1 -s from base64 import a85encode as encode, a85decode as decode; data = encode(open('python', 'rb').read(101)) decode(data) ./python -m timeit -r 1 -n 1 -s from base64 import b85encode as encode, b85decode as decode; data = encode(open('python', 'rb').read(101)) decode(data) Old patch New patch a85encode 8.4 sec1.13 sec b85encode 1.35 sec 1.09 sec a85decode 9.28 sec 3.29 sec b85decode 3.17 sec 2.37 sec -- Added file: http://bugs.python.org/file29956/issue17618-fast.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17742] Add _PyBytesWriter API
R. David Murray added the comment: It may eventually get one, though. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17670] Improve str.expandtabs() doc
Ned Deily added the comment: Another round based on comments. I also just noticed that the current doc incorrectly claims that tabs are replaced by *zero* or more spaces. Return a copy of the string where all tab characters are replaced by one or more spaces, depending on the current column and the given tab size. Tab positions occur every *tabsize* characters (default is 8, giving tab positions at columns 0, 8, 16 and so on). To expand the string, the current column is set to zero and the string is examined character by character. If the character is a tab (``\t``), one or more space characters are inserted in the result until the current column is equal to the next tab position. (The tab character itself is not copied.) If the character is a newline (``\n``) or return (``\r``), it is copied and the current column is reset to zero. Any other character is copied unchanged and the current column is incremented by one regardless of how the character is represented when printed. '01\t012\t0123\t01234'.expandtabs() '01 012 012301234' '01\t012\t0123\t01234'.expandtabs(4) '01 012 012301234' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17670 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17742] Add _PyBytesWriter API
STINNER Victor added the comment: It may eventually get one, though. If a use case for the read-only hack comes, the hack can be added again later. It's better to start with something simple and extend it with new use cases. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17670] Improve str.expandtabs() doc
Changes by Ned Deily n...@acm.org: Added file: http://bugs.python.org/file29957/issue17670_doc_rev_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17670 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17806] Add keyword args support to str/bytes.expandtabs()
New submission from Ezio Melotti: The attached patch adds keyword args support to str/bytes.expandtabs(): 'a\tb'.expandtabs(tabsize=8) 'a b' b'a\tb'.expandtabs(tabsize=8) b'a b' -- assignee: ezio.melotti components: Interpreter Core files: expandtabs.diff keywords: patch messages: 187481 nosy: ezio.melotti priority: normal severity: normal stage: patch review status: open title: Add keyword args support to str/bytes.expandtabs() type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file29958/expandtabs.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17806 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17807] Generator cleanup without tp_del
New submission from Antoine Pitrou: This experimental patch proposes to defer generator cleanup to the frame itself. In this scheme, the generator frame's tp_clear throws the GeneratorExit if necessary, so as to call cleanup code. The generator doesn't have any tp_del anymore, as it is now impossible to resurrect a generator (the frame, though, can be resurrected; I have to add a test for that). The net effect is that generators caught in a reference cycle can always be reclaimed, and their cleanup code is run in a valid frame. -- components: Interpreter Core files: gen2.patch keywords: patch messages: 187482 nosy: benjamin.peterson, ncoghlan, pitrou priority: normal severity: normal stage: patch review status: open title: Generator cleanup without tp_del type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file29959/gen2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17807 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17468] Generator memory leak
Antoine Pitrou added the comment: I've opened issue17807 for an alternative generator cleanup scheme which solves the present issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17468 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17807] Generator cleanup without tp_del
Changes by Antoine Pitrou pit...@free.fr: Removed file: http://bugs.python.org/file29959/gen2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17807 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com