[issue32037] Pickle 32-bit integers with protocol 0 as INT instead of LONG

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32037] Pickle 32-bit integers with protocol 0 as INT instead of LONG

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 3daaafb700df45716bb55f3a293f88773baf3463 by Serhiy Storchaka in 
branch 'master':
bpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickles. (#4407)
https://github.com/python/cpython/commit/3daaafb700df45716bb55f3a293f88773baf3463


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30143] Using collections ABC from collections.abc rather than collections in 2to3 converted code

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30143] Using collections ABC from collections.abc rather than collections in 2to3 converted code

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 0a2abdfca2495291809855cf7dfc6721c9c962e3 by Serhiy Storchaka in 
branch 'master':
bpo-30143: 2to3 now generates a code that uses abstract collection classes 
(#1262)
https://github.com/python/cpython/commit/0a2abdfca2495291809855cf7dfc6721c9c962e3


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32044] pip3 install 3.6.3 crashes on startup; 3.5.4 works; on OS X 10.13.1

2017-11-15 Thread Daniel E Platt

Daniel E Platt  added the comment:

platt@MacBook-Pro.local:/Users/platt $ pip install -U setuptools pip
Collecting setuptools
  Downloading setuptools-36.7.2-py2.py3-none-any.whl (482kB)
100% || 491kB 2.6MB/s 
Requirement already up-to-date: pip in 
./Library/Python/2.7/lib/python/site-packages
Installing collected packages: setuptools
  Found existing installation: setuptools 18.5
Uninstalling setuptools-18.5:
Exception:
Traceback (most recent call last):
  File 
"/Users/platt/Library/Python/2.7/lib/python/site-packages/pip/basecommand.py", 
line 215, in main
status = self.run(options, args)
  File 
"/Users/platt/Library/Python/2.7/lib/python/site-packages/pip/commands/install.py",
 line 342, in run
prefix=options.prefix_path,
  File 
"/Users/platt/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", 
line 778, in install
requirement.uninstall(auto_confirm=True)
  File 
"/Users/platt/Library/Python/2.7/lib/python/site-packages/pip/req/req_install.py",
 line 754, in uninstall
paths_to_remove.remove(auto_confirm)
  File 
"/Users/platt/Library/Python/2.7/lib/python/site-packages/pip/req/req_uninstall.py",
 line 115, in remove
renames(path, new_path)
  File 
"/Users/platt/Library/Python/2.7/lib/python/site-packages/pip/utils/__init__.py",
 line 267, in renames
shutil.move(old, new)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
 line 299, in move
copytree(src, real_dst, symlinks=True)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
 line 208, in copytree
raise Error, errors
Error: 
[('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc',
 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc',
 "[Errno 1] Operation not permitted: 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"),
 
('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py',
 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py',
 "[Errno 1] Operation not permitted: 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"),
 
('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py',
 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py',
 "[Errno 1] Operation not permitted: 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"),
 
('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc',
 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc',
 "[Errno 1] Operation not permitted: 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"),
 
('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib',
 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib',
 "[Errno 1] Operation not permitted: 
'/var/folders/68/lk7bsfq51hq3406jk8v83z88gn/T/pip-hvP8_p-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

--
resolution: third party -> wont fix
status: closed -> open
type: behavior -> crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32044] pip3 install 3.6.3 crashes on startup; 3.5.4 works; on OS X 10.13.1

2017-11-15 Thread Berker Peksag

Berker Peksag  added the comment:

Thank you for your report. This is a problem with setuptools: 
https://github.com/pypa/setuptools/issues/885 I suggest upgrading both 
setuptools and pip:

$ pip install -U setuptools pip

--
nosy: +berker.peksag
resolution:  -> third party
stage:  -> resolved
status: open -> closed
type: crash -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31701] faulthandler dumps 'Windows fatal exception: code 0xe06d7363'

2017-11-15 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

May I ask why AddVectoredExceptionHandler is used instead of 
SetUnhandledExceptionFilter?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32044] pip3 install 3.6.3 crashes on startup; 3.5.4 works; on OS X 10.13.1

2017-11-15 Thread Daniel E Platt

Daniel E Platt  added the comment:

platt@MacBook-Pro.local:/Users/platt $ pip3
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/pip3", line 7, in 

from pip import main
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/__init__.py",
 line 26, in 
from pip.utils import get_installed_distributions, get_prog
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/utils/__init__.py",
 line 27, in 
from pip._vendor import pkg_resources
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py",
 line 3018, in 
@_call_aside
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py",
 line 3004, in _call_aside
f(*args, **kwargs)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py",
 line 3046, in _initialize_master_working_set
dist.activate(replace=False)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py",
 line 2578, in activate
declare_namespace(pkg)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py",
 line 2152, in declare_namespace
_handle_ns(packageName, path_item)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py",
 line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py",
 line 2121, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32044] pip3 install 3.6.3 crashes on startup; 3.5.4 works; on OS X 10.13.1

2017-11-15 Thread Daniel E Platt

New submission from Daniel E Platt :

pip3 installed with 3.6.3 crashes on startup. 
pip3 installed with 3.5.4 works. 
Appears on OS X 10.13.1

