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

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

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

2017-03-21 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +673 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue29878] Add global instances of int 0 and 1

2017-03-21 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 initializin

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

2017-03-21 Thread Dustin Spicuzza
Changes by Dustin Spicuzza : -- title: compileall fails with urandom error even if number of workers is 1 -> compileall hangs when accessing urandom even if number of workers is 1 ___ Python tracker __

[issue29877] compileall fails with urandom error even if number of workers is 1

2017-03-21 Thread Dustin Spicuzza
New submission from Dustin Spicuzza: Found on Python 3.6 on a low-resource platform (NI RoboRIO), it seems that this occurs only because the ProcessPoolExecutor is being imported. A proposed fix would only import ProcessPoolExecutor if -j > 1. Stacktrace follows: /usr/local/bin/python3 -m com

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

2017-03-21 Thread Alex CHEN
New submission from Alex CHEN: In file _elementtree.c our static code scanner has reported this case, I think there is a bit similar to http://bugs.python.org/issue29874 (returns NULL when NoMemory) static PyObject* subelement(PyObject* self, PyObject* args, PyObject* kw) { PyObject* elem;

[issue29868] multiprocessing.dummy missing cpu_count

2017-03-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +davin, flox ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue29875] IDLE quit unexpectedly

2017-03-21 Thread Ned Deily
Ned Deily added the comment: Welcome to the world of Python! You most likely saw a message similar to this when the IDLE shell window opened: WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable. Visit http://www.python.org/download/mac/tcltk/ for current information. If you follow th

[issue29875] IDLE quit unexpectedly

2017-03-21 Thread Igor
New submission from Igor: Hi! I'm a newbie, both in this community and with Python. I downloaded Python today (March 22, 2017, version 3.6.1) and as I was following a tutorial on how to build my first program (the classical Hello World) with Python, the IDLE window closed and my Mac showed the

[issue29874] Need a look for return value checking [selectmodule.c]

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

[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +672 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue29873] Need a look for return value checking [_elementtree.c]

2017-03-21 Thread Xiang Zhang
Xiang Zhang added the comment: Fixed. Thanks for your report Alex. -- nosy: +xiang.zhang resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ _

[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Xiang Zhang
Xiang Zhang added the comment: This has been fixed for 3.x in #18408 but not backported to 2.7. -- nosy: +xiang.zhang ___ Python tracker ___ _

[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Xiang Zhang
Changes by Xiang Zhang : -- versions: +Python 2.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Alex CHEN
Changes by Alex CHEN : -- type: -> crash ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.o

[issue29874] Need a look for return value checking [selectmodule.c]

2017-03-21 Thread Alex CHEN
New submission from Alex CHEN: In file selectmodule.c our static code scanner has reported the following case, function set2list is liable to return NULL (if PyTuple_New failed), would any chance the NULL pointer be dereferenced (Py_DECREF(fdlist) after set2list) or it would just raise pytho

[issue29873] Need a look for return value checking [_elementtree.c]

2017-03-21 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +671 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: Hmm... I was only running the threading related tests originally, and they passed, but it looks like this causes problems with multiprocessing (test_multiprocessing_spawn and test_concurrent_futures both stall out forever with this change, with or without my f

[issue29873] Need a look for return value checking [_elementtree.c]

2017-03-21 Thread Alex CHEN
New submission from Alex CHEN: In file _elementtree.c our static code scanner has reported this case, but I don't sure that could be any problem, may you have a look? static PyObject* element_getattr(ElementObject* self, char* name) { PyObject* res; /* handle common attributes first

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

2017-03-21 Thread Nathaniel Smith
Nathaniel Smith added the comment: @haypo: okay, looked over things over for a third time and this time I found my very silly error :-). So I'm now able to use set_wakeup_fd on Windows (https://github.com/python-trio/trio/pull/108), but not on Unix (https://github.com/python-trio/trio/issues/1

[issue29504] blake2: compile error with -march=bdver2

2017-03-21 Thread Ned Deily
Ned Deily added the comment: This didn't make it in time for 3.6.1; deferred to 3.6.2. -- ___ Python tracker ___ ___ Python-bugs-list

[issue29872] spam

2017-03-21 Thread Xiang Zhang
Changes by Xiang Zhang : -- Removed message: http://bugs.python.org/msg289962 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue29872] spam

2017-03-21 Thread Xiang Zhang
Changes by Xiang Zhang : -- resolution: -> not a bug stage: -> resolved status: open -> closed title: My reply -> spam ___ Python tracker ___ __

[issue29872] My reply

2017-03-21 Thread James Triveri
New submission from James Triveri: reply from james.triv...@gmail.com -- messages: 289962 nosy: jtrive84 priority: normal severity: normal status: open title: My reply ___ Python tracker ___

[issue29870] ssl socket leak

2017-03-21 Thread Alexander Mohr
Alexander Mohr added the comment: interestingly the valgrind run doesn't show a leak in the profile -- ___ Python tracker ___ ___ Pyth

[issue29870] ssl socket leak

2017-03-21 Thread Alexander Mohr
Alexander Mohr added the comment: adding valgrind log of 3.5.3 on debian: jessie -- Added file: http://bugs.python.org/file46750/valgrind.log.gz ___ Python tracker ___ __

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

2017-03-21 Thread Mariatta Wijaya
Changes by Mariatta Wijaya : -- stage: -> patch review versions: +Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue28767] Readd __index__ support on ipaddress objects

2017-03-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: >From the original bugs, it looks like people liked being able to directly >produce the hex of the IP addresses using hex(). I'll admit I'm only +0.5 on >restoring __index__; having them be equivalent to int, not just convertable, >doesn't seem critical. I jus

[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note: Beyond turning on the new primitives by default, I also made a change to PyCOND_TIMEDWAIT. The original code looked wrong, in that: 1. It assumed that when SleepConditionVariableSRW returned non-zero, you didn't know if the wait had timed out or not, so

[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- pull_requests: +670 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

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

2017-03-21 Thread Nathaniel Smith
Nathaniel Smith added the comment: @haypo: It's a socketpair. It works fine when I set up a toy test case using set_wakeup_fd + select, and it works fine in my real code when I use CFFI cleverness to register a signal handler that manually writes a byte to my wakeup socket, but when I pass tha

[issue29870] ssl socket leak

2017-03-21 Thread Alexander Mohr
Alexander Mohr added the comment: validated 3.6 in fedora is affected as well, see github bug for charts. So it seems all 3.5.3+ versions are affected. I'm guessing it was introduced in one of the SSL changes in 3.5.3: https://docs.python.org/3.5/whatsnew/changelog.html#python-3-5-3 ---

[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg
New submission from Josh Rosenberg: Kristjan wrote improved locking primitives in #15038 that use the new (in Vista) SRWLock and Condition Variable APIs. SRWLocks (used in exclusive mode only) replace Critical Sections, which is slower than SRWLock and provides no features we use that might ju

[issue29870] ssl socket leak

2017-03-21 Thread Alexander Mohr
New submission from Alexander Mohr: When upgrading to 3.5.3 we noticed that the requests module was leaking memory rather quickly. This led to me logging the issue: https://github.com/kennethreitz/requests/issues/3933. After more investigation I've found that the leak is caused by the raw py

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

2017-03-21 Thread STINNER Victor
STINNER Victor added the comment: 2017-03-22 1:55 GMT+01:00 Nathaniel Smith : > + for some reason set_wakeup_fd doesn't work for me on Windows (no idea why, > can't reproduce in simplified tests, might be my fault, need to debug), I modified signal.set_wakeup_fd() to accept a socket handle on W

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

2017-03-21 Thread Nathaniel Smith
Nathaniel Smith added the comment: I don't really have a specific use case personally -- for trio, I haven't found a way to make use of set_wakeup_fd because of various issues[1], but I'm also not planning to use SIGCHLD, so this isn't very urgent. In general set_wakeup_fd can be a workaround,

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

2017-03-21 Thread Nevada Sanchez
Changes by Nevada Sanchez : -- pull_requests: +668 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

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

2017-03-21 Thread Nevada Sanchez
New submission from Nevada Sanchez: The following should work in Python 3.6 ``` from lib2to3.pgen2 import driver from lib2to3 import pytree from lib2to3 import pygram _GRAMMAR_FOR_PY3 = pygram.python_grammar_no_print_statement.copy() parser_driver = driver.Driver(_GRAMMAR_FOR_PY3, convert=pytre

[issue29868] multiprocessing.dummy missing cpu_count

2017-03-21 Thread John Wiseman
New submission from John Wiseman: The documentation for the multiprocessing.dummy module says that it "replicates the API of multiprocessing." In Python 2.7, I can import multiprocessing.dummy and use the cpu_count function: $ python2 Python 2.7.12 (default, Oct 29 2016, 19:21:06) [GCC 4.2.1

[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-21 Thread Ivan Levkivskyi
Changes by Ivan Levkivskyi : -- pull_requests: +667 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue29866] Added datetime_diff to datetime.py.

2017-03-21 Thread Decorater
Decorater added the comment: I plan to also have it to where if it is the last unit in the thing that it appends an and to the end as well. -- ___ Python tracker ___ ___

[issue29866] Added datetime_diff to datetime.py.

2017-03-21 Thread Decorater
Decorater added the comment: Alright I revised it a bit locally too >>> import datetime >>> datetime.datetime_diff(datetime.datetime(2017, 1, 31), >>> datetime.datetime(2017, 1, 31)) '' >>> datetime.datetime_diff(datetime.datetime(2016, 12, 31, 23, 59, 59), >>> datetime.datetime(2017, 1, 1)) '

[issue29866] Added datetime_diff to datetime.py.

2017-03-21 Thread Decorater
Decorater added the comment: Oh, I just realized I forgot to add other if's to each block in case certain parts was 0 but others was not. I also realized I tried to do datetime.datetime.new instead of datetime.datetime.now on the tests. -- ___ Pytho

[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-21 Thread INADA Naoki
Changes by INADA Naoki : -- pull_requests: +666 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue29847] Path takes and ignores **kwargs

2017-03-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: > The support of **kwargs in Path.__new__ is needed if you want to implement a > subclass of Path with __init__ accepting keyword arguments I don't remember exactly, but I think this was the intention indeed. There was originally an openat-using subclass, and

[issue29847] Path takes and ignores **kwargs

2017-03-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't know whether it was the intension of Antoine or just an oversight. I don't know whether it is used in the wild. But we can at least raise a TypeError for concrete classes PosixPath and WindowsPath if ignoring keyword arguments is a problem. Many exte

[issue29847] Path takes and ignores **kwargs

2017-03-21 Thread Brett Cannon
Brett Cannon added the comment: Shoot, that's too bad. I guess we should document it then so people are aware that keyword arguments are ignored, else we will break subclasses. There's also an unfortunate difference between PurePath and Path as PurePath doesn't have this quirk. -- __

[issue29862] Fix grammar typo in importlib.reload() exception

2017-03-21 Thread Brett Cannon
Changes by Brett Cannon : -- title: Fix grammar in importlib.reload() exception -> Fix grammar typo in importlib.reload() exception ___ Python tracker ___ __

[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-21 Thread Brett Cannon
Brett Cannon added the comment: The output LGTM. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue29863] Add a COMPACT constant to the json module

2017-03-21 Thread Bob Ippolito
Bob Ippolito added the comment: I suppose I'm +0. I don't think this is particularly useful, but this is closer to the ideal of just having a boolean option. We should probably also plan to remove the documentation for what the type of separators is to give the impression that COMPACT and the

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

2017-03-21 Thread STINNER Victor
STINNER Victor added the comment: > If the embedding application doesn't call PySys_SetArgv or PySys_SetArgvEx, > then there is no `argv` attribute defined in the sys module (I wasn't > actually sure what happened in that case, so I went and checked the code). Ok, so just don't define sys._raw

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

2017-03-21 Thread Nick Coghlan
Nick Coghlan added the comment: If the embedding application doesn't call PySys_SetArgv or PySys_SetArgvEx, then there is no `argv` attribute defined in the sys module (I wasn't actually sure what happened in that case, so I went and checked the code). For the reference CLI, the relevant call

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

2017-03-21 Thread STINNER Victor
STINNER Victor added the comment: > For example, if Py_Main() is never called (for CPython), it would still be > None, What is the content of sys.argv in that case? Can't we use the same value for sys._raw_argv? -- ___ Python tracker

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

2017-03-21 Thread Nick Coghlan
Nick Coghlan added the comment: @Steven This is an implementation detail in the same sense that sys._getframe() is: it's not something that's actually going to make sense in all contexts. For example, if Py_Main() is never called (for CPython), it would still be None, and other implementations

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

2017-03-21 Thread STINNER Victor
STINNER Victor added the comment: There is already an existing public C API get retrieve original program arguments *as text*: /* Make the *original* argc/argv available to other modules. This is rare, but it is needed by the secureware extension. */ void Py_GetArgcArgv(int *argc, wchar_t *

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

2017-03-21 Thread STINNER Victor
STINNER Victor added the comment: > Well, "raw args" implies minimal or no processing, Ok, so call it "original", sys.orig_arv, in that case ;-) -- ___ Python tracker ___ __

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

2017-03-21 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Mar 21, 2017, at 11:47 AM, STINNER Victor wrote: >No, text please. Text is just more convenient in Python, and it's trivial to >retrieve original bytes: > >raw_args_bytes = [os.fsencode(arg) for arg in sys._raw_args] Well, "raw args" implies minimal or no p

[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target

2017-03-21 Thread Ivan Levkivskyi
Changes by Ivan Levkivskyi : -- nosy: +levkivskyi ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue29593] Improve UnboundLocalError message for deleted names

2017-03-21 Thread Ivan Levkivskyi
Changes by Ivan Levkivskyi : -- nosy: +levkivskyi ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-21 Thread Daniel Birnstiel
Changes by Daniel Birnstiel : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bu

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

2017-03-21 Thread STINNER Victor
STINNER Victor added the comment: > As bytes? No, text please. Text is just more convenient in Python, and it's trivial to retrieve original bytes: raw_args_bytes = [os.fsencode(arg) for arg in sys._raw_args] -- nosy: +haypo ___ Python tracker

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

2017-03-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: Why is the name flagged as a private implementation detail? I.e. a single leading underscore. I'd be reluctant to rely on this in production code, given how strong the _private convention is. Suggest just `sys.raw_args` instead. -- nosy: +steven.dapr

[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-21 Thread INADA Naoki
INADA Naoki added the comment: OK, perror() writes to stderr too. fair enough. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue29736] Optimize builtin types constructor

2017-03-21 Thread STINNER Victor
STINNER Victor added the comment: The following types were patched to use Argument Clinic (use now _PyArg_ParseTupleAndKeywordsFast or don't accept keyword arguments anymore): * complex * float (don't accept keywords anymore) * list * tuple The following types still uses PyArg_ParseTupleAndKey

[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-21 Thread Daniel Birnstiel
Daniel Birnstiel added the comment: While I agree, fprintf it not really nice, I looked through other parts of the python source where information is printed to stderr and fprintf was used there as well, so I fell back to it myself. % grep -rnw . -e "fprintf(stderr," | wc -l

[issue29867] Add asserts in PyXXX_GET_SIZE macros

2017-03-21 Thread STINNER Victor
STINNER Victor added the comment: We should test to run popular C extensions like numpy, PyQt, cython, pillow, etc. with a patched Python to see if it's common to use a "GET" macro to "set" a size. Maybe test also Django see it probably uses many C extensions. I don't ask to test all these mod

[issue29866] Added datetime_diff to datetime.py.

2017-03-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In that case you can publish your code as a receipt or as a module on PyPI. If it will be popular enough we can consider including it in the stdlib. Currently your code is just broken. >>> datetime.datetime_diff(datetime.datetime(2017, 1, 31), >>> datetime.

[issue28749] Fixed the documentation of the mapping codec APIs

2017-03-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

[issue29867] Add asserts in PyXXX_GET_SIZE macros

2017-03-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +665 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue29867] Add asserts in PyXXX_GET_SIZE macros

2017-03-21 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch adds asserts for checking the type in macros PyTuple_GET_SIZE, PyList_GET_SIZE and PySet_GET_SIZE. This can help to find the misuse of these macros. Asserts already are used in macros PyBytes_GET_SIZE, PyByteArray_GET_SIZE, PyUnicode_GET_SIZ

[issue26418] multiprocessing.pool.ThreadPool eats up memories

2017-03-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the feedback! I'm closing the issue then. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___

[issue29864] Misuse of Py_SIZE in dict.fromkey()

2017-03-21 Thread Xiang Zhang
Xiang Zhang added the comment: I think 3.6 is enough. -- versions: +Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue29864] Misuse of Py_SIZE in dict.fromkey()

2017-03-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, I treat this as a bugfix but I hesitated about backporting it. Py_SIZE works "by accident" and we can't change the layout of PyDictObject structure in maintain branches. I have backported the fix to 3.6, but not to other branches since PyDict_GET_SIZE

[issue29864] Misuse of Py_SIZE in dict.fromkey()

2017-03-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +664 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue29863] Add a COMPACT constant to the json module

2017-03-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: -0 too. This complicates the module API without a need. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue29864] Misuse of Py_SIZE in dict.fromkey()

2017-03-21 Thread Xiang Zhang
Xiang Zhang added the comment: How about 3.6, Serhiy? I see you treat this as a bugfix on the PR. -- nosy: +xiang.zhang ___ Python tracker ___ ___

[issue29863] Add a COMPACT constant to the json module

2017-03-21 Thread INADA Naoki
INADA Naoki added the comment: -0. COMPACT_SEPARATOR make more sense to me. Because `ensure_ascii=False` may make JSON more compact too. -- nosy: +inada.naoki ___ Python tracker ___