[issue29694] race condition in pathlib mkdir with flags parents=True

2017-03-06 Thread Armin Rigo

Armin Rigo added the comment:

A different bug in the same code: if someone creates the directory itself 
between the two calls to ``self._accessor.mkdir(self, mode)``, then the 
function will fail with an exception even if ``exist_ok=True``.

Attached is a patch that fixes both cases.

--
keywords: +patch
nosy: +arigo
Added file: http://bugs.python.org/file46707/x1.diff

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Are there tests for accepting non-integers in other classes? If no then don't 
bother about tests. I suppose all this came from the implementation of the 'n' 
format unit in PyArg_Parse* functions.

--

___
Python tracker 

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



[issue25996] Add support of file descriptor in os.scandir()

2017-03-06 Thread Eryk Sun

Eryk Sun added the comment:

> There is no similar function taking a directory handle

In 3.5+ the CRT has O_OBTAIN_DIR (0x2000) for opening a directory, i.e. to call 
CreateFile with backup semantics. A directory can be read via 
GetFileInformationByHandleEx [1] using the information classes 
FileIdBothDirectoryRestartInfo and FileIdBothDirectoryInfo. This info class is 
just a simplified wrapper around the more powerful system call 
NtQueryDirectoryFile [2]. 

The implementation details could be hidden behind _Py_opendir, _Py_fdopendir, 
_Py_readdir, and _Py_closedir -- allowing a common implementation of the 
high-level listdir() and scandir() functions. I wrote a ctypes prototype of 
listdir() along these lines.

One feature that's lost in using GetFileInformationByHandleEx to list a 
directory is the ability to do wildcard filtering. However, Python listdir and 
scandir never uses wildcard filtering, so it's no real loss. FindFirstFile 
implements this feature via the FileName parameter of NtQueryDirectoryFile. 
First it translates DOS wildcards to NT's set of 5 wildcards. There's the 
native NT '*' and '?', plus the quirky semantics of MS-DOS via '<', '>', and 
'"', i.e. DOS_STAR, DOS_QM, and DOS_DOT. See FsRtlIsNameInExpression [3] for a 
description of these wildcard characters. 

[1]: https://msdn.microsoft.com/en-us/library/aa364953
[2]: https://msdn.microsoft.com/en-us/library/ff567047
[3]: https://msdn.microsoft.com/en-us/library/ff546850

--
nosy: +eryksun

___
Python tracker 

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



[issue29739] zipfile raises wrong exception for some incorrect passwords

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

ZIP file has something like 8-bit control sum for checking the validity of the 
password. With the chance 1/256 the check is passed for wrong password. This is 
unavoidable.

--

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Other objects in the io module use special-purposed converter 
_PyIO_ConvertSsize_t() which checks PyNumber_Check() and calls 
PyNumber_AsSsize_t().

I think StringIO implementation can be changed to reuse _PyIO_ConvertSsize_t() 
for simplicity.

After that BytesIO implementation can be changed to use the same converter just 
for uniformity.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29737] Optimize concatenating empty tuples

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I agree with your comments Raymond, but let me to expose my reasons.

An idea of optimizing empty tuple concatenating is inspired by partial(). It 
concatenates two tuples of arguments and it is common when one of tuple is 
empty. Current C implementation makes special case for this (and does this 
suboptimal). With optimized empty tuple concatenating it could be simpler and 
more efficient. Even when C implementation of partial() will not use this 
feature (see issue29735), I hope it can help in Python implementation of 
partial() and other partial-like functions.

--

___
Python tracker 

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



[issue29676] C method is not profiled by lsprof

2017-03-06 Thread INADA Naoki

Changes by INADA Naoki :


--
resolution:  -> fixed
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



[issue29680] gdb/libpython.py does not work with gdb 7.2

2017-03-06 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +442

___
Python tracker 

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



[issue28728] test_host_resolution in test_socket fails

2017-03-06 Thread Xiang Zhang

Changes by Xiang Zhang :


--
resolution:  -> fixed
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



[issue29176] /tmp does not exist on Android and is used by curses.window.putwin()

2017-03-06 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +441

___
Python tracker 

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



[issue29744] memmap behavior changed

2017-03-06 Thread Xiang Zhang

Changes by Xiang Zhang :


--
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



[issue29739] zipfile raises wrong exception for some incorrect passwords

2017-03-06 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28728] test_host_resolution in test_socket fails

2017-03-06 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +440

___
Python tracker 

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



[issue29737] Optimize concatenating empty tuples

2017-03-06 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Is it at all common to concatenate empty tuples?  This seems like optimizing 
something that rarely occurs.

Also, the timings can be misleading if in real code these changes cause new 
branch mispredictions here which can slow the common case.  See 
http://stackoverflow.com/questions/11227809

--
nosy: +rhettinger

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-06 Thread Oren Milman

Oren Milman added the comment:

I don't have a use case for that. (I noticed this behavior by
chance, while working on some other issue.)

However, IIUC, commit 4fa88fa0ba35e25ad9be66ebbdaba9aca553dc8b,
by Benjamin Peterson, Antoine Pitrou and Amaury Forgeot d'Arc,
includes patching the aforementioned StringIO functions, so that
they would accept integer types.
So I add them to the nosy list, as I guess that the use cases for
accepting integer types in StringIO methods are also use cases
for accepting integer types in BytesIO.

And now that you mention the docs, according to them, both StringIO
and BytesIO inherit these methods from BufferedIOBase or IOBase.
Thus, the methods are already expected to behave the same, aren't
they?

--
nosy: +amaury.forgeotdarc, benjamin.peterson, pitrou

___
Python tracker 

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



[issue29744] memmap behavior changed

2017-03-06 Thread Andrea Giovannucci

Changes by Andrea Giovannucci :


--
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



[issue29745] asyncio: Make pause/resume_reading idepotent and no-op for closed transports

2017-03-06 Thread Nikolay Kim

New submission from Nikolay Kim:

https://github.com/python/asyncio/issues/488