--
components: Installation
messages: 306336
nosy: DanPlatt
priority: normal
severity: normal
status: open
title: pip3 install 3.6.3 crashes on startup; 3.5.4 works; on OS X 10.13.1
type: crash
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32038] Add API to intercept socket.close()

2017-11-15 Thread Ben Darnell

Ben Darnell  added the comment:

It's worse than a resource leak - the same file descriptor number could be 
reused for a different file/socket, and then depending on the selector in use, 
you could see the data from a completely different connection. 

I did see a bug like this years ago (in libcurl), although it's not a common 
problem. I'd use the proposed hook if it existed, but it seems like an 
intrusive solution to a rare issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32026] Memory leaks in Python on Windows

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:

Python doesn't clean everything at exit: see bpo-29881.

I just modified Py_Main() in bpo-32030 to clean a few more bytes (like 
program_name): see pymain_free() in Modules/main.c.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31701] faulthandler dumps 'Windows fatal exception: code 0xe06d7363'

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:

> Does this change imply that no python-traceback-for-every-thread will be 
> printed upon both handled and unhandled C++ exception?

Right if I understood correctly. The best is to test yourself ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:

I rewrote Py_Main() in two large commits. The code isn't perfect yet, for 
example, init_sys_streams() still reads the PYTHONIOENCODING environment 
variable. IMHO it should be read earlier. But as soon, my changes should allow 
to fix such issues much more easily.

Since I was now able to implement my -X dev option in bpo-32043, I don't plan 
to push further changes in short term on Py_Main().

I keep this issue open a little bit to check if everything is fine on 
buildbots, and check if someone has complains :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32043] Add a new -X dev option: "developer mode"

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:

I rewrote Py_Main() in bpo-32030 to make it very easy to implement this new 
feature.

I wrote PR 4413 to implement -X dev.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32043] Add a new -X dev option: "developer mode"

2017-11-15 Thread STINNER Victor

Change by STINNER Victor :


--
keywords: +patch
pull_requests: +4363
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32043] Add a new -X dev option: "developer mode"

2017-11-15 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32043] Add a new -X dev option: "developer mode"

2017-11-15 Thread STINNER Victor

New submission from STINNER Victor :

I propose to add a new "developer mode": a new "-X dev" command line option.

In short:
   python3 -X dev script.py
behaves as:
   PYTHONMALLOC=debug python3 -W default -X faulthandler script.py

For the rationale, please see:
https://mail.python.org/pipermail/python-dev/2017-November/150514.html

--
components: Interpreter Core
messages: 306330
nosy: haypo
priority: normal
severity: normal
status: open
title: Add a new -X dev option: "developer mode"
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset a7368ac6360246b1ef7f8f152963c2362d272183 by Victor Stinner in 
branch 'master':
bpo-32030: Enhance Py_Main() (#4412)
https://github.com/python/cpython/commit/a7368ac6360246b1ef7f8f152963c2362d272183


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:

Nick:
"""
I noticed the other day that the interaction between PYTHONWARNINGS, the `-W` 
option, sys.warnoptions, and _warnings.filters is a bit confusing:


$ PYTHONWARNINGS=always,default python3 -Wignore -Wonce
(...)
>>> sys.warnoptions
['always', 'default', 'ignore', 'once']
>>> [f[0] for f in _warnings.filters[:4]]
['once', 'ignore', 'default', 'always']
"""

IMHO the command line must have the priority over environment variables, since 
environment variables are inherited, whereas the command line can be finely 
tuned *on purpose*. So it's correct, no? It's just that warnoptions gives 
options in the reverse order than the "expected" order, no?

At least, with my commit, if you want to try to change the priority, you just 
have to exchange two lines in pymain_add_warnings_options() :-)

if (pymain_add_warnings_optlist(>env_warning_options) < 0) ...
if (pymain_add_warnings_optlist(>cmdline.warning_options) < 0) ...

--

By the way, I'm not sure that it was a good idea to expose sys.warnoptions to 
users, but I don't think that we can remove it anymore :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32039] timeit documentation should describe caveats

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:

Barry: "... possibly point to both cProfile and the 3rd party perf package as 
alternative ways to gather performance information."

FYI the timeit module of PyPy now emits a warning and points to the perf 
module: http://perf.readthedocs.io/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31415] Add -X option to show import time

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:

FYI I'm working on the Py_Main() function in bpo-32030. My latest PR (PR 4412) 
moves the code to parse -X importtime and PYTHONPROFILEIMPORTTIME into 
Py_Main(), to group all functions parsing the command line arguments and 
environment variables.

With this change, the "importtime" option is now checked before the very first 
"Python" function call.

The new code doesn't use the sys module anymore to parse -X options, and so 
break the dependency between "importtime", the import machinery and the sys 
module.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-15 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4362

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32041] Cannot cast '\0' to c_void_p

2017-11-15 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

I have fixed that problem by ensuring that ctypes-facing code passes bytes, not 
strings.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset f35076a002b958f991d180d6f945344cc5ab3900 by Yury Selivanov (Miss 
Islington (bot)) in branch '3.6':
bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable GH-4409 
(#4411)
https://github.com/python/cpython/commit/f35076a002b958f991d180d6f945344cc5ab3900


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32041] Cannot cast '\0' to c_void_p

2017-11-15 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

