[issue26361] lambda in dict comprehension is broken

2016-02-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is the standard behaviour of closures in Python. It's annoying, and often not what you expect, but it's not a bug. Effectively, your dict or list contains five functions, each of which refer to the same variable "t". By the time the loop finishes, that

[issue26361] lambda in dict comprehension is broken

2016-02-14 Thread Eryk Sun
Eryk Sun added the comment: For Python 3 you can also make it a keyword-only argument by adding a bare '*' to the parameter list: funcs = [(lambda x, *, t=t: x * t) for t in range(5)] Code that accidentally calls funcs[0](3, 'silent bug ') will raise a TypeError because "t" can only be

[issue26362] Approved API for creating a temporary file path

2016-02-14 Thread Ben Finney
New submission from Ben Finney: The security issues of `tempfile.mktemp` are clear when the return value is used to create a filesystem entry. The documentation and docstrings (and even some comments on past issues) are correct o deprecate its use for that purpose. The function has a use

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-14 Thread Mathieu Dupuy
Mathieu Dupuy added the comment: I don't know. The taken code is really little, modified, and is nothing much that an implementation you had seen a while ago, and recoded by memory not remembering where you saw it in the first place. Do you think that's really an issue ? --

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-14 Thread karl
karl added the comment: >From https://www.djangoproject.com/foundation/cla/faq/ > Am I giving away the copyright to my contributions? > > No. This is a pure license agreement, not a copyright assignment. You > still maintain the full copyright for your contributions. You are > only providing

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-14 Thread karl
karl added the comment: About > Actually, I realized that the best implementation of parsing rfc 3339 > is in django dateparse utils. To me it's the finest, the most > elegant, and no other one can claim to be more robust since it's > probably the #1 iso parsing functions used in python.

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-14 Thread Mathieu Dupuy
Mathieu Dupuy added the comment: discarding the microseconds digits after the 6th. 2016-02-15 13:30 GMT+10:30 karl : > > karl added the comment: > > About > > > Actually, I realized that the best implementation of parsing rfc 3339 > > is in django dateparse utils. To me

[issue26362] Approved API for creating a temporary file path

2016-02-14 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker ___ ___

[issue26268] Update python.org installers to use OpenSSL 1.0.2f

2016-02-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1ceb431e1876 by Ned Deily in branch '2.7': Issue #26268: Update OS X 10.5+ installer build to use OpenSSL 1.0.2f. https://hg.python.org/cpython/rev/1ceb431e1876 New changeset 3c3eae72dd04 by Ned Deily in branch '3.5': Issue #26268: Update OS X

[issue25924] investigate if getaddrinfo(3) on OSX is thread-safe

2016-02-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 58ebfa7c1361 by Ned Deily in branch '2.7': Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on OS X https://hg.python.org/cpython/rev/58ebfa7c1361 New changeset 86ddb4d747f8 by Ned Deily in branch '3.5': Issue #25924: Avoid

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-14 Thread Mathieu Dupuy
Mathieu Dupuy added the comment: slightly improved + addresses issues stated here : https://bugs.python.org/review/15873/diff/16581/Lib/datetime.py#newcode1418Lib/datetime.py:1418 -- Added file: http://bugs.python.org/file41926/fromisoformat3.patch

[issue25924] investigate if getaddrinfo(3) on OSX is thread-safe

2016-02-14 Thread Ned Deily
Ned Deily added the comment: I've committed a revised version of the "try 2" patch for release in 2.7.12, 3.5.2, and 3.6.0. The revisions were to better follow the somewhat arcane conventions of Apple's availability macros, in particular, to take into account the value of

[issue26249] Change PyMem_Malloc to use PyObject_Malloc allocator?

2016-02-14 Thread Alecsandru Patrascu
Changes by Alecsandru Patrascu : -- nosy: +alecsandru.patrascu ___ Python tracker ___

[issue26361] lambda in dict comprehension is broken

2016-02-14 Thread Samuel Ainsworth
Samuel Ainsworth added the comment: Also applies to list comprehensions. For example, lst = [(lambda x: x * t) for t in range(5)] lst[0](1) # => 4 -- ___ Python tracker

[issue19841] ConfigParser PEP issues

