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

2017-01-20 Thread INADA Naoki
INADA Naoki added the comment: TL;DR Changing positional argument name doesn't break backward compatibility. After start accepting keyword argument, it's name is part of API and should be stable. For example, document says `str.startswith(prefix[, start[, end]])`. But this patch seems using

[issue29337] BytesWarning at compile time

2017-01-20 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: BytesWarning can be raised during compilation. $ ./python -Wa -b -c "lambda: 'a'; lambda: b'a'" sys:1: BytesWarning: Comparison between bytes and string sys:1: BytesWarning: Comparison between bytes and string sys:1: BytesWarning: Comparison between bytes

[issue29314] asyncio.async deprecation warning is missing stacklevel=2

2017-01-20 Thread Mariatta Wijaya
Mariatta Wijaya added the comment: Attached patch adds stacklevel=2 to the deprecation warning. -- keywords: +patch nosy: +Mariatta Added file: http://bugs.python.org/file46369/issue29314.patch ___ Python tracker

[issue29336] merge tuples in module

2017-01-20 Thread INADA Naoki
Changes by INADA Naoki : Added file: http://bugs.python.org/file46368/mergetuples2.patch ___ Python tracker ___

[issue29336] merge tuples in module

2017-01-20 Thread INADA Naoki
INADA Naoki added the comment: Oh, thanks. I hadn't checked the warning. Since bytes are not important in this time, I'll remove bytes support. -- ___ Python tracker

[issue29336] merge tuples in module

2017-01-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: $ ./python -Wa -b -c "lambda: 'a'; lambda: b'a'" sys:1: BytesWarning: Comparison between bytes and string sys:1: BytesWarning: Comparison between bytes and string sys:1: BytesWarning: Comparison between bytes and string sys:1: BytesWarning: Comparison between

[issue29332] Uniform SelectSelector._select behavior

2017-01-20 Thread Wen Adam
Wen Adam added the comment: I know it works on python3.4, but black magic still exists in selectors lib,and 3rd-party module have to prepare two function to make compatibility. -- ___ Python tracker

[issue29332] Uniform SelectSelector._select behavior

2017-01-20 Thread Berker Peksag
Berker Peksag added the comment: Great! Since this is no longer an issue on Python 3.4+, I'm going to close this as a duplicate of issue 27634 and merge https://github.com/berkerpeksag/selectors34/pull/4. -- resolution: -> duplicate stage: -> resolved status: open -> closed

[issue29332] Uniform SelectSelector._select behavior