That's the change that introduced the bug: 
https://github.com/python/cpython/pull/2285

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32042] Option for comparing values instead of reprs in doctest

2017-11-15 Thread R. David Murray

R. David Murray  added the comment:

I think it is an interesting idea.  Let see what other people think.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset f7e5b56c37eb859e225e886c79c5d742c567ee95 by Victor Stinner in 
branch 'master':
bpo-32030: Split Py_Main() into subfunctions (#4399)
https://github.com/python/cpython/commit/f7e5b56c37eb859e225e886c79c5d742c567ee95


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32042] Option for comparing values instead of reprs in doctest

2017-11-15 Thread Tomáš Petříček

Tomáš Petříček  added the comment:

The following tests then succeed:

def str_fun():
"""
>>> str_fun()
'foo'
>>> str_fun()
"foo"
>>> str_fun()
'''foo'''
"""
return 'foo'


def dict_fun():
"""
>>> dict_fun()
{'foo': 1, 'bar': 2}
>>> dict_fun()
{'bar': 2, 'foo': 1}
>>> dict_fun()
dict(foo=1, bar=2)
"""
return {'foo': 1, 'bar': 2}


if __name__ == '__main__':
import doctest
doctest.testmod(verbose=True, optionflags=doctest.ACCEPT_EQUAL_VALUES)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32042] Option for comparing values instead of reprs in doctest

2017-11-15 Thread Tomáš Petříček

Tomáš Petříček  added the comment:

This option can be seen as a more general case of the options already available 
which lift the requirement of exact representation match (True for 1, normalize 
whitespace etc.). It would enable easier testing of relevant behavior instead 
of repr's artifacts.

An implementation draft is at 
https://github.com/tpet/cpython/commit/e59cc2d2c854f5995c36a60410eca0e893a7e269

As the expected value has to be reconstructed from the string representation 
anyway, it seems reasonable to do that for both values (expected and got). Only 
minor modifications seem to be required in that case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32042] Option for comparing values instead of reprs in doctest

2017-11-15 Thread Tomáš Petříček

Tomáš Petříček  added the comment:

Related to https://bugs.python.org/issue3332

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32036] error mixing positional and non-positional arguments with `argparse`

2017-11-15 Thread R. David Murray

R. David Murray  added the comment:

Ah, yes, I'd managed to forget about that issue, even though I was the one that 
finally committed the fix.

So, the alternate parser will be in 3.7.  In the meantime you can grab the code 
from the commit and put it in a local file, I think.  You'll doubtless have to 
tweak a few things to use it that way, but it should be fairly straightforward.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread Yury Selivanov

Change by Yury Selivanov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4361

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 43605e6bfa8d49612df4a38460d063d6ba781906 by Yury Selivanov in 
branch 'master':
bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable #4409
https://github.com/python/cpython/commit/43605e6bfa8d49612df4a38460d063d6ba781906


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32039] timeit documentation should describe caveats

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32039] timeit documentation should describe caveats

2017-11-15 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Nov 15, 2017, at 17:00, Serhiy Storchaka  wrote:
> 
> +1 to all said by Raymond. But this is rather the matter of a special article 
> or blog post than a note in the documentation.

Maybe a HOWTO on performance testing and analysis?  We already have one on 
instrumenting with DTRACE/SystemTap, and we could point the timeit docs to this 
new HOWTO.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32039] timeit documentation should describe caveats

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

+1 to all said by Raymond. But this is rather the matter of a special article 
or blog post than a note in the documentation.

Other example of caching is regular expressions.

Mistakes:

python3 -m timeit -s "it = iter(range(10))" "next(it)"

python3 -m timeit -s "a = []" "a.append(1)"

I remember one non-obvious trap in which I got caught. The performance of the 
iteration of a dict was influenced by the fact that in new dicts the order of 
iteration coincided with the order of creating keys, which were allocated 
sequentially in memory. Thus refcounts were touched in adjacent objects. This 
usually is not happen in real programs.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32025] Add time.thread_time()

2017-11-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 4bd41c9b52ea0c730e9e294caaf003e54c088c6e by Antoine Pitrou in 
branch 'master':
bpo-32025: Add time.thread_time() (#4410)
https://github.com/python/cpython/commit/4bd41c9b52ea0c730e9e294caaf003e54c088c6e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31701] faulthandler dumps 'Windows fatal exception: code 0xe06d7363'

2017-11-15 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

Victor,

Does this change imply that no python-traceback-for-every-thread will be 
printed upon both handled and unhandled C++ exception?

--
nosy: +Ilya.Kulakov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32042] Option for comparing values instead of reprs in doctest

2017-11-15 Thread Tomáš Petříček

New submission from Tomáš Petříček :

Would there be an interest and possibility to add an option to the doctest 
module to compare values instead of reprs? The idea is that the expected value 
would be eval'ed prior to comparison if this option was enabled.

Motivation for this option is to enable comparison of values (states) as 
defined in the respective classes and not by a representation which might vary 
({'a', 'b'} vs {'b', 'a'}, 'value' vs "value" etc.).

--
components: Library (Lib), Tests
messages: 306311
nosy: Tomáš Petříček
priority: normal
severity: normal
status: open
title: Option for comparing values instead of reprs in doctest
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32039] timeit documentation should describe caveats

