[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Nevada Sanchez
Nevada Sanchez added the comment: The existing regular expressions weren't actually strict enough as is, so I made them even more correct. In particular, we must have at least one digit following `0[xXbBoO]` and must be before any underscores. I have a small set of test cases to examine

[issue29878] Add global instances of int 0 and 1

2017-03-22 Thread STINNER Victor
STINNER Victor added the comment: +1. Please create a PR for it. -- ___ Python tracker ___ ___

[issue29878] Add global instances of int 0 and 1

2017-03-22 Thread Mark Dickinson
Mark Dickinson added the comment: I like it. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue29879] typing.Text not available in python 3.5.1

2017-03-22 Thread Charles Bouchard-Légaré
Charles Bouchard-Légaré added the comment: I mean, what is not documented is 'New in 3.5.2' -- ___ Python tracker ___

[issue29816] Get rid of C limitation for shift count in right shift

2017-03-22 Thread Mark Dickinson
Mark Dickinson added the comment: I much prefer the `divrem1`-based version: it makes fewer assumptions about relative sizes of long / long long / size_t and about the number of bits per digit. I'd rather not have another place that would have to be carefully examined in the future if the

[issue29879] typing.Text not available in python 3.5.1

2017-03-22 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: I'm guessing you might of missed it, `Text` is documented in the docs for Python 3.5 https://docs.python.org/3.5/library/typing.html#typing.Text :-) -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker

[issue29879] typing.Text not available in python 3.5.1

2017-03-22 Thread Charles Bouchard-Légaré
New submission from Charles Bouchard-Légaré: The real issue here is that this is not documented in Doc/library/typing.rst. -- assignee: docs@python components: Documentation messages: 289985 nosy: Charles Bouchard-Légaré, docs@python priority: normal severity: normal status: open title:

[issue29879] typing.Text not available in python 3.5.1

2017-03-22 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: Ah I see now, yes, neither are Reversible, Type, NewType, TYPE_CHECKING and DefaultDict. Why don't you go ahead an submit a PR for this? :-) -- ___ Python tracker

[issue29847] Path takes and ignores **kwargs

2017-03-22 Thread Brett Cannon
Brett Cannon added the comment: Then I vote for Serhiy's idea of simply raising an exception in the concrete subclasses when a keyword argument is given. -- ___ Python tracker

[issue29879] typing.Text not available in python 3.5.1

2017-03-22 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: That's great, make sure you also take a look at the quick start section of the devguide [1] if you need help in any steps :-) [1]: https://docs.python.org/devguide/#quick-start -- ___ Python tracker

[issue29881] Add a new private API for "static C variables" (_PyStaticVar) to clear them at exit

2017-03-22 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +eric.snow, serhiy.storchaka ___ Python tracker ___

[issue29881] Add a new private API for "static C variables" (_PyStaticVar) to clear them at exit

2017-03-22 Thread STINNER Victor
Changes by STINNER Victor : -- pull_requests: +677 ___ Python tracker ___ ___

[issue29878] Add global instances of int 0 and 1

2017-03-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: +1 for this idea. Also consider adding new function PyLong_Increment. This basic operation is small pain using the current API. It may also give a small speed benefit. -- nosy: +rhettinger ___ Python tracker

[issue29880] python3.6 install readline ,and then cpython exit

2017-03-22 Thread pz
New submission from pz: python3.6 -m pip istall readline # python3.6 Python 3.6.0 (default, Mar 21 2017, 23:23:51) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> *** glibc detected *** python3.6: free(): invalid

[issue29640] _PyThreadState_Init and fork race leads to inconsistent key list

2017-03-22 Thread Charalampos Stratakis
Charalampos Stratakis added the comment: Patch for protecting the key list while forking. -- Added file: http://bugs.python.org/file46753/0001-Protect-key-list-during-fork.patch ___ Python tracker

[issue29879] typing.Text not available in python 3.5.1

2017-03-22 Thread Charles Bouchard-Légaré
Charles Bouchard-Légaré added the comment: Thank you for confirming this. I'll look into it -- ___ Python tracker ___

[issue29866] Added datetime_diff to datetime.py.

2017-03-22 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: Without stating an opinion on the change, I'd suggest first posting to python-ideas (unless you already did so and I missed it :-) to get an initial reaction from folks on your idea before coming to b.p.o. If you have the backing of python-ideas you

[issue29881] Add a new private API for "static C variables" (_PyStaticVar) to clear them at exit