--
messages: 289147
nosy: fafhrd91
priority: normal
pull_requests: 439
severity: normal
status: open
title: asyncio: Make pause/resume_reading idepotent and no-op for closed 
transports
versions: Python 3.5, 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



[issue29744] memmap behavior changed

2017-03-06 Thread Andrea Giovannucci

New submission from Andrea Giovannucci:

The previous version 2.7.12 was returning a memmap file when slicing with a 
list of integers, now it returns an array. This affects the behaviour of 
several functions in my package. Is that an aware choice or a side product of 
some other change?

--
components: Demos and Tools
messages: 289146
nosy: agiovannucci
priority: normal
severity: normal
status: open
title: memmap behavior changed
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue29742] asyncio get_extra_info() throws exception

2017-03-06 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue29742] asyncio get_extra_info() throws exception

2017-03-06 Thread Nikolay Kim

Changes by Nikolay Kim :


--
pull_requests: +438

___
Python tracker 

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



[issue27035] Cannot set exit code in atexit callback

2017-03-06 Thread Glyph Lefkowitz

Glyph Lefkowitz added the comment:

I just bumped into this myself.  If this really is only fixable in a major 
release, there ought to at least be a minor release for the *documentation* to 
update it to be correct.

--
nosy: +glyph

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-06 Thread Martin Panter

Martin Panter added the comment:

What is the use case? Unless changing the behaviour would be useful, I think 
the simplest solution would be to document that the methods should only be 
given instances of “int”, so that it is clear that other kinds of numbers are 
unsupported.

--
nosy: +martin.panter

___
Python tracker 

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



[issue29581] __init_subclass__ causes TypeError when used with standard library metaclasses (such as ABCMeta)

2017-03-06 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +437

___
Python tracker 

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



[issue29743] Closing transport during handshake process leaks open socket

2017-03-06 Thread Nikolay Kim

New submission from Nikolay Kim:

https://github.com/python/asyncio/issues/487
https://github.com/KeepSafe/aiohttp/issues/1679

--
messages: 289143
nosy: fafhrd91
priority: normal
pull_requests: 436
severity: normal
status: open
title: Closing transport during handshake process leaks open socket
versions: Python 3.5, 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



[issue29742] asyncio get_extra_info() throws exception

2017-03-06 Thread Yury Selivanov

Yury Selivanov added the comment:

> Thanks for the report and PR, but your fix is not obviously correct.  

Not for this particular asyncio method though, see asyncio PEP [1]. But there's 
an actual bug in the PR, instead of returning `None` we should return `default`.

[1] https://www.python.org/dev/peps/pep-3156/#methods-for-all-transports

--

___
Python tracker 

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



[issue29742] asyncio get_extra_info() throws exception

2017-03-06 Thread Nikolay Kim

Nikolay Kim added the comment:

get_extra_info() returns optional transport information, I think it is ok to 
return None for closed transport.
https://github.com/python/cpython/blob/master/Lib/asyncio/transports.py#L18

I propose this feature initially, during early tulip development
but now I think it is not good api.

--

___
Python tracker 

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



[issue29742] asyncio get_extra_info() throws exception

2017-03-06 Thread R. David Murray

R. David Murray added the comment:

Thanks for the report and PR, but your fix is not obviously correct.  In 
general exceptions are the way in Python that errors are reported, and asking 
for extra_info on a closed stream is an error.  The exception raised is not 
clear, so perhaps the asyncio folks will want to improve it.  Or perhaps I'm 
wrong and they will want to return None, but I'll be a bit surprised if that is 
the case :)

--
components: +asyncio
nosy: +gvanrossum, r.david.murray, yselivanov

___
Python tracker 

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



[issue29742] asyncio get_extra_info() throws exception

2017-03-06 Thread Nikolay Kim

Nikolay Kim added the comment:

exception on get_extra_info() on closed ssl transport

```
Feb 18 13:18:09 btc electrumx_server.py[1732]: ERROR:ElectrumX:[15328] 
Traceback (most recent call last):
Feb 18 13:18:09 btc electrumx_server.py[1732]:   File 
"/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/lib/jsonrpc.py",
 line 528, in process_single_request
Feb 18 13:18:09 btc electrumx_server.py[1732]: result = await 
self.handle_payload(payload, self.request_handler)
Feb 18 13:18:09 btc electrumx_server.py[1732]:   File 
"/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/lib/jsonrpc.py",
 line 608, in handle_payload
Feb 18 13:18:09 btc electrumx_server.py[1732]: return await 
handler(**kw_args)
Feb 18 13:18:09 btc electrumx_server.py[1732]:   File 
"/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/server/session.py",
 line 282, in banner
Feb 18 13:18:09 btc electrumx_server.py[1732]: if self.is_tor():
Feb 18 13:18:09 btc electrumx_server.py[1732]:   File 
"/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/server/session.py",
 line 259, in is_tor
Feb 18 13:18:09 btc electrumx_server.py[1732]: peer_info = self.peer_info()
Feb 18 13:18:09 btc electrumx_server.py[1732]:   File 
"/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/lib/jsonrpc.py",
 line 764, in peer_info
Feb 18 13:18:09 btc electrumx_server.py[1732]: return 
self.transport.get_extra_info('peername')
Feb 18 13:18:09 btc electrumx_server.py[1732]:   File 
"/usr/lib/python3.5/asyncio/sslproto.py", line 306, in get_extra_info
Feb 18 13:18:09 btc electrumx_server.py[1732]: return 
self._ssl_protocol._get_extra_info(name, default)
Feb 18 13:18:09 btc electrumx_server.py[1732]:   File 
"/usr/lib/python3.5/asyncio/sslproto.py", line 537, in _get_extra_info
Feb 18 13:18:09 btc electrumx_server.py[1732]: return 
self._transport.get_extra_info(name, default)
Feb 18 13:18:09 btc electrumx_server.py[1732]: AttributeError: 'NoneType' 
object has no attribute 'get_extra_info'
```