2017-11-15 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Other caveats:

* The tight, repeated loops tend to have perfect branch prediction rates and 
100% L1 cache hit rates that are rarely present in real code.  

  There should be links to why this matters:

   - https://stackoverflow.com/questions/11227809
   - 
https://www.extremetech.com/extreme/188776-how-l1-and-l2-cpu-caches-work-and-why-theyre-an-essential-part-of-modern-chips

* Code timing list.append() or anything else that uses realloc() internally 
tends to be timing in clean environments where the realloc() extends in-place 
rather than recopying all the data.  This is almost never true in real code.

* Constant folding can produce misleading results.  

  To time addition, use:

  python -m timeit -s "x=2" "x+3"

  rather than:

  python -m timeit "2+3"

* Timings include global lookups, attribute lookups, and function call overhead 
in addition to the operation being timed.

  Use:

  python -m timeit -s "s=list(range(20))" -s "s_index=s.index" "s_index(5)"

  rather than:

  python -m timeit -s "s=list(range(20))"  "s.index(5)"

* Comparative timings should be repeated and interleaved to show whether the 
timings are noisy or have been affected the processor switching to a lower 
clock speed to avoid overheating:

  time a
  time b
  time a # expect this to be consistent with the first *a* timing
  time b # expect this to be consistent with the first *b* timing

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26579] Support pickling slots in subclasses of common classes

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -4360

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26579] Support pickling slots in subclasses of common classes

2017-11-15 Thread Yury Selivanov

Change by Yury Selivanov :


--
pull_requests: +4360

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32025] Add time.thread_time()

2017-11-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 15/11/2017 à 22:06, STINNER Victor a écrit :
> 
> I can work on the macOS implementation, once your PR will be merged.

Great!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32025] Add time.thread_time()

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:

I can work on the macOS implementation, once your PR will be merged.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32041] Cannot cast '\0' to c_void_p

2017-11-15 Thread Ilya Kulakov

New submission from Ilya Kulakov :

Happens on 3.6.3 only:

>>> import ctypes
>>> ctypes.cast('\0', ctypes.c_void_p)
ctypes.ArgumentError: argument 1: : embedded null character

--
components: ctypes
messages: 306307
nosy: Ilya.Kulakov
priority: normal
severity: normal
status: open
title: Cannot cast '\0' to c_void_p
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32040] Sorting pahtlib.Paths does give the same order as sorting the (string) filenames of that pathlib.Paths

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Paths are ordered by lexicographical order of their corresponding components. 
Paths are not strings, and this this order is more natural for them.

The alphabetical order of Path strings:

SPAMS.txt
SPAM\file.txt

spam\file.txt
spams.txt

spam-file.txt
spam/file.txt
spam_file.txt

The lexicographical order of Path components:

SPAM\file.txt
SPAMS.txt

spam\file.txt
spams.txt

spam/file.txt
spam-file.txt
spam_file.txt

--
nosy: +serhiy.storchaka
resolution:  -> not a bug

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

There is the same issue with LimitOverrunError.

I'm not sure that we should keep args the same. It affects __str__ and 
__repr__. badouxn overrides __str__. And the result of __repr__ currently looks 
like the exception constructor, but actually is not compatible with it.

>>> IncompleteReadError(b'abc', 10)
IncompleteReadError('3 bytes read on a total of 10 expected bytes',)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32040] Sorting pahtlib.Paths does give the same order as sorting the (string) filenames of that pathlib.Paths

2017-11-15 Thread QbLearningPython

New submission from QbLearningPython :

While testing a module, I have found a weird behaviour of pathlib package. I 
have a list of pathlib.Paths and I sorted() it. I assumed that the order 
retrieved by sorting a list of Paths would be the same as the order retrieved 
by sorting the list of their corresponding (string) filenames. But it is not 
the case.

I run the following example:


==


from pathlib import Path

# order string filenames

filenames_for_testing = (
'/spam/spams.txt',
'/spam/spam.txt',
'/spam/another.txt',
'/spam/binary.bin',
'/spam/spams/spam.ttt',
'/spam/spams/spam01.txt',
'/spam/spams/spam02.txt',
'/spam/spams/spam03.ppp',
'/spam/spams/spam04.doc',
)

sorted_filenames = sorted(filenames_for_testing)

# output ordered list of string filenames

print()
print("Ordered list of string filenames:")
print()
[print(f'\t{element}') for element in sorted_filenames]
print()

# order paths (build from same string filenames)

paths_for_testing = [
Path(filename)
for filename in filenames_for_testing
]
sorted_paths = sorted(paths_for_testing)

# outoput ordered list of pathlib.Paths

print()
print("Ordered list of pathlib.Paths:")
print()
[print(f'\t{element}') for element in sorted_paths]
print()

# compare

print()

if sorted_filenames == [str(path) for path in sorted_paths]:
print('Ordered lists of string filenames and pathlib.Paths are EQUAL.')

else:
print('Ordered lists of string filenames and pathlib.Paths are DIFFERENT.')

for element in range(0, len(sorted_filenames)):

if sorted_filenames[element] != str(sorted_paths[element]):