2016-02-14 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the patch, Ivailo. The following changes are going to break the public API: -def get(self, section, option, raw=False, vars=None): +def get(self, section, option, raw=False, vvars=None): -def items(self, section, raw=False,

[issue26361] lambda in dict comprehension is broken

2016-02-14 Thread Samuel Ainsworth
New submission from Samuel Ainsworth: If we construct a dict as follows, x = {t: lambda x: x * t for t in range(5)} then `x[0](1)` evaluates to 4! Tested on 2.7 and 3.5. -- messages: 260287 nosy: Samuel.Ainsworth priority: normal severity: normal status: open title: lambda in dict

[issue26215] Make GC_Head a compile-time option

2016-02-14 Thread yuriy_levchenko
yuriy_levchenko added the comment: I'm going to do this under define, as an option. In my application it consumes several mBs + it's some performance for handling this structure. -- ___ Python tracker

[issue12806] argparse: Hybrid help text formatter

2016-02-14 Thread Mark Lawrence
Changes by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___

[issue26360] Deadlock in thread.join

2016-02-14 Thread Mark Dickinson
Mark Dickinson added the comment: Update: I *have* been able to reproduce in a debug build. Here's the stack trace. -- Added file: http://bugs.python.org/file41924/debug-build-stacktrace.txt ___ Python tracker

[issue26360] Deadlock in thread.join

2016-02-14 Thread Mark Dickinson
Mark Dickinson added the comment: One thing that looks a bit odd to my eyes is the different values for `lock` in the PyThread_acquire_lock calls (see below). All of threads 2-5 should be waiting on the GIL, so I'd expect to see the same value for `lock` in all those calls. Instead, threads 2

[issue26360] Deadlock in thread.join

2016-02-14 Thread Mark Dickinson
Mark Dickinson added the comment: > threads 2 and 5 Sorry, that should have said "threads 2 and 4". -- ___ Python tracker ___

[issue26360] Deadlock in thread.join

2016-02-14 Thread Mark Dickinson
Mark Dickinson added the comment: > lock=0x0 looks suspicious. Agreed. I think that *could* possibly be a consequence of the earlier multiple GILs, though I haven't figured out exactly how yet. -- ___ Python tracker

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-14 Thread STINNER Victor
STINNER Victor added the comment: Is the django license compatible with the Python license? -- ___ Python tracker ___

[issue26360] Deadlock in thread.join

2016-02-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: lock=0x0 looks suspicious. -- ___ Python tracker ___ ___ Python-bugs-list

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-14 Thread Mathieu Dupuy
Mathieu Dupuy added the comment: (slightly improved version, better use of timedelta) -- Added file: http://bugs.python.org/file41923/fromisoformat2.patch ___ Python tracker

[issue8706] accept keyword arguments on most base type methods and builtins

2016-02-14 Thread Nicholas Chammas
Changes by Nicholas Chammas : -- nosy: +Nicholas Chammas ___ Python tracker ___

[issue25351] pyvenv activate script failure with specific bash option

2016-02-14 Thread Vinay Sajip
Vinay Sajip added the comment: Can you try the attached script in place of the current activate script and see if it meets the requirements? -- Added file: http://bugs.python.org/file41925/activate ___ Python tracker

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-14 Thread Mathieu Dupuy
Mathieu Dupuy added the comment: Here is the PoC with code taken from django.utils.parse_datetime and adapted for the datetime module (I didn't ask for their agreement yet). Of course tests pass. For me it's the most elegant solution. (I think date and time also need their "fromisotimestamp"

[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2016-02-14 Thread Alecsandru Patrascu
Changes by Alecsandru Patrascu : -- resolution: fixed -> status: closed -> open ___ Python tracker ___

[issue26307] no PGO for built-in modules with `make profile-opt`

2016-02-14 Thread Alecsandru Patrascu
Alecsandru Patrascu added the comment: I've added a fix for the PGO builds after the issue pointed out by you. Can you please test it also? -- ___ Python tracker

[issue26360] Deadlock in thread.join

2016-02-14 Thread Mark Dickinson
Mark Dickinson added the comment: Here's the hanging code as an attached file. -- Added file: http://bugs.python.org/file41921/threading_hang.py ___ Python tracker

[issue26360] Deadlock in thread.join

2016-02-14 Thread Mark Dickinson
New submission from Mark Dickinson: On OS X (10.9.5), I'm getting an apparent deadlock in the following simple Python script: # import itertools import threading def is_prime(n): return n >= 2 and all(n % d for d in xrange(2, n))

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-14 Thread Mathieu Dupuy
Mathieu Dupuy added the comment: #12006 will unfortunately of no use for this one. Actually, I realized that the best implementation of parsing rfc 3339 is in django dateparse utils. To me it's the finest, the most elegant, and no other one can claim to be more robust since it's probably the

[issue24165] Free list for single-digits ints

2016-02-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > 99% of all long allocations are coming from freelist when it's there. Detailed statistics from a test suite run see in msg242886. Only a half of ints are single-digit with 15-bit digits, and 3/4 with 30-bit digits. 86% of ints are 32-bit. The majority of

[issue24165] Free list for single-digits ints

2016-02-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: The test suite can't really be representative of common workloads and it isn't meant to be. The real question is not so much if the freelist helps reduce the number of integer allocations (it's obvious it will), it's whether doing so actually speeds up

[issue26359] CPython build options for out-of-the box performance

2016-02-14 Thread Alecsandru Patrascu
New submission from Alecsandru Patrascu: Hello, This is Alecsandru from the Dynamic Scripting Languages Optimization Team at Intel Corporation. I would like to submit a patch as a response to the discussion thread opened in Python-Dev

[issue26359] CPython build options for out-of-the box performance

2016-02-14 Thread Alecsandru Patrascu
Changes by Alecsandru Patrascu : Added file: http://bugs.python.org/file41919/cpython3_pgo_default-v02.patch ___ Python tracker

[issue26360] Deadlock in thread.join

2016-02-14 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +pitrou, serhiy.storchaka ___ Python tracker ___

[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2016-02-14 Thread Alecsandru Patrascu
Changes by Alecsandru Patrascu : Added file: http://bugs.python.org/file41917/pgofix-cpython3.patch ___ Python tracker ___

[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2016-02-14 Thread Alecsandru Patrascu
Alecsandru Patrascu added the comment: I've added a fix for the PGO builds after a issue pointed out in #26307. Thank you Christos for your observation! -- Added file: http://bugs.python.org/file41916/pgofix-cpython2.patch ___ Python tracker

[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-14 Thread Martin Panter
Martin Panter added the comment: Nicholas, there is Issue 8706 about converting functions and methods to accept keywords in general. There is also the slash “/” indicator proposed by PEP 457, which is used for some functions in pydoc; bytes.replace() for instance. In Issue 23738 I was trying

[issue26360] Deadlock in thread.join

2016-02-14 Thread Mark Dickinson
Mark Dickinson added the comment: Build details: this was a version of Python built with a simple `./configure && make` from commit 32893d8a52a9. taniyama:cpython mdickinson$ ./python.exe Python 2.7.10+ (2.7:32893d8a52a9, Feb 14 2016, 11:08:14) [GCC 4.2.1 Compatible Apple LLVM 6.0