--

___
Python tracker 

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



[issue29742] asyncio get_extra_info() throws exception

2017-03-06 Thread Nikolay Kim

New submission from Nikolay Kim:

https://github.com/python/asyncio/issues/494

--
messages: 289138
nosy: fafhrd91
priority: normal
pull_requests: 435
severity: normal
status: open
title: asyncio get_extra_info() throws exception
versions: Python 3.5, 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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

float, list: issue20185.

--

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-06 Thread Oren Milman

New submission from Oren Milman:

 current state 
import io

class IntLike():
def __init__(self, num):
self._num = num

def __index__(self):
return self._num

__int__ = __index__

io.StringIO('blah blah').read(IntLike(2))
io.StringIO('blah blah').readline(IntLike(2))
io.StringIO('blah blah').truncate(IntLike(2))

io.BytesIO(b'blah blah').read(IntLike(2))
io.BytesIO(b'blah blah').readline(IntLike(2))
io.BytesIO(b'blah blah').truncate(IntLike(2))

The three StringIO methods are called without any error, but each of the three
BytesIO methods raises a "TypeError: integer argument expected, got 'IntLike'".

This is because the functions which implement the StringIO methods (in
Modules/_io/stringio.c):
- _io_StringIO_read_impl
- _io_StringIO_readline_impl
- _io_StringIO_truncate_impl
use PyNumber_AsSsize_t, which might call nb_index.

However, the functions which implement the BytesIO methods (in
Modules/_io/bytesio.c):
- _io_BytesIO_read_impl
- _io_BytesIO_readline_impl
- _io_BytesIO_truncate_impl
use PyLong_AsSsize_t, which accepts only Python ints (or objects whose type is
a subclass of int).


 proposed changes 
- change those BytesIO methods so that they would accept integer types (i.e.
  classes that define __index__), mainly by replacing PyLong_AsSsize_t with
  PyNumber_AsSsize_t
- add tests to Lib/test/test_memoryio.py to verify that all six aforementioned
  methods accept integer types

--
components: IO
messages: 289136
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: BytesIO methods don't accept integer types, while StringIO counterparts 
do
type: behavior
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



[issue29740] Visual C++ CRT security update from 14 June 2011

2017-03-06 Thread Markus

New submission from Markus:

In 14 June 2011 Microsoft released Visual C++ 2008 runtime MFC Security Update 
https://www.microsoft.com/en-us/download/details.aspx?id=26368

The Security Update also updates the CRT runtime (used by Python 2.7)

Without the security update, Python 2.7.13 uses vc90.crt 9.0.30729.4940
With the security  update, Python 2.7.13 uses vc90.crt 9.0.30729.6161
(Use e.g. Sysinternals procexp to see)

Why does Python not install the vc90.crt of the security update?

--
components: Build, Windows
messages: 289135
nosy: markuskramerIgitt, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Visual C++ CRT security update from 14 June 2011
type: security
versions: Python 2.7

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

> I would wait until constructors be converted to Argument Clinic. There are 
> ready patches for some of these builtin types, patches for other are in 
> proggress.

Do you have links for these changes? It's painful to search for Argument Clinic 
changes, the issue title doesn't say anything except "derby " :-/

--

___
Python tracker 

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



[issue29700] readline memory corruption when sys.stdin fd >= FD_SETSIZE for select()

2017-03-06 Thread Martin Panter

Martin Panter added the comment:

“Input9)” is probably a typo for “input()”.

In Python 2, sys.stdin etc are by default wrappers around ’s “stdin” 
etc, and can easily be wrappers around other  FILE objects, so the 
PyOS_Readline API and Python’s “readline” module pass these  objects 
directly to rl_instream etc.

In Python 3, sys.stdin etc are not directly related to  objects. But 
the PyOS_Readline API was not changed, and the “readline” module still uses the 
rl_instream API which requires a  FILE object. So the new code decides 
if it is reasonable to substitute  “stdin” etc objects for the Python 
“sys” objects.

--

___
Python tracker 

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



[issue29739] zipfile raises wrong exception for some incorrect passwords

2017-03-06 Thread Jack Cushman

New submission from Jack Cushman:

This bug arises when attempting to unzip a password-protected zipfile using the 
wrong password.

Usually when zipfile extraction is attempted with an incorrect password, 
zipfile raise `RuntimeError("Bad password for file")`. But for a small subset 
of passwords (about .4% of possible passwords), it instead raises 
`BadZipfile("Bad CRC-32 for file")`.

Attached is a script that attempts to decrypt a zip file using every 3-letter 
uppercase password. (This assumes you have first created the zip file, by 
running something like: `echo "stuff" > /tmp/foo.txt; zip -e -P password 
/tmp/foo.zip /tmp/foo.txt`.)

The specific passwords that trigger the wrong exception will vary each time the 
zip file is created. On my system, for a particular zip file, the result is 
this output:


BadZipFile b'ACB'
BadZipFile b'AMJ'
BadZipFile b'ASL'
BadZipFile b'AZV'
BadZipFile b'BCI'
BadZipFile b'BMV'
BadZipFile b'BQG'
BadZipFile b'BRB'
BadZipFile b'BYH'
BadZipFile b'CHU'
BadZipFile b'CTV'
BadZipFile b'DEF'
BadZipFile b'DHJ'
BadZipFile b'DSR'
BadZipFile b'EWG'
BadZipFile b'GOK'
BadZipFile b'GUK'
BadZipFile b'HGL'
BadZipFile b'HPV'
BadZipFile b'IAC'
BadZipFile b'IGQ'
BadZipFile b'IHG'
BadZipFile b'ILB'
BadZipFile b'IRJ'
BadZipFile b'JDW'
BadZipFile b'JIT'
BadZipFile b'JMK'
BadZipFile b'JPD'
BadZipFile b'JWL'
BadZipFile b'JXS'
BadZipFile b'KAR'
BadZipFile b'KKH'
BadZipFile b'LNW'
BadZipFile b'MEL'
BadZipFile b'NDY'
BadZipFile b'NFJ'
BadZipFile b'NLU'
BadZipFile b'NQU'
BadZipFile b'OXC'
BadZipFile b'PHA'
BadZipFile b'PQY'
BadZipFile b'QCN'
BadZipFile b'QFT'
BadZipFile b'QMB'
BadZipFile b'QWZ'
BadZipFile b'QYS'
BadZipFile b'RBR'
BadZipFile b'SKU'
BadZipFile b'SLG'
BadZipFile b'STU'
BadZipFile b'SUP'
BadZipFile b'UCD'
BadZipFile b'UOA'
BadZipFile b'UQM'
BadZipFile b'VAO'
BadZipFile b'VEQ'
BadZipFile b'VJW'
BadZipFile b'VVH'
BadZipFile b'WDA'
BadZipFile b'XCR'
BadZipFile b'XIY'
BadZipFile b'XLG'
BadZipFile b'YJA'
BadZipFile b'YMA'
BadZipFile b'YRB'
BadZipFile b'ZHT'
BadZipFile b'ZVJ'
BadZipFile b'ZWR'
BadZipFile b'ZZT'
69 out of 17576 passwords raise BadZipFile


Versions:

I reproduced this in Python 2.7.10 and 3.6.0, using a zip file created on Mac 
OS 10.12.3 with this zip version: 


$ zip --version
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
Compiled with gcc 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34) for Unix 
(Mac OS X) on Jul 30 2016.

--
components: Library (Lib)
files: fail.py
messages: 289132
nosy: jcushman
priority: normal
severity: normal
status: open
title: zipfile raises wrong exception for some incorrect passwords
type: behavior
versions: Python 2.7, Python 3.6
Added file: http://bugs.python.org/file46706/fail.py

___
Python tracker 

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



[issue29691] Some tests fail in coverage Travis check

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The list of failing tests in issue29048 contains test_traceback and 
test_xml_etree. Thus this issue may be a part of issue29048. Some tests may be 
fixed since reporting issue29048.

--

___
Python tracker 

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



[issue29738] Fix memory leak in SSLSocket.getpeercert()

2017-03-06 Thread Olivier Vielpeau

Changes by Olivier Vielpeau :


--
pull_requests: +433

___
Python tracker 

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



[issue29738] Fix memory leak in SSLSocket.getpeercert()

2017-03-06 Thread Olivier Vielpeau

New submission from Olivier Vielpeau:

The code snippet in #25569 reproduces the memory leak with Python 3.6.0 and 
2.7.13. The current memory leak is a regression that was introduced in #26470.

Going to attach a PR on github that fixes the issue shortly.

--
assignee: christian.heimes
components: SSL
messages: 289130
nosy: christian.heimes, olivielpeau
priority: normal
severity: normal
status: open
title: Fix memory leak in SSLSocket.getpeercert()
type: resource usage
versions: Python 2.7, 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



[issue29737] Optimize concatenating empty tuples

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +432

___
Python tracker 

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



[issue29737] Optimize concatenating empty tuples

2017-03-06 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Since tuples are immutable, concatenating with empty tuple can be optimized by 
returning an opposite argument.

Microbenchmarks (the difference is larger for larger tuples):

$ ./python -m perf timeit --duplicate=100 -s 'a = (1, 2)' 'a + ()'
Unpatched:  Median +- std dev: 288 ns +- 12 ns
Patched:Median +- std dev: 128 ns +- 5 ns

$ ./python -m perf timeit --duplicate=100 -s 'a = (1, 2)' '() + a'
Unpatched:  Median +- std dev: 285 ns +- 16 ns
Patched:Median +- std dev: 128 ns +- 6 ns

Non-empty tuples are not affected:

$ ./python -m perf timeit --duplicate=100 -s 'a = (1, 2)' 'a + a'
Unpatched:  Median +- std dev: 321 ns +- 24 ns
Patched:Median +- std dev: 317 ns +- 26 ns

--
components: Interpreter Core
messages: 289129
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Optimize concatenating empty tuples
type: performance
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



[issue29691] Some tests fail in coverage Travis check

2017-03-06 Thread Jelle Zijlstra

Jelle Zijlstra added the comment:

I'll look into creating a PR when I have some time.

It would also be useful to tweak the Travis/coverage configuration so that it 
fails loudly if one of the tests doesn't pass in the coverage check.

--

___
Python tracker 

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



[issue29691] Some tests fail in coverage Travis check

2017-03-06 Thread Brett Cannon

Brett Cannon added the comment:

BTW, just because I assigned this to me doesn't mean others can't write a PR to 
solve this. :) I will review any PR that fixes this issue, I'm just going to 
make sure it gets solved no matter what if no one else creates a PR.

--

___
Python tracker 

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



[issue29691] Some tests fail in coverage Travis check

2017-03-06 Thread Brett Cannon

Brett Cannon added the comment:

I don't think it's a duplicate because we had a passing coverage run when we 
initially made the migration so something got tweaked to lead to the failures.

--

___
Python tracker 

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



[issue29691] Some tests fail in coverage Travis check

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is this a duplicate of issue29048?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue15954] No error checking after using of the wcsxfrm()

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue29691] Some tests fail in coverage Travis check

2017-03-06 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue29691] Some tests fail in coverage Travis check

2017-03-06 Thread Brett Cannon

Brett Cannon added the comment:

The test_traceback changes should be easy to tweak to use a regex or 
startwith() check so the tests pass again.

For the test_xml_etree failures I'm not sure how best to fix that other than 
taking it out. Maybe if sys.gettrace() returns something then skip the test?

--
nosy: +brett.cannon

___
Python tracker 

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



[issue29716] Python 3 Module doc still sounds like __init__.py is required

2017-03-06 Thread Brett Cannon

Brett Cannon added the comment:

I've gone ahead and closed this. Thanks for taking the time to check in on 
this, James!

--
nosy: +brett.cannon
resolution:  -> not a bug
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