print()
print('First different element:')
print(f'\tElement #{element}')
print(f'\t{sorted_filenames[element]} != {sorted_paths[element]}')
break

print()



==


The output of this script was:


==

Ordered list of string filenames:

/spam/another.txt
/spam/binary.bin
/spam/spam.txt
/spam/spams.txt
/spam/spams/spam.ttt
/spam/spams/spam01.txt
/spam/spams/spam02.txt
/spam/spams/spam03.ppp
/spam/spams/spam04.doc


Ordered list of pathlib.Paths:

/spam/another.txt
/spam/binary.bin
/spam/spam.txt
/spam/spams/spam.ttt
/spam/spams/spam01.txt
/spam/spams/spam02.txt
/spam/spams/spam03.ppp
/spam/spams/spam04.doc
/spam/spams.txt


Ordered lists of string filenames and pathlib.Paths are DIFFERENT.

First different element:
Element #3
/spam/spams.txt != /spam/spams/spam.ttt


==


As you can see, 'spam/spams.txt' goes in different places if you have sorted by 
pathlib.Paths than if you have sorted by string filenames.

I think that it is weird that sorting pathlib.Paths yields a different result 
than sorting their string filenames. I think that pathlib.Paths should be 
ordered by alphabetical order of their corresponding filenames.

Thank you.

--
components: Extension Modules
messages: 306304
nosy: QbLearningPython
priority: normal
severity: normal
status: open
title: Sorting pahtlib.Paths does give the same order as sorting the (string) 
filenames of that pathlib.Paths
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32039] timeit documentation should describe caveats

2017-11-15 Thread Barry A. Warsaw

New submission from Barry A. Warsaw :

timeit is cool, but it's not appropriate for all performance testing.  For 
example, since it uses only a single Python process, anything that's cached is 
not a good candidate for timeit profiling.  The classic example is timing 
imports.  E.g. these are not the stats you're looking for:

$ python3 -mtimeit "import my.slow.module"

The timeit documentation should describe this caveat (are there others?) and 
possibly point to both cProfile and the 3rd party perf package as alternative 
ways to gather performance information.

--
assignee: barry
components: Documentation
messages: 306303
nosy: barry
priority: normal
severity: normal
status: open
title: timeit documentation should describe caveats
versions: Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32036] error mixing positional and non-positional arguments with `argparse`

2017-11-15 Thread Stefan Seefeld

Stefan Seefeld  added the comment:

It looks like https://bugs.python.org/issue14191 is a conversation about the 
same inconsistent behaviour. It is set to "fixed". Can you comment on this ? 
Should I follow the advice mentioned there about how to work around the issue ?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32038] Add API to intercept socket.close()

2017-11-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Ok, that sounds reasonable to me.  Also cc'ing Ben Darnell (maintainer of 
Tornado) in case he wants to chime in.

--
nosy: +Ben.Darnell

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32038] Add API to intercept socket.close()

2017-11-15 Thread Yury Selivanov

Yury Selivanov  added the comment:

> Why not instead add `loop.sock_close()`?

It wouldn't help if the program calls `socket.close()` somewhere.  This can 
happen easily in big code bases.

Ideally (at least I think so) we need to provide a guarantee that the socket 
object can't be closed at all (or be closed in a controlled manner) if it's 
being operated by asyncio/event-loop.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32025] Add time.thread_time()

2017-11-15 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
keywords: +patch
pull_requests: +4359
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32038] Add API to intercept socket.close()

2017-11-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Why not instead add `loop.sock_close()`?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32038] Add API to intercept socket.close()

2017-11-15 Thread Yury Selivanov

New submission from Yury Selivanov :

asyncio has a few APIs that accept a Python socket object: loop.sock_recv(), 
loop.sock_accept() etc.

asyncio (and event loops such as uvloop) expect that it controls the socket for 
the duration of the call.  However, it cannot prevent the socket object from 
being closing *while* it is working with it:

loop = asyncio.get_event_loop()
sock = socket.socket()
sock.connect(('google.com', 80))
sock.setblocking(0)
f = loop.sock_recv(sock, 100)
sock.close()
await f

The above snippet makes asyncio to forever try to read from 'sock' (resource 
leak).  uvloop simply segfaults (at least on Linux) because libuv assumes that 
sockets can't be closed while it's working with them.

Same problem exists when a user calls `loop.create_server(sock=sock)` and later 
manually calls `sock.close()`.

My proposal is to add a new API: `socket.register_close(callback)`.  `callback` 
will be called whenever a socket object is about to be closed.

This will enable asyncio and uvloop to detect when sockets they are working 
with are about to be closed and to either raise an error, log a debug line, 
or/and to stop polling the socket.

See also: https://github.com/MagicStack/uvloop/issues/100

--
components: IO, asyncio
messages: 306298
nosy: asvetlov, gvanrossum, pitrou, yselivanov
priority: normal
severity: normal
status: open
title: Add API to intercept socket.close()
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread Yury Selivanov

Yury Selivanov  added the comment:

> Does such a fix looks correct to you ?

No, this fix won't restore exception.args properly.  I made a PR with a fix.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread Yury Selivanov

Change by Yury Selivanov :


--
pull_requests: +4358

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32018] inspect.signature does not respect PEP 8

2017-11-15 Thread Yury Selivanov