2017-01-20 Thread Wen Adam
Wen Adam added the comment: Thx for your replying, Peksag. I encountered this problem is really because of Gevent and Selector34. Gevent fixed this issue but only works for python3.4+(https://github.com/gevent/gevent/blob/master/src/gevent/monkey.py#L497) by a tricking way. python 2.x still

[issue29336] merge tuples in module

2017-01-20 Thread INADA Naoki
INADA Naoki added the comment: I tried this patch with attached script. ``` $ venv/bin/pip install django flask sqlalchemy $ PYTHONTRACEMALLOC=5 venv/bin/python3 tuplemem.py > tuples.txt $ sort tuples.txt | uniq -c | sort -nr > tuplecount ``` ## default memory: (32254693, 32292635) tuples:

[issue29336] merge tuples in module

2017-01-20 Thread INADA Naoki
New submission from INADA Naoki: Tuples consists of None, True, False, str and bytes can be merged safely. To avoid memory leak, this patch shares such tuples in compile unit (module, in most case.) -- files: merge-tuples.patch keywords: patch messages: 285933 nosy: haypo, inada.naoki

[issue29328] struct module should support variable-length strings

2017-01-20 Thread Cameron Simpson
Changes by Cameron Simpson : -- nosy: +cameron ___ Python tracker ___ ___ Python-bugs-list

[issue28595] shlex.shlex should not augment wordchars

2017-01-20 Thread Evan Andrews
Evan Andrews added the comment: Unfortunately shlex.shlex's defaults are probably going to remain that way for a long time in order to avoid breaking backwards compatibility. Presumably shlex.split was added so you didn't have to remember to set posix and whitespace_split yourself. The

[issue29326] Blank lines in ._pth file are not ignored

2017-01-20 Thread Ammar Askar
Ammar Askar added the comment: I've attached a patch that makes the site package ignore empty lines in .pth files. Along with a test for this behavior. I'm not really familiar with the site machinery so I hope the test and code are fine. -- keywords: +patch nosy: +ammar2 Added file:

[issue28595] shlex.shlex should not augment wordchars

2017-01-20 Thread Gustavo Goretkin
Gustavo Goretkin added the comment: Sorry, I typo'd that last example pretty badly. Should be >>> list(shlex.shlex(b"mkdir Bad\xffButLegalPath".decode("utf-8", >>> "surrogateescape"))) ['mkdir', 'Bad', '\udcff', 'ButLegalPath'] -- ___ Python

[issue29331] Simplify argument parsing in sorted() and list.sort()

2017-01-20 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker ___ ___

[issue28595] shlex.shlex should not augment wordchars

2017-01-20 Thread Gustavo Goretkin
Gustavo Goretkin added the comment: >Instead of trying to enumerate all possible wordchars, I think a more robust >solution is to use whitespace_split to include *all* characters not otherwise >considered special. I agree with that approach. Also note that dash/hyphen gets incorrectly

[issue29332] Uniform SelectSelector._select behavior

2017-01-20 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the report! This is a duplicate of issue 27634. Since we got multiple reports [1][2] about the same problem on selectors34 (backport of selector module) and use of Gevent is very popular, I think we should reconsider the idea of wrapping

[issue29328] struct module should support variable-length strings

2017-01-20 Thread Elizabeth Myers
Elizabeth Myers added the comment: Also, to add to the discussion: * Rejecting this because "it doesn't cover every use case" is a red herring at best. If this can't cover your use case, odds are the struct module can *never* cover it. That is no reason to reject it alone; you would need

[issue29328] struct module should support variable-length strings

2017-01-20 Thread Elizabeth Myers
Elizabeth Myers added the comment: Hi, After discussing this on the python-ideas ML a bit more, this is actually a feature people want a great deal. It can't cover every use case, but to expand it further than this proposal and make it do so is way beyond the scope of this proposal. It may

[issue28735] Mock is equal to ANY but MagicMock is not

2017-01-20 Thread Berker Peksag
Berker Peksag added the comment: Serhiy's patch looks pretty good to me, thanks! Also, thanks for the report, Rafael. I definitely forgot to fix this case after fixing issue 25195. -- stage: patch review -> commit review ___ Python tracker

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

2017-01-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Most overhead of supporting keyword arguments when pass positional arguments was removed in issue29029. But still there is an overhead of passing argument by keywords. It can be decreased when convert functions to Argument Clinic or use new private argument

[issue26729] Incorrect __text_signature__ for sorted

2017-01-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue29327 and issue29331. sorted_3.patch LGTM. -- stage: patch review -> commit review versions: +Python 3.7 ___ Python tracker

[issue29335] Python 2.7 subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-20 Thread Ned Deily
Changes by Ned Deily : -- nosy: +gregory.p.smith ___ Python tracker ___ ___ Python-bugs-list

[issue29334] ssl.SSLObject method getpeercert() is buggy, do_handshake() is strange

2017-01-20 Thread Greg Stark
Greg Stark added the comment: adding script the illustrates the bug. -- Added file: http://bugs.python.org/file46364/sslbugs.py ___ Python tracker ___

[issue29335] Python 2.7 subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-20 Thread Zach Riggle
New submission from Zach Riggle: The attached script hits some "This should never happen" code in the subprocess module. These lines here: https://github.com/python/cpython/blob/2.7/Lib/subprocess.py#L1036-L1038 The root cause is a lack of checking WIFSTOPPED and WSTOPSIG in the handler.

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2017-01-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : Added file: http://bugs.python.org/file46362/enumobject-docstrings.patch ___ Python tracker ___

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2017-01-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch that restores ol docstrings for enumerate() and reversed(). But it may be better to change pydoc so that it would output a text signature of class constructor if available. -- ___ Python tracker

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2017-01-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Microbenchmarks: $ ./python -m perf timeit --duplicate 100 "enumerate('abc')" Unpatched: Median +- std dev: 1.76 us +- 0.10 us Patched:Median +- std dev: 1.61 us +- 0.07 us $ ./python -m perf timeit --duplicate 100 "enumerate('abc', 1)" Unpatched:

[issue28735] Mock is equal to ANY but MagicMock is not

2017-01-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Proposed patch fixes comparing MagicMock with ANY. -- keywords: +patch stage: -> patch review Added file: http://bugs.python.org/file46361/magicmock_eq.patch ___ Python tracker

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2017-01-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: When reviewing AC patches, we should always compare the help() before and after. Also, if the code already had fast parsing like: if (!PyArg_UnpackTuple(args, "reversed", 1, 1, ) ) there needs to be a before and after timing to make sure there wasn't a

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2017-01-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: The application of AC to enumerate() lost information about the start argument and the signature of the call. We're going backwards. New help - class enumerate(object) | Return an enumerate

[issue16285] Update urllib quoting to RFC 3986

2017-01-20 Thread Piotr Dobrogost
Changes by Piotr Dobrogost : -- nosy: +piotr.dobrogost ___ Python tracker ___

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2017-01-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There are patches based on modules_issue20186.patch that convert to Argument Clinic 4 modules: _csv, _lsprof, _tracemalloc and symtable. They are synchronized with current sources and updated to current Argument Clinic. Other changes: * Addressed Larry's

[issue29281] json.loads documentation missing "versionchanged" statement

2017-01-20 Thread Ammar Askar
Ammar Askar added the comment: Which part is misleading, do you think the use of "encoding" could be confused with the argument encoding? There is a note right above the versionchanged block that says: `The other arguments have the same meaning as in load(), except encoding which is ignored

[issue29316] Keep typing.py provisional for the duration of the Python 3.6 release cycle

2017-01-20 Thread Ned Deily
Ned Deily added the comment: Patch LGTM, thanks Ivan! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue29316] Keep typing.py provisional for the duration of the Python 3.6 release cycle

2017-01-20 Thread Roundup Robot
Roundup Robot added the comment: New changeset 72c64b6e5486 by Ned Deily in branch '3.6': Issue #29316: Restore the provisional status of typing module and add https://hg.python.org/cpython/rev/72c64b6e5486 New changeset ef416878495f by Ned Deily in branch 'default': Issue #29316: merge 3.6

[issue29316] Keep typing.py provisional for the duration of the Python 3.6 release cycle

2017-01-20 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Yes, I attached the patch. -- keywords: +patch stage: needs patch -> patch review Added file: http://bugs.python.org/file46356/provisional-typing-patch.diff ___ Python tracker

[issue28735] Mock is equal to ANY but MagicMock is not

2017-01-20 Thread Kushal Das
Kushal Das added the comment: Now I understood, thanks. I think I should have more coffee before commenting on bugs :) -- ___ Python tracker ___

[issue28735] Mock is equal to ANY but MagicMock is not

2017-01-20 Thread Xiang Zhang
Xiang Zhang added the comment: Kushal I think the OP is reporting `mock.MagicMock() == mock.ANY` is False while `mock.ANY == mock.MagicMock()` is True which is still the case in 3.7. A related issue is #25195. In that issue Serhiy has mentioned this

[issue28735] Mock is equal to ANY but MagicMock is not

2017-01-20 Thread Kushal Das
Kushal Das added the comment: >From a checkout in last week. Python 3.7.0a0 (default:c163a76163f7, Jan 15 2017, 22:20:24) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from unittest import mock >>> mock.ANY ==

[issue29325] pysqlite: Evaluate removal of sqlite3_stmt_readonly

2017-01-20 Thread R. David Murray
R. David Murray added the comment: Python ships with RH6, and includes a working sqlite3 module. So if you are restricting yourself to software directly supported by RH6, you are fine. If you are installing python3.6 on your rh6 box, then you can also install a more up to date sqlite in

[issue29334] ssl.SSLObject method getpeercert() is buggy, do_handshake() is strange

2017-01-20 Thread Greg Stark
Greg Stark added the comment: Christian, I will gladly do so a little later today. Thanks for your quick response. --greg On Fri, Jan 20, 2017 at 7:29 AM, Christian Heimes wrote: > > Christian Heimes added the comment: > > Hi Grek, > > can you provide a script to

[issue29334] ssl.SSLObject method getpeercert() is buggy, do_handshake() is strange

2017-01-20 Thread Christian Heimes
Christian Heimes added the comment: Hi Grek, can you provide a script to reproduce the problem, please? -- ___ Python tracker ___

[issue29319] Embedded 3.6.0 distribution cannot run pyz files

2017-01-20 Thread Nick Coghlan
Nick Coghlan added the comment: I think this is just a straight-up interaction bug where we never accounted for the combination of -I with directory and zipfile execution back when -I was added. >From a bug fix perspective, I think the right thing to do in all affected >versions would be to

[issue29334] ssl.SSLObject method getpeercert() is buggy, do_handshake() is strange

2017-01-20 Thread Greg Stark
New submission from Greg Stark: In my experiments with the relatively new class SSLObject from the ssl module I've noticed the following behavior(s) which I think can be described as bugs. The getpeercert() method raises a ValueError exception "handshake not done" even after the handshake has

[issue29333] ConfigParser calls Interpolation.before_read after reading

2017-01-20 Thread Gereon Kaiping
New submission from Gereon Kaiping: In its current implementation, `ConfigParser` calls its Interpolation's `before_read` method in the very last step of `_read`, when all properties have already been overwritten by their new uninterpolated values. I am developing a program with modular

[issue29331] Simplify argument parsing in sorted() and list.sort()

2017-01-20 Thread STINNER Victor
STINNER Victor added the comment: sort-arg-parse-2.patch now LGTM with the comment, thanks :-) -- ___ Python tracker ___

[issue29327] SystemError or crash in sorted(iterable=[])

2017-01-20 Thread STINNER Victor
Changes by STINNER Victor : -- title: SystemError or crash in sorted(iterable= -> SystemError or crash in sorted(iterable=[]) ___ Python tracker

[issue29327] SystemError or crash in sorted(iterable=

2017-01-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your reviews Victor and Raymond. As for more general Raymond comments, I agreed with many of them in principle, but this isn't directly related to this issue. Victor opened a topic on the python-committers mailing list:

[issue29327] SystemError or crash in sorted(iterable=

2017-01-20 Thread STINNER Victor
STINNER Victor added the comment: Raymond Hettinger: "A few random thoughts that may or may not be helpful: (...)" I replied on the python-committers mailing list: https://mail.python.org/pipermail/python-committers/2017-January/004129.html I'm not sure that this specific issue is the best

[issue29051] Improve error reporting involving f-strings (PEP 498)

2017-01-20 Thread Mark Shannon
Mark Shannon added the comment: It is also worth mentioning that incorrect line numbers means that tools like pyflakes, pylint, mypy, lgtm, etc, need to reimplement parsing of f-strings. -- ___ Python tracker

[issue9216] FIPS support for hashlib

2017-01-20 Thread Christian Heimes
Christian Heimes added the comment: PS: I'm also against a hashlib.fips module in stdlib. FIPS mode is irrelevant for majority of users and countries. I neither want to confuse people nor introduce more maintenance and documentation burden than necessary. Antoine gave another good reason

[issue29051] Improve error reporting involving f-strings (PEP 498)

2017-01-20 Thread Mark Shannon
Mark Shannon added the comment: This problem is the parsing of f-strings. The expressions in an f-string are not "eval"ed in the sense of the eval() function. They are evaluated exactly the same as any other Python expression. However the parsing of f-strings does not provide correct line

[issue9216] FIPS support for hashlib

2017-01-20 Thread Christian Heimes
Christian Heimes added the comment: Objection from hashlib maintainer: I will reject a used_for_security flag with default of False. I'm slowly moving Python to a secure-by-default policy. Therefore used_for_security must be an explicit opt-out. I'm aware that the policy will require

[issue29328] struct module should support variable-length strings

2017-01-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: To add a bit to what Yury said, even framing isn't always compatible with this proposal. For example, in dask/distributed, we first have a word for the number of frames, then one word per frame to indicate each frame's length, then the frame bodies.

[issue29160] pow with three int arguments works like it had two arguments

2017-01-20 Thread Mark Dickinson
Changes by Mark Dickinson : -- resolution: not a bug -> third party ___ Python tracker ___

[issue9924] sqlite3 SELECT does not BEGIN a transaction, but should according to spec

2017-01-20 Thread Aviv Palivoda
Changes by Aviv Palivoda : -- nosy: +palaviv ___ Python tracker ___ ___ Python-bugs-list

[issue28518] execute("begin immediate") throwing OperationalError

2017-01-20 Thread Aviv Palivoda
Aviv Palivoda added the comment: Uploading a new patch with fixes from Ma Lin comments. Two points: 1. Should we add the VACUUM with a explicit commit? Maybe there should be an implicit commit before VACUUM? 2. Should a SELECT start a transaction? I think it should according to PEP 249. There

[issue29331] Simplify argument parsing in sorted() and list.sort()

2017-01-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : Added file: http://bugs.python.org/file46353/sort-arg-parse-2.patch ___ Python tracker ___

[issue29281] json.loads documentation missing "versionchanged" statement

2017-01-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The wording looks little misleading. There is the encoding parameter in json.loads(). It is deprecated and ignored. -- nosy: +serhiy.storchaka ___ Python tracker

[issue29332] Uniform SelectSelector._select behavior

2017-01-20 Thread Wen Adam
New submission from Wen Adam: SelectSelector._select is differently on different platforms. On win32, SelectSelector._select is a unbound/bound method and pass instance as the first argument, but on *nix, SelectSelector._select is a builtin_function_or_method(Although self.select still works)