[issue29708] support reproducible Python builds

2017-03-06 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue15954] No error checking after using of the wcsxfrm()

2017-03-06 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-06 Thread Ned Deily

Ned Deily added the comment:

Thanks for the analysis, Eryk and Nick.  Then this sounds like a release 
blocker problem that should be fixed for 3.6.1.  Steve, can you take a look, 
please?

--
nosy: +steve.dower
priority: normal -> release blocker
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue9051] Improve pickle format for timezone aware datetime instances

2017-03-06 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
resolution:  -> rejected
stage: patch review -> resolved
status: pending -> closed

___
Python tracker 

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



[issue29676] C method is not profiled by lsprof

2017-03-06 Thread INADA Naoki

Changes by INADA Naoki :


--
components: +Interpreter Core -Tests
title: verbose output of test_cprofile -> C method is not profiled by lsprof

___
Python tracker 

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



[issue29676] verbose output of test_cprofile

2017-03-06 Thread INADA Naoki

Changes by INADA Naoki :


--
pull_requests: +431

___
Python tracker 

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



[issue29676] verbose output of test_cprofile

2017-03-06 Thread INADA Naoki

INADA Naoki added the comment:

OK, now I found what caused this difference.

lsprof expect `func` is PyCFunction object.  But it can be PyMethodDescrObject 
when LOAD_METHOD is used to call C method.

In Modules/_lsprof.c (line 459):

case PyTrace_C_CALL:
if ProfilerObject *)self)->flags & POF_BUILTINS)
&& PyCFunction_Check(arg)) {
ptrace_enter_call(self,
  ((PyCFunctionObject *)arg)->m_ml,
  arg);
}

Document says just it's "Function object being called."
https://docs.python.org/3.6/c-api/init.html#c.Py_tracefunc

If "function object" means "any C object having tp_call", most easy way to 
solve this issue is adding PyMethodDescrObject support to lsprof.
PyEval_GetFuncName() and PyEval_GetFuncDesc() should support it too.
As a bonus, `list.append(L, x)` will be profiled like `L.append(x)`.  It looks 
more consistent.

On the other hand, if it means it's PyCFunction, we can't call 
PyMethodDescrObject directly.

Since PyEval_SetProfile() is old function, I chose later way for now.

--

___
Python tracker 

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



[issue29735] Optimize functools.partial() for positional arguments

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If the underlying function doesn't support fast call, and either args or 
pto->args are empty, partial_call() makes two unneeded copyings. Arguments are 
copied from a tuple to the raw array and from the array to new tuple. This is 
what the current code does, but this can be avoided.

If the underlying function doesn't support fast call, and both args and 
pto->args are not empty, patched partial_call() makes one unneeded copyings. 
Arguments are copied from tuples to the raw array and from the array to the new 
tuple. Only one copying is needed (from tuples to the new tuple).

--

___
Python tracker 

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



[issue29545] Python behavioral difference between Linux and AIX

2017-03-06 Thread Anna Henningsen

Changes by Anna Henningsen :


--
nosy: +addaleax

___
Python tracker 

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



[issue13566] Increase pickle compatibility

2017-03-06 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Right, but Antoine's objection is that suddenly strs pickled in Py3 can end up 
as strs in Py2, rather than unicode. If the library enforces a Py3-like type 
separation on Py2 (text arguments are unicode only, binary data is str only), 
then you have the problem where pickling on Py3 produces a pickle that will 
unpickle as str on Py2, and suddenly the library explodes because the argument, 
that should be unicode on Py2 and str on Py3, is suddenly str on both.

This means that, to fix a problem with non-forward compatible libraries (that 
accept text only as Py2 str), a Py2 library that's (very) forward thinking 
would have problems.

Admittedly, I wouldn't expect there to be very many such libraries, and many of 
them would have their own custom pickle formats, but stuff like numpy is quite 
sensitive to argument type; numpy.array(u'123') and numpy.array(b'123') are 
different. In numpy's case, each of those produces a derived datatype that is 
explicitly pickled and (I believe) would prevent the error, but some other more 
heuristic library might not do so.

--
nosy: +josh.r

___
Python tracker 

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



[issue29571] test_re is failing when local is set for `en_IN`

2017-03-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Thanks for the explanation - given that, I agree that simply reverting the 
attempted test-based fix and instead relying on the issue 20087 updates is the 
way to go.

--

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-06 Thread Nick Coghlan

Nick Coghlan added the comment:

I think Eryk's diagnosis is correct: this is a straight up bug in the original 
patch, where it's missing the check to only use the new logic when in isolated 
mode (as it's compensating for the fact that there is no extra sys.path[0] 
entry inserted in that case).

I mentioned that on the original issue 
http://bugs.python.org/issue29319#msg285904 but hadn't noticed that the 
relevant check was missing from the applied patch.

--

___
Python tracker 

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



[issue29733] concurrent.futures as_completed raise TimeoutError wrong

2017-03-06 Thread Josh Rosenberg

Josh Rosenberg added the comment:

The docs ( 
https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.as_completed
 ) do seem to indicate it shouldn't do so as long as results were available 
before the timeout expired:

"The returned iterator raises a concurrent.futures.TimeoutError if __next__() 
is called and the result isn’t available after timeout seconds from the 
original call to as_completed()."

My reading of that would be that it raises the error only when:

1. The timeout has expired
2. The call would block (or possibly, would have blocked after the timeout 
expired), indicating no result was available

Handling "would have blocked" is hard, but might it make sense to still allow a 
non-blocking wait on the event even if the timeout has expired, with the 
exception raised only if the non-blocking wait fails?

Side-note: Looks like this code is still using time.time, not time.monotonic, 
so it's vulnerable to system clock adjustments; NTP updates could cause a five 
second timeout to expire instantly, or take seconds or even minutes longer to 
expire.

--
nosy: +josh.r

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +430

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

Unhappy buildbot.

http://buildbot.python.org/all/builders/AMD64%20Debian%20root%203.x/builds/456/steps/test/logs/stdio