Change by Yury Selivanov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32018] inspect.signature does not respect PEP 8

2017-11-15 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 762b9571c9c8c6b036f1bf90140a1d030b3f9a01 by Yury Selivanov 
(Dong-hee Na) in branch 'master':
bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)
https://github.com/python/cpython/commit/762b9571c9c8c6b036f1bf90140a1d030b3f9a01


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32018] inspect.signature does not respect PEP 8

2017-11-15 Thread Dong-hee Na

Dong-hee Na  added the comment:

I've submitted a patch. :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32036] error mixing positional and non-positional arguments with `argparse`

2017-11-15 Thread Stefan Seefeld

Stefan Seefeld  added the comment:

On 15.11.2017 12:54, R. David Murray wrote:
> Can you reproduce this without your PosArgsParser?
I can indeed (by simply commenting out the `action` argument to the
`add_argument()` calls).
That obviously results in all positional arguments being accumulated in
the `goal` member, as there is no logic to distinguish `a` from `a=b`
semantically.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32021] Brotli encoding is not recognized by mimetypes

2017-11-15 Thread R. David Murray

R. David Murray  added the comment:

OK, bouncing around from those URL I finally found this:

https://github.com/google/ngx_brotli/issues/28

That indicates unambiguously that someone does expect files to be 
pre-compressed on the server and that the main brotli package provides a cli 
tool (I could not find any reference to that in the brotli docs themselves, 
such as they are).

So, I think it is appropriate to add this, and one can hope that the program 
name is indeed 'brotli' so that it matches up with the existing mimetypes docs 
:)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread badouxn

badouxn  added the comment:

Typo in the last comment. The code should be:

'''
 def __init__(self, partial, expected):
 super().__init__(partial, expected)
 self.partial = partial
 self.expected = expected
 def __str__(self):
 return ("%d bytes read on a total of %r expected bytes" % 
(len(self.partial), self.expected))
'''

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32036] error mixing positional and non-positional arguments with `argparse`

2017-11-15 Thread R. David Murray

R. David Murray  added the comment:

Can you reproduce this without your PosArgsParser?

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32018] inspect.signature does not respect PEP 8

2017-11-15 Thread Dong-hee Na

Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32033] The pwd module implementation incorrectly sets some attributes to None

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I disagree. This is an old API, a thin wrapper around standard POSIX API, and 
returning an empty string instead of None will make impossible to distinguish 
NULL from "".

It is easy to convert None in an empty string in Python: `value or ''`.

I would change the test to

if field is not None:
self.assertIsInstance(field, str)

or

self.assertIsInstance(field, (str, type(None)))

(I prefer the former variant).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32018] inspect.signature does not respect PEP 8

2017-11-15 Thread Dong-hee Na

Change by Dong-hee Na :


--
keywords: +patch
pull_requests: +4357
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread badouxn

badouxn  added the comment:

My first fix was indeed wrong. 
Upon looking further into it, it seems to me that the problem come from the 
fact that the call to super is not done with the right argument. 
Upon unpickling, the argument that will be passed to the __init__ is the string 
representation built on line 33-34.
That's why, when leaving expected as optional the number returned is 44, the 
length of the string. 

I went looking for similar Exception class in the code base and found the 
MaybeEncodingError in multiprocessing/pool.py 

By replacing the Error content with this one I don't have any error anymore. 
The message is kept identical. 
'''
 def __init__(self, partial, expected):
 super().__init__(partial, expected)
 self.partial = partial
 self.expected = expected
 def __str__(self):
 return ("%d bytes read on a total of %r expected bytes" % 
(len(partial), expected))
'''

Does such a fix looks correct to you ?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32030] PEP 432: Rewrite Py_Main()

2017-11-15 Thread STINNER Victor

STINNER Victor  added the comment:

I wrote a new "_PyInitError" type to report more information when something 
goes wrong:

* indicate if it's an user error: don't abort() in that case
* function name where the error was raised
* error message

Example:
---
$ PYTHONHASHSEED=x ./python
Fatal Python error: _Py_HashRandomization_Init: PYTHONHASHSEED must be "random" 
or an integer in range [0; 4294967295]
---

=> Python doesn't fail with abort() anymore
=> notice the new "_Py_HashRandomization_Init" function name which gives 
context to the error message


Previously, Python called abort() and so might dump a core file:
---
$ PYTHONHASHSEED=x python3
Fatal Python error: PYTHONHASHSEED must be "random" or an integer in range [0; 
4294967295]

Aborted (core dumped)
---

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32026] Memory leaks in Python on Windows

2017-11-15 Thread Steve Dower

Steve Dower  added the comment:

I don't think the refleak handling would detect leaks across 
PyInitialize/PyFinalize calls anyway.

Really, we probably just need to loop Initialize/Finalize a few hundred times 
and measure the memory usage of the process before/after. That will handle a 
range of leaks, though it doesn't necessarily help us track them down.

--
stage:  -> test needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32033] The pwd module implementation incorrectly sets some attributes to None

2017-11-15 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

> I'm not sure that it's very useful to distinguish NULL and an empty char* 
> string.

