[issue24596] Script globals in a GC cycle not finalized when exiting with SystemExit

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: It's likely that your global variable gets caught in the traceback attached to the SystemExit, and that either never gets deallocated, or gets deallocated too late. -- nosy: +pitrou ___ Python tracker

[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread STINNER Victor
New submission from STINNER Victor: When storing an exception in an asyncio Future object, there is a high risk of creating a reference cycle. In Python 3, exception objects store a traceback object which store frame objects. The problem is that a frame can also have a reference to the

[issue15014] smtplib: add support for arbitrary auth methods

2015-07-09 Thread Barry A. Warsaw
Changes by Barry A. Warsaw ba...@python.org: -- assignee: - barry status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15014 ___

[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread Guido van Rossum
Guido van Rossum added the comment: Doesn't the cycle-detecting GC handle these? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24598 ___ ___

[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread Martin Panter
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24598 ___ ___ Python-bugs-list

[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread STINNER Victor
STINNER Victor added the comment: Hm. If the problem is most prominent with 3.3, why mark the issue as 3.6? Well, I plan to implement this feature in asyncio, so for 3.3-3.6 in fact. Do you have an implementation already? Nope, it's more a TODO task for myself :-) Maybe it can be a 3rd

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Ethan Furman
Ethan Furman added the comment: Is it too late to have the default for that option be to not allow the replacement? That would be the safer course. -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24597

[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread Guido van Rossum
Guido van Rossum added the comment: OK, no problem. (Side comment: Future is being subclassed a lot, so parametrizing its construction may not be so easy.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24598

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't know. I'm assuming some people actually want to redefine existing specializations. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24597 ___

[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread STINNER Victor
STINNER Victor added the comment: Doesn't the cycle-detecting GC handle these? Maybe you are lucky and the GC is able to break the cycle. Maybe you are unlucky and all objects part of the cycle will never be deleted. Python 3.4 is better to handle these cases, but Python 3.3 is worse to

[issue24596] Script globals in a GC cycle not finalized when exiting with SystemExit

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Actually, the problem is in PyRun_SimpleFileExFlags(). The executed module is decref'ed after calling PyErr_Print(), but the latter never returns when the exception is a SystemExit. -- nosy: +ncoghlan ___ Python

[issue15014] smtplib: add support for arbitrary auth methods

2015-07-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 97a29b86a2dc by Barry Warsaw in branch '3.5': - Issue #15014: SMTP.auth() and SMTP.login() now support RFC 4954's optional https://hg.python.org/cpython/rev/97a29b86a2dc New changeset 2d9003d44694 by Barry Warsaw in branch 'default': - Issue

[issue23319] Missing SWAP_INT in I_set_sw

2015-07-09 Thread Meador Inge
Meador Inge added the comment: I will review this today. -- assignee: - meador.inge stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23319 ___

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Ethan Furman
Ethan Furman added the comment: Sure. I just saying that @f.register(int, replace=True) requires opt-in to replacing, whilst @f.register(int, replace=False) # don't replace if one already exists is still prone to bugs. -- ___ Python tracker

[issue24595] InteractiveInterpreter always prints to stdout

2015-07-09 Thread R. David Murray
R. David Murray added the comment: Does it not work to create an unbuffered makefile object from the socket and assign that to stdout? Regardless, if you need to set it and restore it around runcode you can use super() to call the base class method. I think providing an easier API to change

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread R. David Murray
R. David Murray added the comment: Yes it is too late. You'd have to do a couple of deprecation cycles to change the default. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24597

[issue24599] urllib URLopener().open https url returns 501 Not Implemented when https_proxy env var is http://

2015-07-09 Thread Stefano Mazzucco
Stefano Mazzucco added the comment: I have run the minimal example provided on both Python2 and Python3 with the same results. Sorry if that was not clear. I did look at issue 1424152 but it seemed to me that I was experiencing a different problem. When I try and open the page, I get a squid

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ah, but I wasn't suggesting to add an argument to the .register() call, but to the singledispatch() call; i.e. it would be a function-wide parameter. -- ___ Python tracker rep...@bugs.python.org

[issue24599] urllib URLopener().open https url returns 501 Not Implemented when https_proxy env var is http://

2015-07-09 Thread Stefano Mazzucco
New submission from Stefano Mazzucco: Hello, at work, I am behind a proxy (squid) that is only available over http. So, I have to configure both the http_proxy and https_proxy environment variables to be something like http://proxy.corp.com:8181; Now, when I try and use urllib to open an

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Ethan Furman
Ethan Furman added the comment: Ah, I see. So you say up-front if you are willing to have redefinition occur later. That doesn't feel like a consenting-adults attitude, and could also make testing harder. I prefer adding an option to the register method, and move towards making the default

[issue24583] set.update(): Crash when source set is changed during merging

2015-07-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Perhaps the incref/decref pair ought to be moved into PyObject_RichCompareBool(). This wouldn't help because key can be used after PyObject_RichCompareBool(). -- ___ Python tracker rep...@bugs.python.org

[issue24599] urllib URLopener().open https url returns 501 Not Implemented when https_proxy env var is http://

2015-07-09 Thread R. David Murray
R. David Murray added the comment: It is not clear from your description if you actually tested it with python3. In python2, I believe urllib does not support this (see issue 1424152) while urllib2 does. Assuming you have, I wonder if the not implemented error is your squid saying it

[issue24571] [RFE] Add asyncio.background_call API

2015-07-09 Thread Sven R. Kunze
Sven R. Kunze added the comment: ... this sounds like it is encouraging staying ignorant. True. However, I being ignorant about the complexity eventually led to the development of high-level languages like Python. Each time, a next generation simply asks the question: 'does it really need to

[issue23601] use small object allocator for dict key storage

2015-07-09 Thread Stefan Behnel
Stefan Behnel added the comment: It's generally worth running the benchmark suite for this kind of optimisation. Being mostly Python code, it should benefit quite clearly from dictionary improvements, but it should also give an idea of how much of an improvement actual Python code (and not

[issue24601] bytes and unicode splitlines() methods differ on what is a line break

2015-07-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Jul 10, 2015 at 02:18:33AM +, Gregory P. Smith wrote: for bytes, \v (0x0b) is not considered a line break. for unicode, it is. [...] I think these should be consistent. I'm not sure that they should. Unicode includes other line breaks which

[issue24602] SRE_SEARCH Integer Underflow

2015-07-09 Thread JohnLeitch
JohnLeitch added the comment: Attaching repro. -- Added file: http://bugs.python.org/file39889/SRE_SEARCH_Integer_Underflow.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24602 ___

[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread Joshua Harlow
Joshua Harlow added the comment: Out of curiosity what reference cycles can't be broken in various python versions? Is it documented/explained anywhere? -- nosy: +Joshua.Harlow ___ Python tracker rep...@bugs.python.org

[issue24602] SRE_SEARCH Integer Underflow

2015-07-09 Thread JohnLeitch
JohnLeitch added the comment: Attaching proposed patch for unit tests to cover this issue. -- Added file: http://bugs.python.org/file39888/test_re.py.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24602

[issue24601] bytes and unicode splitlines() methods differ on what is a line break

2015-07-09 Thread Gregory P. Smith
New submission from Gregory P. Smith: for bytes, \v (0x0b) is not considered a line break. for unicode, it is. this traces back to the Objects/stringlib/ code where unicode defers to the decision made by Objects/unicodeobject.c's ascii_linebreak table which contains 7 line breaks in the

[issue24602] SRE_SEARCH Integer Underflow

2015-07-09 Thread JohnLeitch
New submission from JohnLeitch: The Python 2.7 regular expression module suffers from an integer underflow in the SRE_SEARCH function of _sre.c, which leads to a buffer over-read condition. The issue is caused by unchecked subtraction performed while handling SR_OP_INFO blocks: if

[issue24602] SRE_SEARCH Integer Underflow

2015-07-09 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka nosy: +pitrou, serhiy.storchaka stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24602

[issue24583] set.update(): Crash when source set is changed during merging

2015-07-09 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: Added file: http://bugs.python.org/file39890/intermediary.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24583 ___

[issue24567] random.choice IndexError due to double-rounding

2015-07-09 Thread Stefan Krah
Stefan Krah added the comment: Qt had a similar initiative regarding -msse2 -mfpmath: http://lists.qt-project.org/pipermail/development/2013-December/014530.html They say that also Visual Studio 2012 has switched to sse2 by default. The only problem are the Linux distributions that are stuck

[issue23441] rlcompleter: tab on empty prefix = insert spaces

2015-07-09 Thread David Beazley
David Beazley added the comment: Wanted to add: I see this as being about the same as having a broken window pane on the front of Python 3. Maybe there are awesome things inside, but it makes a bad first impression on anyone who dares to use the interactive console. --

[issue24166] ArgumentParser behavior does not match generated help

2015-07-09 Thread Benjamin Schubert
Benjamin Schubert added the comment: Ok, sorry for the delay. I see your point and understand the difficulty of having done right. Should I close the issue, or propose something else ? Thanks -- ___ Python tracker rep...@bugs.python.org

[issue24136] document PEP 448: unpacking generalization

2015-07-09 Thread Neil Girdhar
Neil Girdhar added the comment: Copied from closed issue 24240: Since Grammar/Grammar relies on semantic postprocessing in ast.c, it would be nice to have an update of the (human readable) Grammar in the language reference docs. -- ___ Python

[issue24594] msilib.OpenDatabase Type Confusion

2015-07-09 Thread Mark Lawrence
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24594 ___

[issue24571] [RFE] Add asyncio.background_call API

2015-07-09 Thread Nick Coghlan
Nick Coghlan added the comment: The problems with using concurrent.futures directly for running synchronous tasks in the background are: 1. You have to manage the lifecycle of the executor yourself, rather than letting asyncio do it for you 2. There's no easy process wide way to modify the

[issue24571] [RFE] Add asyncio.background_call API

2015-07-09 Thread Guido van Rossum
Guido van Rossum added the comment: 1. You have to manage the lifecycle of the executor yourself, rather than letting asyncio do it for you 2. There's no easy process wide way to modify the size of the background task thread pool (or switch to using processes instead) But if that's what

[issue23441] rlcompleter: tab on empty prefix = insert spaces

2015-07-09 Thread David Beazley
David Beazley added the comment: Frivolity aside, I really wish this issue would get more traction and a fix. Indentation is an important part of the Python language (obviously). A pretty standard way to indent is to hit tab in whatever environment you're using to edit Python code. Yet, at

[issue24595] InteractiveInterpreter always prints to stdout

2015-07-09 Thread Anton Astafiev
New submission from Anton Astafiev: I have a use-case when I need to forward InteractiveConsole through Unix/TCP socket. Expected implementation: class InteractiveSocket(InteractiveConsole): def __init__(self, socket): self._socket = socket ... def raw_input(...): # read from

[issue24571] [RFE] Add asyncio.background_call API

2015-07-09 Thread Nick Coghlan
Nick Coghlan added the comment: I'll at least write a new python-ideas post, as I realised my original idea *is* wrong (and you're right not to like it). The focus needs to be on Sven's original question (How do you kick off a coroutine from otherwise synchronous code, and then later wait for

[issue16487] Allow ssl certificates to be specified from memory rather than files.

2015-07-09 Thread Martin Richard
Martin Richard added the comment: Hi, I would like to update this patch so it can finally land in cpython, hopefully 3.6. tl;dr of the thread: In a nutshell, the latest patch from Kristján Valur Jónsson updates SSLContext.load_cert_chain(certfile, keyfile=None, password=None) and

[issue16487] Allow ssl certificates to be specified from memory rather than files.

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: I thing adding keydata and certdata makes things more complicated, on the contrary. You start having an API with many optional arguments but some of them are exclusive with each other (because you can only specify a single key and cert chain). The cafile,

[issue24596] Script globals in a GC cycle not finalized when exiting with SystemExit

2015-07-09 Thread Petr Viktorin
New submission from Petr Viktorin: When this program is invoked as a script (`python reproducer.py`), the __del__ is never called: --- class ClassWithDel: def __del__(self): print('__del__ called') a = ClassWithDel() a.link = a raise SystemExit(0) --- Raising a different

[issue16487] Allow ssl certificates to be specified from memory rather than files.

2015-07-09 Thread Martin Richard
Martin Richard added the comment: You are right. And if certfile and keyfile (args of load_cert_chain()) accept file-like objects, we agree that cafile (load_verify_location()) should accept them too? -- ___ Python tracker rep...@bugs.python.org

[issue16487] Allow ssl certificates to be specified from memory rather than files.

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 09/07/2015 15:40, Martin Richard a écrit : And if certfile and keyfile (args of load_cert_chain()) accept file-like objects, we agree that cafile (load_verify_location()) should accept them too? It could, but that's a separate issue. Let's stay focused on

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Antoine Pitrou
New submission from Antoine Pitrou: singledispatch currently doesn't defend against unwanted redefinition of an existing specialization, e.g.: def f(x): return default ... f = functools.singledispatch(f) @f.register(int) ... def _(x): return 1 ... @f.register(int) ... def _(x): return 2

[issue16487] Allow ssl certificates to be specified from memory rather than files.

2015-07-09 Thread STINNER Victor
STINNER Victor added the comment: Sorry, I didn't take time to read the whole discussion. For me, it's a good idea to accept a filename or a file object in the same parameter. Having two exclusive parameters for the same thing (ex: CA) doesn't smell like a great API. --

[issue16487] Allow ssl certificates to be specified from memory rather than files.

2015-07-09 Thread Christian Heimes
Christian Heimes added the comment: I'd rather introduce new types and have the function accept either a string (for path to fiel) or a X509 object and a PKey object. It's more flexible and secure. With a private key type we can properly support crypto ENGINEs and wipe memory when the object

[issue24571] [RFE] Add asyncio.background_call API

2015-07-09 Thread Guido van Rossum
Guido van Rossum added the comment: Yeah, we should strongly consider writing more documentation before adding more convenience APIs. Esp. tutorial-style docs, which neither Victor nor I can supply because we've already moved beyond wizard level ourselves so it's hard for us to imagine the

[issue23601] use small object allocator for dict key storage

2015-07-09 Thread Julian Taylor
Julian Taylor added the comment: Large objects are just if size 512: return malloc(size) there is no reason it should be slower. Also for large objects allocation speed does not matter as much. -- ___ Python tracker rep...@bugs.python.org

[issue23601] use small object allocator for dict key storage

2015-07-09 Thread Mark Shannon
Mark Shannon added the comment: I still think that this is a good idea, but I would like to see a small speed test for large objects. Just to be sure that it is no slower. -- ___ Python tracker rep...@bugs.python.org

[issue24571] [RFE] Add asyncio.background_call API

2015-07-09 Thread Guido van Rossum
Guido van Rossum added the comment: Please move the philosophical discussion to python-ideas. Regarding the phrasing about the two Future classes being almost compatible, that is unfortunate wording. Two things can have a similar API (merely having the same methods etc.) without being

[issue21148] avoid needless pointers initialization in small tuple creation

2015-07-09 Thread Julian Taylor
Julian Taylor added the comment: right at best its probably too insignificant to really be worthwhile, closing. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21148

[issue24600] function(**dict) does not accept comma after dict (inside parenthese)

2015-07-09 Thread Grégory Starck
New submission from Grégory Starck: Consider following: Python 3.4.0 (default, Jun 19 2015, 14:20:21) [GCC 4.8.2] on linux def f(**kw): pass f(a=1 , ) # ok f(**{'a': 1} ) # ok # but : f(**{'a': 1} , ) SyntaxError: invalid syntax shouldn't the last form be also allowed as is the

[issue23530] os and multiprocessing.cpu_count do not respect cpuset/affinity

2015-07-09 Thread Julian Taylor
Julian Taylor added the comment: any comments on the doc changes? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23530 ___ ___ Python-bugs-list

[issue23601] use small object allocator for dict key storage

2015-07-09 Thread Mark Shannon
Mark Shannon added the comment: Indeed there is no *obvious* reason why they should be slower. But when it comes to optimisation, *never* trust your (or anyone else's) intuition. Running a simple check is always worth the effort. -- ___ Python

[issue24567] random.choice IndexError due to double-rounding

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: I suppose the simplest fix would be to replace relevant instances of int(random() * N) with min(int(random() * N), N-1) That sounds simple and generic. It skews the distribution a tiny little bit, but it doesn't sound significant (perhaps Mark would

[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread Guido van Rossum
Guido van Rossum added the comment: Hm. If the problem is most prominent with 3.3, why mark the issue as 3.6? Do you have an implementation already? Maybe it can be a 3rd party package rather than integrated in asyncio debug mode? -- ___ Python

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Eric Snow
Eric Snow added the comment: I agree with Antoine. -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24597 ___ ___

[issue24567] random.choice IndexError due to double-rounding

2015-07-09 Thread Tim Peters
Tim Peters added the comment: It skews the distribution a tiny little bit, ... But it doesn't - that's the point ;-) If double-rounding doesn't occur at all (which appears to be the case on most platforms), absolutely nothing changes (because min(int(random() * N), N-1) == int(random() * N)

[issue24567] random.choice IndexError due to double-rounding

2015-07-09 Thread STINNER Victor
STINNER Victor added the comment: Again, why not using only integers? Pseudo-code to only use integers: def randint(a, b): num = b - a if not num: return a nbits = (num + 1).bit_length() while True: x = random.getrandbits(nbits) if x = num:

[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails

2015-07-09 Thread Martin Panter
Martin Panter added the comment: In the meantime, Issue 24599 has been opened about URLopener(), which I understand is related to the Python 2 “urllib” half of this bug. Since this issue has been closed, perhaps it is best to continue discussion of issue1424152-py27-urllib.diff there instead.

[issue24599] urllib URLopener().open https url returns 501 Not Implemented when https_proxy env var is http://

2015-07-09 Thread Martin Panter
Martin Panter added the comment: David: the original patch made in Issue 1424152 fixed Python 2’s urllib.request.urlopen() and Python 2’s urllib2.urlopen(). But Stefano is using URLopener, which I understand comes from Python 2’s older “urllib” module. When I run the demonstration, the

[issue24567] random.choice IndexError due to double-rounding

2015-07-09 Thread Tim Peters
Tim Peters added the comment: Victor, if people want to use getrandbits(), we should backport the Python3 code, not reinvent it from scratch. Note too Mark's comment: There are several places in the source where something of the form `int(i * random.random())` is used. The `min()` trick is

[issue24567] random.choice IndexError due to double-rounding

2015-07-09 Thread STINNER Victor
STINNER Victor added the comment: Victor, if people want to use getrandbits(), we should backport the Python3 code, not reinvent it from scratch. Sorry, I don't understand your comment. Backport what? getrandbits() is available on Python 2 and Python 3, for Random and SystemRandom. I

[issue24567] random.choice IndexError due to double-rounding

2015-07-09 Thread Tim Peters
Tim Peters added the comment: Victor, don't ask me, look at the code: the random.choice() implementations in Python 2 and Python 3 have approximately nothing in common, and the bug here should already be impossible in Python 3 (but I can't check that, because I don't have a platform that