[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread STINNER Victor
STINNER Victor added the comment: Python 3.4 is able to break reference cycles even if an object part of the cycle has a destructor. See the PEP 442. -- ___ Python tracker ___ __

[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 jus

[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 _

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

2015-07-09 Thread Raymond Hettinger
Changes by Raymond Hettinger : Added file: http://bugs.python.org/file39890/intermediary.diff ___ Python tracker ___ ___ Python-bugs-list mail

[issue24602] SRE_SEARCH Integer Underflow

2015-07-09 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka nosy: +pitrou, serhiy.storchaka stage: -> patch review ___ Python tracker ___ ___

[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 ___

[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 ___

[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 (patter

[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 b

[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 0..12

[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 do

[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 prop

[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 request

[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 i

[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.

[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: b

[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 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 Mar

[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 ___ ___ Python-bugs-list mailing list Unsubs

[issue24597] forbid redefinition of specializations in singledispatch

2015-07-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 09/07/2015 20:30, Ethan Furman a écrit : > > That doesn't feel like a consenting-adults attitude, and could also make testing harder. Testing of what? The point is that it's the authority providing the generic function which decides how lenient extending the

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

2015-07-09 Thread R. David Murray
R. David Murray added the comment: This is a duplicate of issue 9232, which has a patch. The question is getting agreement to apply it...it sounds like your service in this regard could be bringing it up on python-ideas; please read that issue through and see if you agree. -- nosy: +

[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 trac

[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

[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 ___ ___ Python-bugs-list mailing list Unsubscr

[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 ___ _

[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

[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 compatib

[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 ___

[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

[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

[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 doesn't

[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 b

[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 "h

[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 ___

[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

[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 ___ __

[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 s

[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

[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 ___ _

[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 ___ __

[issue24598] asyncio: add background task detecting reference cycles

2015-07-09 Thread Martin Panter
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[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

[issue15014] smtplib: add support for arbitrary auth methods

2015-07-09 Thread Barry A. Warsaw
Changes by Barry A. Warsaw : -- assignee: -> barry status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[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 __

[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 #15014:

[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 3r

[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 trac

[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 tra

[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 hand

[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 ___ ___ Python-bugs-list mailin

[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 excepti

[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

[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 beg

[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 g

[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 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 o

[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

[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

[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 excep

[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 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

[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 SSLContext.lo

[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 s

[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 wha

[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 tracker

[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

[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

[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 siz

[issue24594] msilib.OpenDatabase Type Confusion

2015-07-09 Thread Mark Lawrence
Changes by Mark Lawrence : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker ___ ___ Py