I agree. An attribute of a ('pwd' Python module) password database entry 
corresponds to the field of a line in a 'passwd' text file. So it makes sense 
that when the field is empty in the text file, the corresponding attribute be 
an empty string and never None if it is not an integer (FWIW Android does not 
have a 'passwd' file).

Changing the title of the issue.

--
components:  -Tests
title: The pwd test test_values fails on Android -> The pwd module 
implementation incorrectly sets some attributes to None
versions: +Python 2.7, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32037] Pickle 32-bit integers with protocol 0 as INT instead of LONG

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +4356
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32037] Pickle 32-bit integers with protocol 0 as INT instead of LONG

2017-11-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

In Python 3 different opcodes are used for pickling integers with protocol 1 
and higher. But pickling with protocol 0 always uses the LONG opcode. In Python 
all such integers are unpickled to the long instances.

Proposed PR makes integers that fit in a signed 32-bit integer be pickled with 
the INT opcode. This will decrease the size of a pickle (minus one byte 'L' per 
integer), speeds up pickling and unpickling, and makes these integers be 
unpickled to int instances in Python 2, that will save a memory.

--
assignee: serhiy.storchaka
components: Library (Lib)
messages: 306285
nosy: alexandre.vassalotti, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Pickle 32-bit integers with protocol 0 as INT instead of LONG
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31983] Officially add Py_SETREF and Py_XSETREF

2017-11-15 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Adding my -1.   My experience was that these macros impaired my ability to 
maintain the code and interfered with useful patterns like delaying all decrefs 
until an object was in a consistent state.

While I know that name was bikeshedded quite a bit, the outcome is rather 
unintuitive:  https://twitter.com/raymondh/status/930535938459025408

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32036] error mixing positional and non-positional arguments with `argparse`

2017-11-15 Thread Stefan Seefeld

New submission from Stefan Seefeld :

I'm trying to mix positional and non-positional arguments with a script using 
`argparse`, but I observe inconsistent behaviour.
The attached test runs fine when invoked with

test_argparse.py --info a a=b
test_argparse.py a a=b --info

but produces the error `error: unrecognized arguments: a=b` when invoked as

test_argparse.py a --info a=b

Is this intended behaviour ? If yes, is this documented ? If not, is there a 
way to make this work with existing `argparse` versions ?

--
components: Library (Lib)
files: test_argparse.py
messages: 306283
nosy: stefan
priority: normal
severity: normal
status: open
title: error mixing positional and non-positional arguments with `argparse`
type: behavior
Added file: https://bugs.python.org/file47268/test_argparse.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30143] Using collections ABC from collections.abc rather than collections in 2to3 converted code

2017-11-15 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

+1 I think this change will be essential.  IIRC, elsewhere Guido approved a 3.7 
change so that the ABC will no longer be visible in collections.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32011] Restore loading of TYPE_INT64 in marshal

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset d15bb5fcad584e113836486d17c6abcbf2168a86 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-32011: Revert "Issue GH-15480: Remove the deprecated and unused TYPE_INT64 
code from marshal." (GH-4381) (#4405)
https://github.com/python/cpython/commit/d15bb5fcad584e113836486d17c6abcbf2168a86


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31949] Bugs in PyTraceBack_Print()

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31949] Bugs in PyTraceBack_Print()

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 3864248866d6224336c7be49670447cb4d125cd6 by Serhiy Storchaka in 
branch '3.6':
[3.6] bpo-31949: Fixed several issues in printing tracebacks 
(PyTraceBack_Print()). (GH-4289) (#4406)
https://github.com/python/cpython/commit/3864248866d6224336c7be49670447cb4d125cd6


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32011] Restore loading of TYPE_INT64 in marshal

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30143] Using collections ABC from collections.abc rather than collections in 2to3 converted code

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What are your thoughts about this Benjamin?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32023] Always require parentheses for genexps in base class lists

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30399] Get rid of trailing comma in the repr() of BaseException

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30399] Get rid of trailing comma in the repr() of BaseException

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset f8a4c03ede6048022f60a58d5a21b278b78a8a16 by Serhiy Storchaka in 
branch 'master':
bpo-30399: Get rid of trailing comma in the repr of BaseException. (#1650)
https://github.com/python/cpython/commit/f8a4c03ede6048022f60a58d5a21b278b78a8a16


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30950] Convert round() to Arument Clinic

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
dependencies:  -Documentation for round() is incorrect.
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30950] Convert round() to Arument Clinic

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset aca7f574b06c72c85a5e3e4b16a8a5e384a7c4a8 by Serhiy Storchaka in 
branch 'master':
bpo-30950: Convert round() to Argument Clinic. (#2740)
https://github.com/python/cpython/commit/aca7f574b06c72c85a5e3e4b16a8a5e384a7c4a8


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31949] Bugs in PyTraceBack_Print()

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4355

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32011] Restore loading of TYPE_INT64 in marshal