==
ERROR: test_keyword_arguments (test.test_descr.ClassPropertiesAndMethods)
--
Traceback (most recent call last):
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_descr.py", line 
3451, in test_keyword_arguments
list.__init__(a, sequence=[0, 1, 2])
TypeError: list() does not take keyword arguments

==
ERROR: test_keywords (test.test_descr.ClassPropertiesAndMethods)
--
Traceback (most recent call last):
  File 
"/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_descr.py", line 
2888, in test_keywords
self.assertEqual(int(x=1), 1)
TypeError: 'x' is an invalid keyword argument for this function

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

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks all!

--
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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The half of constructors no longer use PyArg_ParseTupleAndKeywords().

I would wait until constructors be converted to Argument Clinic. There are 
ready patches for some of these builtin types, patches for other are in 
proggress.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29735] Optimize functools.partial() for positional arguments

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What about C stack consumption? Is not this increase it?

Since nested partial()`s are collapsed, you need to interlace them with other 
wrapper for testing.

def decorator(f):
def wrapper(*args):
return f(*args)
return wrapper

def f(*args): pass

for i in range(n):
f = partial(f)
f = decorator(f)

f(1, 2)

--
components: +Extension Modules
stage:  -> patch review

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-06 Thread R. David Murray

R. David Murray added the comment:

If Raymond is on the side of skipping the deprecation than I'm good with it.  
Like I said, this is a marginal case.

--

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +429

___
Python tracker 

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



[issue29736] Optimize builtin types constructor

2017-03-06 Thread STINNER Victor

New submission from STINNER Victor:

Attached PR replaces PyArg_ParseTupleAndKeywords() with
_PyArg_ParseTupleAndKeywordsFast() to optimize the constructor of the
builtin types:

* bool: bool_new()
* bytes: bytes_new()
* complex: complex_new()
* float: float_new()
* int: long_new()
* list: list_init()
* str: unicode_new()
* tuple: tuple_new()

When using keywords, the speedup is between 1.55x faster and 1.92x faster.

When using only positional arguments, the speedup is between 1.07x faster and 
1.14x faster.

Results of attached bench.py:

+---++-+
| Benchmark | ref| changed |
+===++=+
| complex(real=0.0, imag=0.0)   | 452 ns | 1.92x faster (-48%) |
+---++-+
| bytes("x", encoding="ascii", errors="strict") | 498 ns | 1.88x faster (-47%) |
+---++-+
| str(b"x", encoding="ascii")   | 340 ns | 1.55x faster (-35%) |
+---++-+
| list([None])  | 208 ns | 1.14x faster (-12%) |
+---++-+
| int(0)| 113 ns | 1.11x faster (-10%) |
+---++-+
| float(1.0)| 110 ns | 1.10x faster (-9%)  |
+---++-+
| str("x")  | 115 ns | 1.10x faster (-9%)  |
+---++-+
| tuple((None,))| 111 ns | 1.10x faster (-9%)  |
+---++-+
| bytes(b"x")   | 126 ns | 1.10x faster (-9%)  |
+---++-+
| bool(True)| 107 ns | 1.09x faster (-8%)  |
+---++-+
| complex(0.0, 0.0) | 176 ns | 1.07x faster (-7%)  |
+---++-+

--
files: bench.py
messages: 289111
nosy: haypo
priority: normal
severity: normal
status: open
title: Optimize builtin types constructor
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file46705/bench.py

___
Python tracker 

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



[issue27577] Make implementation and doc of tuple and list more compliant

2017-03-06 Thread Xiang Zhang

Changes by Xiang Zhang :


--
status: open -> closed

___
Python tracker 

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



[issue27577] Make implementation and doc of tuple and list more compliant

2017-03-06 Thread Xiang Zhang

Xiang Zhang added the comment:

This issue doesn't make any sense once #29695 is applied. So close.

--
resolution:  -> fixed
stage:  -> resolved

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +428

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If David agrees with this.

--

___
Python tracker 

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



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

Xiang Zhang added the comment:
> I think no. String is not affected now and its code uses related macros so I 
> don't think it could suffer possible regression.

Regressions are not something "expected", shit happens, all the time.
Unexpected corner cases are common :-)

--

___
Python tracker 

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



[issue29695] Weird keyword parameter names in builtins

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

> If you think that it would be better to remove without deprecation, the 
> following patch does this.

@Serhiy: Can you please create a PR for it?

--

___
Python tracker 

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



[issue15343] "pydoc -w " writes out page with empty "Package Contents" section

2017-03-06 Thread Wolfgang Maier

Wolfgang Maier added the comment:

Sorry, for generating noise on this very old issue, but was there a specific 
reason to duplicate the code of ImpImporter.find_module in changeset 
9101eab6178c instead of factoring it out?

--
nosy: +wolma

___
Python tracker 

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



[issue8256] input() doesn't catch _PyUnicode_AsString() exception; io.StringIO().encoding is None

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +427

___
Python tracker 

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



[issue8256] input() doesn't catch _PyUnicode_AsString() exception; io.StringIO().encoding is None

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
versions: +Python 3.7 -Python 3.4

___
Python tracker 

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



[issue29735] Optimize functools.partial() for positional arguments

2017-03-06 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +ncoghlan, rhettinger

___
Python tracker 

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



[issue29735] Optimize functools.partial() for positional arguments

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

functools.partial() is commonly used in the the asyncio module. The asyncio doc 
suggests to use it, because of deliberate limitations of the asyncio API.

--
nosy: +inada.naoki, serhiy.storchaka, yselivanov

___
Python tracker 

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



[issue28243] Performance regression in functools.partial()

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

> Oh, functools.partial.__call__() doesn't use fastcall yet.

This issue reminded me that I didn't finish to optimize partial_call(): see 
issue #29735 for a minor optimization.

--

___
Python tracker 

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



[issue29735] Optimize functools.partial() for positional arguments

2017-03-06 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +425

___
Python tracker 

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



[issue29735] Optimize functools.partial() for positional arguments

2017-03-06 Thread STINNER Victor

New submission from STINNER Victor:

The pull request makes functools.partial() faster for positional arguments. It 
avoids the creation of a tuple for positional arguments. It allocates a small 
buffer for up to 5 parameters. But it seems like even if the small buffer is 
not used, it's still faster.

Use small buffer, total: 2 positional arguments.

haypo@smithers$ ./python -m perf timeit -s 'from functools import partial; f = 
lambda x, y: None; g = partial(f, 1)' 'g(2)' --duplicate=100 --compare-to 
../master-ref/python --python-names=ref:patch --python-names=ref:patch
ref: . 138 ns +- 1 ns
patch: . 121 ns +- 1 ns

Median +- std dev: [ref] 138 ns +- 1 ns -> [patch] 121 ns +- 1 ns: 1.14x faster 
(-12%)


Don't use small buffer, total: 6 positional arguments.

haypo@smithers$ ./python -m perf timeit -s 'from functools import partial; f = 
lambda a1, a2, a3, a4, a5, a6: None; g = partial(f, 1, 2, 3, 4, 5)' 'g(6)' 
--duplicate=100 --compare-to ../master-ref/python --python-names=ref:patch 
--python-names=ref:patch
ref: . 156 ns +- 1 ns
patch: . 136 ns +- 0 ns

Median +- std dev: [ref] 156 ns +- 1 ns -> [patch] 136 ns +- 0 ns: 1.15x faster 
(-13%)


Another benchmark  with 10 position arguments:

haypo@smithers$ ./python -m perf timeit -s 'from functools import partial; f = 
lambda a1, a2, a3, a4, a5, a6, a7, a8, a9, a10: None; g = partial(f, 1, 2, 3, 
4, 5)' 'g(6, 7, 8, 9, 10)' --duplicate=100 --compare-to ../master-ref/python 
--python-names=ref:patch --python-names=ref:patch
ref: . 193 ns +- 1 ns
patch: . 166 ns +- 2 ns

Median +- std dev: [ref] 193 ns +- 1 ns -> [patch] 166 ns +- 2 ns: 1.17x faster 
(-14%)

--
messages: 289100
nosy: haypo
priority: normal
severity: normal
status: open
title: Optimize functools.partial() for positional arguments
type: performance
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



[issue9051] Improve pickle format for timezone aware datetime instances

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue26121] Use C99 functions in math if available

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't know how to run custom build on buildbots with new workflow.

--
versions: +Python 3.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



[issue29700] readline memory corruption when sys.stdin fd >= FD_SETSIZE for select()

2017-03-06 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue26121] Use C99 functions in math if available

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +424

___
Python tracker 

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



[issue29700] readline memory corruption when sys.stdin fd >= FD_SETSIZE for select()

2017-03-06 Thread Marien Zwart

Marien Zwart added the comment:

On Python 3, crash_readline_fdset.py does not crash for me, because its input() 
contains a check documented as:

   /* We should only use (GNU) readline if Python's sys.stdin and
  sys.stdout are the same as C's stdin and stdout, because we
  need to pass it those. */

and calls sys.stdin.getline() instead.

I don't understand why this was added 
(eba769657a32cb08d96f021f40c79a54ade0bffc's commit message "Make input9) behave 
properly with the new I/O library" does not explain it).

PyOS_Readline does still take sys_stdin and sys_stdout arguments, but the only 
callers in CPython itself pass the actual stdin and stdout. Not sure if it's 
still worth fixing (maybe just turn it from a crash into an error if the fd is 
too high, but don't add an alternative implementation?).

On Python 2, I can fix it, but then I hit the same problem in readline itself 
(http://git.savannah.gnu.org/cgit/readline.git/tree/input.c#n518).

So I suppose the next step is reporting it there, and see if they're interested 
in fixing it (looks like readline isn't currently using anything more fancy 
than select() and pselect(), and there's a few more calls to those that would 
probably also need fixing...). Doesn't seem useful to fix it here first.

--

___
Python tracker 

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



[issue28243] Performance regression in functools.partial()

2017-03-06 Thread STINNER Victor

STINNER Victor added the comment:

Oh wait, there was a major regression in my perf module :-( The --compare-to 
option was completely broken in the development branch (but it works for timeit 
--compare-to in the latest release). It's now fixed! So please ignore results 
of my previous comment.


New benchmark, 3.6 compared to 3.5:

haypo@smithers$ ./python -m perf timeit -s 'from functools import partial; f = 
lambda x, y: None; g = partial(f, 1)' 'g(2)' --duplicate=100 --compare-to 
../3.5/python --python-names=ref:patch --python-names=3.5:3.6
3.5: . 152 ns +- 4 ns
3.6: . 152 ns +- 1 ns

Median +- std dev: [3.5] 152 ns +- 4 ns -> [3.6] 152 ns +- 1 ns: 1.00x faster 
(-0%)
Not significant!

=> Ah! No change, it's still not significant! Same speed.


3.7 compared to 3.6:

haypo@smithers$ ./python -m perf timeit -s 'from functools import partial; f = 
lambda x, y: None; g = partial(f, 1)' 'g(2)' --duplicate=100 --compare-to 
../3.6/python --python-names=ref:patch --python-names=3.6:3.7
3.6: . 152 ns +- 1 ns
3.7: . 138 ns +- 1 ns

Median +- std dev: [3.6] 152 ns +- 1 ns -> [3.7] 138 ns +- 1 ns: 1.10x faster 
(-9%)

=> Oh! 3.7 is 1.10x faster! I didn't compile Python with PGO, so maybe it's a 
minor change due to code placement? At least, it's not slower ;-)


I'm unable to see any performance slowdown in 3.6 compared to 3.5, so I keep 
the issue closed.

Anyway, thanks for the report Serhiy! Our performance watcher ;-)

--

___
Python tracker 

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



[issue25455] Some repr implementations don't check for self-referential structures

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
versions: +Python 3.7 -Python 3.4

___
Python tracker 

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



[issue25455] Some repr implementations don't check for self-referential structures

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +423

___
Python tracker 

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



[issue29568] undefined parsing behavior with the old style string formatting

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +422

___
Python tracker 

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



[issue28230] tarfile does not support pathlib

2017-03-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated documentation.

Note that path-like objects are supported only for external names. Internal 
names are not OS paths.

--

___
Python tracker 

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



[issue28230] tarfile does not support pathlib

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +421

___
Python tracker 

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



[issue29734] nt._getfinalpathname handle leak

2017-03-06 Thread Eryk Sun

New submission from Eryk Sun:

The implementation of nt._getfinalpathname leaks a File handle if calling 
GetFinalPathNameByHandle fails. The latter function is practically guaranteed 
to fail when resolving the path for a non-file-system device. It also fails 
when VOLUME_NAME_DOS is requested for a volume GUID path that isn't currently 
mounted as either a DOS drive letter or an NTFS junction. In this case 
requesting VOLUME_NAME_GUID should work.

For example, when I try calling _getfinalpathname to resolve the device paths 
\\?\MAILSLOT, \\?\PIPE, \\?\UNC, \\?\C:, \\?\PhysicalDrive0, \\?\NUL, 
\\?\CONIN$, and \\?\COM1, I get the following list of leaked handles:

  0x168 File  \Device\Mailslot
  0x16c File  \Device\NamedPipe
  0x178 File  \Device\Mup
  0x17c File  \Device\HarddiskVolume2
  0x180 File  \Device\Harddisk0\DR0
  0x18c File  \Device\Null
  0x194 File  \Device\ConDrv
  0x198 File  \Device\Serial0

(The above is from a context manager that checks for leaked handles using 
ctypes to call the PssCaptureSnapshot API, which was introduced in Windows 8.1. 
I think Process Snapshotting is the only Windows API that uses the kernel's 
ability to fork a clone of a process.) 

The reason that GetFinalPathNameByHandle fails in these cases is that the 
information classes it queries are typically only serviced by file systems. 
Other I/O devices (e.g. disk and volume devices) will fail these I/O requests. 
It happens that GetFinalPathNameByHandle starts with an NtQueryObject request 
that succeeds in these cases (it's the source of the above native NT device 
names), but it doesn't stop there. It continues requesting information from the 
device and the mount-point manager until it either has everything or a request 
fails.

Also, in os__getfinalpathname_impl, I notice that it's switching from 
VOLUME_NAME_NT in the first call that's used to get the buffer size to 
VOLUME_NAME_DOS in the second call. It should use VOLUME_NAME_DOS in both 
cases, or better yet, add a keyword-only argument to select a different 
volume-name style (i.e. None, DOS, GUID, or NT).

--
components: Extension Modules, Windows
messages: 289095
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: nt._getfinalpathname  handle leak
type: behavior
versions: Python 3.5, 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



[issue29410] Moving to SipHash-1-3

2017-03-06 Thread INADA Naoki

INADA Naoki added the comment:

microbench result: 
https://gist.github.com/methane/33c7b01c45ce23b67246f5ddaff9c9e7

Not significant ~ very little difference for small data.
For 4KB:
Median +- std dev: [python.default] 3.26 us +- 0.03 us -> [python.siphash13] 
2.03 us +- 0.02 us: 1.60x faster (-38%)

--

___
Python tracker 

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



[issue29733] concurrent.futures as_completed raise TimeoutError wrong

2017-03-06 Thread jiangwanwei

New submission from jiangwanwei:

when I use as_completed function to wait my futures, if I sleep more than 
timeout seconds in each iteration , I found that futures has been set result, 
but raise TimeoutError. as my test example code shows:

from concurrent import futures
from multiprocessing import current_process
import time


def run(count):
cp = current_process()
print(cp.name, 'begin', count, 'at', time.time())
time.sleep(count)
print(cp.name, 'end', count, 'at', time.time())
return count


if __name__ == '__main__':
ppe = futures.ProcessPoolExecutor(max_workers=4)
cp = current_process()

fs = [ppe.submit(run, i) for i in range(4)]

print('begin receive at', time.time())
for f in futures.as_completed(fs, timeout=5):
time.sleep(5)
print(cp.name, 'receive', f.result(), 'at', time.time())
print(cp.name, 'receive', [f.result() for f in fs], 'at', time.time())
print('end receive at', time.time())


run above-mentioned example code, it will output :
begin receive at 1488799136.471536
Process-1 begin 0 at 1488799136.472969
Process-1 end 0 at 1488799136.473114
Process-3 begin 1 at 1488799136.473741
Process-2 begin 2 at 1488799136.474226
Process-4 begin 3 at 1488799136.474561
Process-3 end 1 at 1488799137.474495
Process-2 end 2 at 1488799138.475289
Process-4 end 3 at 1488799139.475696
MainProcess receive 0 at 1488799141.478663
MainProcess receive [0, 1, 2, 3] at 1488799141.478787
Traceback (most recent call last):
  File "test_futures.py", line 23, in 
for f in futures.as_completed(fs, timeout=5):
  File 
"/Users/jiangwanwei/anaconda3/lib/python3.5/concurrent/futures/_base.py", line 
213, in as_completed
len(pending), len(fs)))
concurrent.futures._base.TimeoutError: 3 (of 4) futures unfinished

--
messages: 289093
nosy: jiangwanwei
priority: normal
severity: normal
status: open
title: concurrent.futures as_completed raise TimeoutError wrong
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



[issue29714] can't interpolate byte string with \x00 before replacement identifier

2017-03-06 Thread Xiang Zhang

Xiang Zhang added the comment:

I think no. String is not affected now and its code uses related macros so I 
don't think it could suffer possible regression.

--

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +420

___
Python tracker 

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



[issue29655] Certain errors during IMPORT_STAR can leak a reference

2017-03-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +419

___
Python tracker 

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



  1   2   >