2017-03-22 Thread STINNER Victor
New submission from STINNER Victor: When I read Serhiy Storshaka's idea in issue #29878, it recalled me an old idea of writing a generalization of the _Py_IDENTIFIER() API. _Py_IDENTIFIER is an API to initialize a static string variable once. The _Py_Identifier structure has a "next" field to

[issue29880] python3.6 install readline ,and then cpython exit

2017-03-22 Thread Zachary Ware
Zachary Ware added the comment: This is more likely to be a bug in the 'readline' package from PyPI rather than in Python itself. That package has not been updated since 2012 when it was renamed to 'gnureadline', and 'gnureadline' has not been updated since 2014. If you can still reproduce

[issue29878] Add global instances of int 0 and 1

2017-03-22 Thread STINNER Victor
STINNER Victor added the comment: Other common values used in C functions: empty byte string, empty Unicode string, empty tuple. The problem is to make sure that singletons are created in the right order :-/ This issue reminded me an old idea of writing a generalization of the

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Niklas Fiekas
New submission from Niklas Fiekas: An efficient popcount (something equivalent to bin(a).count("1")) would be useful for numerics, parsing binary formats, scientific applications and others. DESIGN DECISIONS * Is a popcount method useful enough? * How to handle negative values? * How should

[issue29878] Add global instances of int 0 and 1

2017-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yet one idea that can make the code simpler is make PyLong_FromLong(0) and PyLong_FromLong(1) never failing. I.e. require NSMALLPOSINTS not less than 2. > Also consider adding new function PyLong_Increment. This basic operation is > small pain using the

[issue29866] Added datetime_diff to datetime.py.

2017-03-22 Thread Decorater
Decorater added the comment: Yeah, I could. I did just realize that there is a bug in it though that sometimes if it is like 58 seconds into a minute and you sleep for 15 that the code then thinks an entire minute elapsed when it has not. I need to think of a way to bypass that bug first. I

[issue29866] Added datetime_diff to datetime.py.

2017-03-22 Thread Decorater
Decorater added the comment: an url preview of the bug itself https://travis-ci.org/AraHaan/datetime_diff/jobs/213944228 -- ___ Python tracker ___

[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Georg Brandl
Georg Brandl added the comment: > In particular, we must have at least one digit following `0[xXbBoO]` and must > be before any underscores. This is not true (but your test file does the right thing). -- ___ Python tracker

[issue29881] Add a new private API for "static C variables" (_PyStaticVar) to clear them at exit

2017-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problem with existing static variables are that they are not properly cleared. When the Python interpreter is finalized and reinitialized they can contain invalid references. This patch fixes this issue. > * It requires to write "var.obj" instead of

[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I suggest to use my regular expression for haxadedecimals. Your regular expression starves from catastrophic backtracking. Compare two examples: re.match(r'0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?'+r'\b', '0x'+'0'*100+'z')

[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Nevada Sanchez
Nevada Sanchez added the comment: Thanks, it seems I misspoke. Glad I tested it! -- ___ Python tracker ___

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker ___

[issue29757] The loop in utility `socket.create_connection()` swallows previous errors

2017-03-22 Thread Kostis Anagnostopoulos
Kostis Anagnostopoulos added the comment: > This is a new feature, so we can only push it to 3.7. As it stands now(b39d4b1c6) it hardly contains any change - just in the case of multiple intermediate errors AND final failure, the exception raised is a bit different. AFAICS it would be a

[issue29883] asyncio: Windows Proactor Event Loop UDP Support

2017-03-22 Thread Adam Meily
New submission from Adam Meily: I am working on a Python 3.5 project that uses asyncio on a Windows system to poll both UDP and TCP connections. Multiple sources online say that the Windows Proactor event loop, which uses I/O Completion Ports, is considerably faster and more efficient than

[issue29816] Get rid of C limitation for shift count in right shift

2017-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The special case would be not needed if limit Python ints on 32-bit platforms to approximately 2**2**28. int.bit_length() could be simpler too. -- ___ Python tracker

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Mark Dickinson
Mark Dickinson added the comment: Can you give some examples of concrete use-cases? I've spent the last six years or so writing scientific applications and parsing all sorts of odd binary formats, and haven't needed or wanted a popcount yet. > (I am not a fan of the arbitrary return value).

[issue29816] Get rid of C limitation for shift count in right shift

2017-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Updated the PR to divrem1-based version. The drawback is that divrem1 can fail with MemoryError while C long long arithmetic always works for integers of the size less than 1 exbibyte. -- ___ Python tracker

[issue29881] Add a new private API for "static C variables" (_PyStaticVar) to clear them at exit

2017-03-22 Thread STINNER Victor
STINNER Victor added the comment: The purpose of the issue is to fix memory leaks like issue #21387 (this one is not the best example since it seems like the leak doesn't come from a static variable.) -- ___ Python tracker

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Niklas Fiekas
Changes by Niklas Fiekas : -- pull_requests: +678 ___ Python tracker ___ ___

[issue29881] Add a new private API for "static C variables" (_PyStaticVar) to clear them at exit

2017-03-22 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +ncoghlan ___ Python tracker ___ ___

[issue29574] python-3.6.0.tgz permissions borked

2017-03-22 Thread Ned Deily
Ned Deily added the comment: My apologies for the bad permissions in the tar file. The newly-released 3.6.1 tar files should not have this anomaly. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Niklas Fiekas
Niklas Fiekas added the comment: Searching popcount in Python files on GitHub yields a considerable number of examples: https://github.com/search?utf8=%E2%9C%93=popcount+extension%3Apy=Code Perhaps intresting: * In CPython itself: See count_set_bits in Modules/mathmodule.c * Domain

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think that adding bitarray or bitset (or both) in the stdlib would better satisfy the needs. There are open issues for adding ability to read or set selected bits or range of bits in int or for bitwise operations on bytes. I think that bitarray and bitset

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Tim Peters
Tim Peters added the comment: See also: https://en.wikipedia.org/wiki/Hamming_weight As that says, there are a number of languages and processors with first class support for a popcount function. I've frequently implemented it in Python when using integers as integer bitsets (`i` is in

[issue29882] Add an efficient popcount method for integers

2017-03-22 Thread Mark Dickinson
Mark Dickinson added the comment: Many of those applications are really for bitstrings (chess bitboards, hamming distance), which aren't really the same thing as integers. Nice find for the mathmodule.c case. I'd forgotten about that one (though according to git blame, apparently I'm

[issue29204] Add code deprecations in ElementTree

2017-03-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +679 ___ Python tracker ___ ___

[issue13349] Non-informative error message in index() and remove() functions

2017-03-22 Thread Emmanuel Arias
Emmanuel Arias added the comment: I agree with Jim Fasarakis-Hilliard this message may be change in new 3.7 version -- nosy: +eamanu ___ Python tracker

[issue29728] Expose TCP_NOTSENT_LOWAT

2017-03-22 Thread Mariatta Wijaya
Mariatta Wijaya added the comment: Thanks, Nathaniel. I merged your patch :) -- nosy: +Mariatta resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-22 Thread Mariatta Wijaya
Changes by Mariatta Wijaya : -- pull_requests: +681 ___ Python tracker ___ ___

[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-22 Thread Mariatta Wijaya
Changes by Mariatta Wijaya : -- pull_requests: +680 ___ Python tracker ___ ___

[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Nevada Sanchez
Nevada Sanchez added the comment: Good point. Updated. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue29884] faulthandler does not properly restore sigaltstack during teardown

2017-03-22 Thread Christophe Zeitouny
Changes by Christophe Zeitouny : Added file: http://bugs.python.org/file46755/python_reproducer.cpp ___ Python tracker ___

[issue29884] faulthandler does not properly restore sigaltstack during teardown

2017-03-22 Thread Christophe Zeitouny
New submission from Christophe Zeitouny: Looks like faulthandler is not properly tearing down its sigaltstack, causing potential double-free issues in any application that embeds the Python interpreter. I stumbled upon this when I enabled AddressSanitizer on my application, which sets up and

[issue29884] faulthandler does not properly restore sigaltstack during teardown

2017-03-22 Thread Christophe Zeitouny
Changes by Christophe Zeitouny : -- pull_requests: +682 ___ Python tracker ___ ___

[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-22 Thread Mariatta Wijaya
Mariatta Wijaya added the comment: Thanks for the PR, Ivan. Merged and backported to 3.5 and 3.6. -- nosy: +Mariatta resolution: -> fixed stage: needs patch -> resolved status: open -> closed ___ Python tracker

[issue14965] super() and property inheritance behavior

2017-03-22 Thread Mariatta Wijaya
Changes by Mariatta Wijaya : -- versions: +Python 3.7 -Python 3.5 ___ Python tracker ___

[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-22 Thread Nathaniel Smith
Nathaniel Smith added the comment: Letting Python-level signal handlers run in arbitrary threads is an interesting idea, but it's a non-trivial change to Python semantics that may well break some programs (previously it was guaranteed that signal handlers couldn't race with main thread code),

[issue29876] Check for null return value [_elementtree.c : subelement]

2017-03-22 Thread Xiang Zhang
Changes by Xiang Zhang : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___

[issue27863] multiple issues in _elementtree module

2017-03-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +674 ___ Python tracker ___ ___

[issue29857] Provide `sys.executable_argv` for host application's command line arguments

2017-03-22 Thread Nick Coghlan
Nick Coghlan added the comment: OK, I've changed the proposed attribute name to be `sys.executable_argv`, with the rationale being that it's "argv as originally seen by sys.executable, rather than by Python's __main__ module" As part of documenting this, both it and the `argv` documentation

[issue29876] Check for null return value [_elementtree.c : subelement]

2017-03-22 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +673 ___ Python tracker ___ ___ Python-bugs-list

[issue29878] Add global instances of int 0 and 1

2017-03-22 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: When C code needs to compare Python object with int 0 or add int 1 it either use local reference to PyLong_FromLong(0) and PyLong_FromLong(1) which should be decrefed just after use or module level global variable initialized and cleared during

[issue29870] ssl socket leak

2017-03-22 Thread Cory Benfield
Changes by Cory Benfield : -- nosy: +Lukasa ___ Python tracker ___ ___ Python-bugs-list

[issue29779] New environment variable PYTHONHISTORY

2017-03-22 Thread Berker Peksag
Changes by Berker Peksag : -- components: +Library (Lib) nosy: +berker.peksag stage: -> patch review type: -> enhancement ___ Python tracker

[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-22 Thread STINNER Victor
STINNER Victor added the comment: Hum, maybe I found the root issue: the C signal handler calls Py_AddPendingCall() which uses a lock to protect a global static pendingcalls array (of 32 items). The function tries 100 times in a row to acquire to lock, or does nothing (returns -1) if it fails

[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-22 Thread STINNER Victor
STINNER Victor added the comment: I created a WIP patch https://github.com/python/cpython/pull/768 to experiment allowing signal handlers from any threads. I expect many race conditions since I only removed sanity checks without adding new code to handle parallelism. --

[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-22 Thread STINNER Victor
STINNER Victor added the comment: Attached signal_pause_doesnt_wake_up.py is a little bit complex and not sure that it's reliable. I wrote thread_signal.py which should have a more deterministic behaviour. Output on Linux: --- main: main thread 140392674538560 thread: wait main: spawn thread

[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-22 Thread STINNER Victor
Changes by STINNER Victor : -- pull_requests: +675 ___ Python tracker ___ ___

[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-22 Thread STINNER Victor
STINNER Victor added the comment: Nathaniel Smith added the comment: > In any case, the issue here remains that one shouldn't have to use > set_wakeup_fd for a signal to interrupt time.sleep etc. CPython implements a C signal handler which sets a flag and then exits immediately. The thread

[issue29871] Enable optimized locks on Windows

2017-03-22 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Hi there. Looking at the API docs today (https://msdn.microsoft.com/en-us/library/windows/desktop/ms686304(v=vs.85).aspx) it appears that the timeout case is documented. I'm fairly sure that it wasn't when I implemented it. There was a good reason for

[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-22 Thread STINNER Victor
STINNER Victor added the comment: thread_signal.py: Oops, I forgot to remove the "raise Exception" line from sighandler() (I used it for a quick test.) -- ___ Python tracker

[issue29788] tarfile: Add absolute_path option to tarfile, disabled by default

2017-03-22 Thread Berker Peksag
Changes by Berker Peksag : -- nosy: +berker.peksag ___ Python tracker ___ ___

[issue29869] Underscores in numeric literals not supported in lib2to3.

2017-03-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Python uses more strong rules for underscores in numerical literals. Underscores are acceptable between digits and between the base prefix and digit. For example the regular expression for hexadecimals is r'0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?'.

[issue28331] "CPython implementation detail:" removed when content translated

2017-03-22 Thread INADA Naoki
Changes by INADA Naoki : -- pull_requests: +676 ___ Python tracker ___ ___

[issue28331] "CPython implementation detail:" removed when content translated

2017-03-22 Thread INADA Naoki
Changes by INADA Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: -Python 2.7, Python 3.5 ___ Python tracker

[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-03-22 Thread Dustin Spicuzza
Changes by Dustin Spicuzza : -- type: -> behavior ___ Python tracker ___ ___