2017-11-15 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4354

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32011] Restore loading of TYPE_INT64 in marshal

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 00987f6230fcdbecc8d9ab4b2b9fae8f99a1a4a9 by Serhiy Storchaka in 
branch 'master':
bpo-32011: Revert "Issue #15480: Remove the deprecated and unused TYPE_INT64 
code from marshal." (#4381)
https://github.com/python/cpython/commit/00987f6230fcdbecc8d9ab4b2b9fae8f99a1a4a9


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32023] Always require parentheses for genexps in base class lists

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset ddbce1378644f9d5ad0651e1c9035bd8c6502edc by Serhiy Storchaka in 
branch 'master':
bpo-32023: Disallow genexprs without parenthesis in class definitions. (#4400)
https://github.com/python/cpython/commit/ddbce1378644f9d5ad0651e1c9035bd8c6502edc


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31949] Bugs in PyTraceBack_Print()

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset edad8eebeee3c99e324a7f1ac5073167c2b0b54d by Serhiy Storchaka in 
branch 'master':
bpo-31949: Fixed several issues in printing tracebacks (PyTraceBack_Print()). 
(#4289)
https://github.com/python/cpython/commit/edad8eebeee3c99e324a7f1ac5073167c2b0b54d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31807] unitest.mock: Using autospec=True conflicts with 'wraps'

2017-11-15 Thread Lukas Anzinger

Lukas Anzinger  added the comment:

I can reproduce the problem and have analyzed it a bit. My use case is a bit 
different, I want to use autospec=True and wraps= so that I can mock unbound 
methods but return the result from the original method (see also 
https://docs.python.org/3/library/unittest.mock-examples.html#mocking-unbound-methods).

The problem in the mock code is that mock.return_value actually calls 
__get_return_value() which replaces the actual return value mock.DEFAULT (which 
is stored in self._mock_return_value) with a new child mock. When the mock is 
then called and _mock_call() is executed, the wrapped function is not executed 
because self._mock_return_value is not mock.DEFAULT anymore:


if (self._mock_wraps is not None and
 self._mock_return_value is DEFAULT):
return self._mock_wraps(*args, **kwargs)
if ret_val is DEFAULT:
ret_val = self.return_value
return ret_val


Since self._mock_return_value is not DEFAULT anymore it doesn't matter if the 
mock wraps something and it will instead just return a new mock.

I think that the side effect of the assignment to self.return_value in 
_setup_func() is not intentional, i.e. the child mock should actually be 
created only if there is an outside access to return_value, but not when it is 
just wrapped in a function. The assignment can be made side effect free by 
assigning the internal attribute _mock_return_value (see attached patch). This 
solves the problem for me.
 
I've attached a patch that fixes the problem and doesn't seem to introduce a 
regression (all unittest.mock tests pass).

If somebody is interested in getting this merged, I'm happy to provide a 
regression test and everything else that is needed to get this merged.

Cheers,

Lukas

--
keywords: +patch
nosy: +Lukas Anzinger
versions: +Python 3.7
Added file: 
https://bugs.python.org/file47267/0001-bpo-31807-unittest.mock-Fix-common-use-of-autospec-T.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31817] Compilation Error with Python 3.6.1/3.6.3 with Tkinter

2017-11-15 Thread Josh Cullum

Josh Cullum  added the comment:

Hi Ned,

Tried that but unfortunately it didn't work. It still produces an error within 
the make install function which then re-removes the module - it does however 
create a folder called tkinter.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32035] Documentation of zipfile.ZipFile().writestr() fails to mention that 'data' may also be bytes

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +easy
stage:  -> needs patch
type:  -> enhancement
versions:  -Python 3.4, Python 3.5, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32035] Documentation of zipfile.ZipFile().writestr() fails to mention that 'data' may also be bytes

2017-11-15 Thread Daniel

New submission from Daniel :

The documentation for "ZipFile.writestr(zinfo_or_arcname, data[, 
compress_type])" says: "Write the string data to the archive; [...]"
--> https://docs.python.org/3/library/zipfile.html

I fails to mention that data could also be bytes.

The source code does mention it however, that is how I found out:

def writestr(self, zinfo_or_arcname, data, compress_type=None):
"""Write a file into the archive.  The contents is 'data', which
may be either a 'str' or a 'bytes' instance; if it is a 'str',
it is encoded as UTF-8 first.
'zinfo_or_arcname' is either a ZipInfo instance or
the name of the file in the archive."""

I believe this should be added to the documentation as it's an important 
information to those who try to add non-UTF8 StringIO data to in-memory 
ZipFiles using BytesIO.

--
assignee: docs@python
components: Documentation
messages: 306271
nosy: Daniel5148, docs@python
priority: normal
severity: normal
status: open
title: Documentation of zipfile.ZipFile().writestr() fails to mention that 
'data' may also be bytes
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This isn't so simple.

>>> from asyncio.streams import IncompleteReadError
>>> import pickle
>>> e1 = IncompleteReadError(b'abc', 10)
>>> e2 = pickle.loads(pickle.dumps(e1))
>>> print(e1)
3 bytes read on a total of 10 expected bytes
>>> print(e2)
44 bytes read on a total of None expected bytes

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27494] 2to3 parser failure caused by a comma after a generator expression

2017-11-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Since this syntax never was valid according to the Python language 
specification, and it causes SyntaxError in 3.7 (see issue32012), I think that 
this change should be reverted.

--
resolution: fixed -> 
stage: resolved -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32032] Module-level pickle tests test only default implementation

2017-11-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32034] Error when unpickling IncompleteReadError

2017-11-15 Thread badouxn

Change by badouxn :


--
keywords: +patch
pull_requests: +4353
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >