[issue35750] process finished with exit code -1073740940 (0xc0000374)

2019-01-17 Thread Eryk Sun


Change by Eryk Sun :


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



[issue17005] Add a topological sort algorithm

2019-01-17 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

As the name been already discussed ? 


I fear that topsort might only be clear to people already knowing what it does. 
topoligical_sort would be more discoverable and explicit and one can always do

from functools import topological_sort as tsort

if he wants to save some typing later.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35755] Remove current directory from posixpath.defpath to enhance security

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I'm working on PR but I found an issue.

shutil.which() behaves differently than subprocess, 
distutils.spawn.find_executable() and os.execv() when PATH is set but set to an 
empty string:

* os.get_exec_path() returns ['']
* shutil.which() returns None: DON'T RUN
* subprocess RUNS the program
* distutils.spawn.find_executable('program') returns 'program': RUN the program
* os.execv() RUNS the program

Using PATH=":", they all run the program and os.get_exec_path() returns ['', 
''].

Who is right? Which behavior do we want for Python?

Note: When PATH is set to an empty string, shutil.which() and 
distutils.spawn.find_executable() use the empty string, they don't use 
os.defpath.

--
Added file: https://bugs.python.org/file48065/empty_path.py

___
Python tracker 

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



[issue35755] Remove current directory from posixpath.defpath to enhance security

2019-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch, patch
pull_requests: +11275, 11276
stage:  -> patch review

___
Python tracker 

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



[issue35755] Remove current directory from posixpath.defpath to enhance security

2019-01-17 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue35755] Remove current directory from posixpath.defpath to enhance security

2019-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch, patch, patch
pull_requests: +11275, 11276, 11277
stage:  -> patch review

___
Python tracker 

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



[issue34782] Pdb crashes when code is executed in a mapping that does not define `__contains__`

2019-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This looks to me like an error in the user code. What is the use case of 
passing an object that does not implement the mapping interface as locals to 
pdb.run()?

--

___
Python tracker 

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



[issue35755] Remove current directory from posixpath.defpath to enhance security

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 11586 to remove the current directory from os.defpath.

I would prefer to first decide how the os, subprocess, shutil and distutils 
modules have to handle a PATH variable set to an empty string, before merging 
my PR. I would prefer to have the same behavior for these modules.


Gregory P. Smith:
> I'm not arguing against this change, just trying to figure out where it came 
> from in the first place.  We should fix the value on all OSes.

Oh, I didn't know that Windows had the same behavior... I didn't know that 
Windows has a default search path! C:\bin? Who has such directory?

I agree that it's better to have the same behavior on all platforms.


Gregory P. Smith:
> It would be a behavior change so probably only good for 3.8+.

I concur. It's a backward incompatible change.


Christian Heimes:
> My /usr/include/paths.h has #define _PATH_DEFPATH "/usr/bin:/bin" and #define 
> _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin". The file is pretty old and has 
> copyright from 89 and 93, https://code.woboq.org/gcc/include/paths.h.html

On my Fedora 29, this file comes from the glibc:

$ rpm -qf /usr/include/paths.h
glibc-headers-2.28-26.fc29.i686

According to execvp() manual page, the current directory has only been removed 
from glibc 2.24 (2016-08-05).

--

___
Python tracker 

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



[issue35755] Remove current directory from posixpath.defpath to enhance security

2019-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is how the which command behaves:

$ /usr/bin/which python
/usr/bin/python
$ PATH= /usr/bin/which python
$ PATH=. /usr/bin/which python
./python
$ PATH=: /usr/bin/which python
./python

I think shutil.which() should behave similarly unless there are good reasons 
for difference.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-01-17 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

@berker.peksag I have converted the patch at 
https://bugs.python.org/file40470/issue23078.patch and pushed it to a GitHub 
branch https://github.com/python/cpython/compare/master...tirkarthi:bpo23078 . 
I am willing to open a PR attributing to @fov in case you haven't had the time 
to look into this. 

I am removing 3.6 since it's security fixes only mode.

Thanks

--
nosy: +cjw296, mariocj89, xtreak
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



[issue35755] Remove current directory from posixpath.defpath to enhance security

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Alexey Izbyshev:
> Would it make sense to use os.confstr('CS_PATH') instead of a hardcoded path, 
> or is identical behavior on all POSIX platforms preferred to that?

I didn't know this variable. man confstr says:

_CS_PATH: A value for the PATH variable  which  indicates  where  all  the 
POSIX.2 standard utilities can be found.

On my Fedora 29, it only returns '/usr/bin':

$ python3
>>> import os; os.confstr("CS_PATH")
'/usr/bin'

On Fedora 29, /bin is a symlink to /usr/bin:

$ ls -ld /bin
lrwxrwxrwx. 1 root root 7 13 juil.  2018 /bin -> usr/bin/

So it makes sense to omit /bin from the default search path :-)

On Debian Sid where /bin is still a distinct directory than /usr/bin, CS_PATH 
is equal to "/bin:/usr/bin".

On Fedora, using confstr() would have the advantage of avoiding one useless 
syscall stat("/bin/program") in addition to stat("/usr/bin/program") in 
shutil.which() if the program doesn't exist... It's really a micro optimization 
which has no impact on the correctness, for the specific case of Fedora.

About the correctness, FreeBSD has a different value:

>>> os.confstr("CS_PATH")
'/usr/bin:/bin:/usr/sbin:/sbin'

Not only it also includes /usr/sbin and /sbin, but /usr/bin has the preference 
over /bin (posixpath of Python 3 checks /bin before /usr/bin). I'm not sure if 
the different order has an impact about correctness. I only found two programs 
which are in /bin and /usr/bin, but the programs in /usr/bin are symbolic links 
to a program with the same name in /bin :-)

vstinner@freebsd$ python3
Python 3.6.6 (default, Nov 20 2018, 01:57:10) 
>>> import os
>>> usr=os.listdir("/usr/bin")
>>> bin=os.listdir("/bin")
>>> set(usr) & set(bin)
{'pkill', 'pgrep'}

vstinner@freebsd$ file /usr/bin/pkill
/usr/bin/pkill: symbolic link to ../../bin/pkill

--

___
Python tracker 

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



[issue35756] Using `return value` in a generator function skips the returned value on for-loop iteration

2019-01-17 Thread Greg Ewing


Greg Ewing  added the comment:

There is no bug here; the current implementation is working as intended.

The word "yields" in the quoted section of the PEP indeed refers to the "yield" 
keyword and nothing else. Possibly that could be clarified, but I believe it's 
already clear enough when read in the context of the rest of the PEP.

--
nosy: +greg.ewing

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Alexey Izbyshev
> So, if we can't change os.execvp() and/or current subprocess behavior, 
> posix_spawnp seems to be ruled out.

My main motivation for using posix_spawn() is performance. An optimization 
should not justify to introduce a backward incompatible change. I agree wth 
posix_spawnp() cannot be used directly in subprocess because of that. But 
os.posix_spawnp() addition in Python 3.8 remains useful because it allows to 
use it directly (avoid subprocess).


> A naive emulation of posix_spawnp would be repeatedly calling posix_spawn for 
> each PATH entry, but that's prohibitively expensive.

It should be compared to the current code. Currently, _posixsubprocess uses a 
loop calling execv(). I don't think that calling posix_spawn() in a loop until 
one doesn't fail is more inefficient.

The worst case would be when applying process attributes and run file actions 
would dominate performances... I don't think that such case exists. Syscalls 
like dup2() and close() should be way faster than the final successful execv() 
in the overall posix_spawn() call. I'm talking about the case when the program 
exists.


> Iterate over PATH entries and perform a quick check for common exec errors 
> (ENOENT, ENOTDIR, EACCES) manually (e.g. by stat()).

I dislike this option. There is a high risk of race condition if the program is 
created, deleted or modified between the check and exec. It can cause subtle 
bugs, or worse: security vulnerabilities. IMHO the only valid check, to test if 
a program exists, is to call exec().

Alexey: Do you want to work on a PR to reimplement the "executable_list" and 
loop used by subprocess with _posixsubproces? You should keep the latest 
exception to re-raise it if no posix_spawn() successed. Don't forget to clear 
the exception on success, to not create a reference cycle:

commit acb9fa79fa6453c2bbe3ccfc9cad2837feb90093
Author: Victor Stinner 
Date:   Wed Sep 13 10:10:10 2017 -0700

bpo-31234, socket.create_connection(): Fix ref cycle (#3546)

--

___
Python tracker 

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



[issue31267] threading.Timer object is affected by changes to system time: Python locks should use a monotonic clock if available

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

> I'm sorrry, I read the issue too quickly and misunderstood it. I guess that 
> it's a duplicate of bpo-23428: "Use the monotonic clock for thread conditions 
> on POSIX platforms". This issue is blocked the libc...

Oops, I wanted to post this comment on bpo-35747... There are too many 
duplicates of bpo-23428...

I close this issue as a duplicate of bpo-23428.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Use the monotonic clock for thread conditions on POSIX platforms

___
Python tracker 

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



[issue23428] Use the monotonic clock for thread conditions on POSIX platforms

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-31267 "threading.Timer object is affected by changes to system 
time: Python locks should use a monotonic clock if available" as a duplicate of 
this issue.

--

___
Python tracker 

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



[issue35747] Python threading event wait influenced by date change

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Oops, I posted the following comment on the wrong issue... I wanted to post the 
following comment on this issue!

I'm sorrry, I read the issue too quickly and misunderstood it. I guess that 
it's a duplicate of bpo-23428: "Use the monotonic clock for thread conditions 
on POSIX platforms". This issue is blocked the libc...

--

___
Python tracker 

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



[issue35747] Python threading event wait influenced by date change

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

> looks like duplicate of bugs.python.org/issue23428 

Yes. I close this issue as a duplicate of bpo-23428. Let's discuss the bug 
there!

--
stage:  -> resolved
status: open -> closed
superseder:  -> Use the monotonic clock for thread conditions on POSIX platforms

___
Python tracker 

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



[issue23428] Use the monotonic clock for thread conditions on POSIX platforms

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I closed bpo-35747 "Python threading event wait influenced by date change" as a 
duplicate of the issue.

--

___
Python tracker 

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



[issue23428] Use the monotonic clock for thread conditions on POSIX platforms

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

> Is there any progress on the issue? Should someone take over?

It's a limitation of the libc, not directly of Python.

The problem is that the sem_timedwait() function of the glibc doesn't allow to 
specify which clock is used:
https://sourceware.org/bugzilla/show_bug.cgi?id=14717

Someone has to contribute to the glibc to add an option to sem_init() or 
sem_timedwait() to allow to use a different clock than CLOCK_REALTIME.

One workaround is to use Python to use the mutex+cond implementation of pthread 
locks, since this one is already able to use CLOCK_MONOTONIC:
https://bugs.python.org/issue31267#msg302257

--

___
Python tracker 

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



[issue23428] Use the monotonic clock for thread conditions on POSIX platforms

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-12822: "NewGIL should use CLOCK_MONOTONIC if possible".

--

___
Python tracker 

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



[issue23428] Use the monotonic clock for thread conditions on POSIX platforms

2019-01-17 Thread Andrey Ovchinnikov


Change by Andrey Ovchinnikov :


--
nosy: +anikey

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah


Stefan Krah  added the comment:

If gcc-8.0.1-0.14.fc28.ppc64le miscompiles memcpy(), perhaps the upstream
priority in https://bugzilla.redhat.com/show_bug.cgi?id=1540995 should be
"release blocker".


CC David Edelsohn, whose PPC64 buildbot (presumably big endian) works.

--
nosy: +David.Edelsohn

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2019-01-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11278

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2019-01-17 Thread miss-islington


miss-islington  added the comment:


New changeset cee29b46a19116261b083dc803217aa754c7df40 by Miss Islington (bot) 
(Nick Coghlan) in branch 'master':
bpo-35486: Note Py3.6 import system API requirement change (GH-11540)
https://github.com/python/cpython/commit/cee29b46a19116261b083dc803217aa754c7df40


--
nosy: +miss-islington

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2019-01-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11278, 11279

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2019-01-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11279, 11280, 11283

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2019-01-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11278, 11279, 11280

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2019-01-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11279, 11280, 11281, 11283

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2019-01-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11279, 11280, 11281, 11282, 11283

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2019-01-17 Thread miss-islington


miss-islington  added the comment:


New changeset 422db3777874f4f31fc8f4e718f440a2abc59347 by Miss Islington (bot) 
in branch '3.7':
bpo-35486: Note Py3.6 import system API requirement change (GH-11540)
https://github.com/python/cpython/commit/422db3777874f4f31fc8f4e718f440a2abc59347


--

___
Python tracker 

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



[issue23428] Use the monotonic clock for thread conditions on POSIX platforms

2019-01-17 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> One workaround is to use Python to use the mutex+cond implementation of 
> pthread locks, since this one is already able to use CLOCK_MONOTONIC:

That this have any drawbacks?

--
nosy: +pablogsal

___
Python tracker 

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



[issue23428] Use the monotonic clock for thread conditions on POSIX platforms

2019-01-17 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> One workaround is to use Python to use the mutex+cond implementation of 
> pthread locks, since this one is already able to use CLOCK_MONOTONIC:

Does this have any drawbacks?

--

___
Python tracker 

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



[issue34148] Fatal read error on socket transport

2019-01-17 Thread yjq


Change by yjq :


--
title: Fatal error on SSL transport -> Fatal read error on socket transport

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-17 Thread David Heiberg


David Heiberg  added the comment:

Ahh yes of course, I will remove that from the notes. With regards to the 
second note, would it do any harm to leave it in? I suppose it does imply that 
this was possible before...

--

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

What is your OS (name and version)?

What is your compiler (name and version)?

> Fatal Python error: _PySys_BeginInit: can't initialize sys module

I have no idea why you get this error. You should try to run this function in a 
debugger like gdb and run the code step by step to see what happens.

"""

0:06:18 load avg: 0.55 [171/416] test_hashlib
*** Error in `./python': corrupted size vs. prev_size: 0x0276b7a0 ***
Fatal Python error: Aborted

Current thread 0x2ba4468c7bc0 (most recent call first):
  File "/usr/local/data/mySoftware/Python-3.7.2/Lib/test/test_hashlib.py", line 
904 in _test_pbkdf2_hmac
"""

That's maybe unrelated, but _test_pbkdf2_hmac() is not supposed to crash.

--

___
Python tracker 

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



[issue35283] "threading._DummyThread" redefines "is_alive" but forgets "isAlive"

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 89669ffe10a9db6343f6ee42239e412c8ad96bde by Victor Stinner 
(Dong-hee Na) in branch 'master':
bpo-35283: Add deprecation warning for Thread.isAlive (GH-11454)
https://github.com/python/cpython/commit/89669ffe10a9db6343f6ee42239e412c8ad96bde


--

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f1d8e7cf17a010d2657822e06a41b30c9542a8c7 by Victor Stinner (David 
H) in branch 'master':
bpo-35701: Added __weakref__ slot to uuid.UUID (GH-11570)
https://github.com/python/cpython/commit/f1d8e7cf17a010d2657822e06a41b30c9542a8c7


--

___
Python tracker 

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



[issue35283] "threading._DummyThread" redefines "is_alive" but forgets "isAlive"

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, master now emits a deprecation warning. Is it worth it to emit a pending 
deprecation warning in Python 3.7?

--

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

I understand that the reported issue is now fixed, so I close the issue.

Note: uuid.UUID of Python 3.7 doesn't use slots.

--
keywords:  -3.7regression
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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What's New changes still are needed.

Are weak references to UUID used in any existing code, or just in the code that 
is planned to be written?

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

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

> What's New changes still are needed.

Sorry, what do you want to document? The fact that uuid.UUID now use slots? If 
yes, maybe reopen bpo-30977 instead?

This issue is only about fixing a regression caused by bpo-30977 (it wasn't 
possible to create a weak ref to a UUI), no?

--

___
Python tracker 

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



[issue35759] inspect module does not implement introspection API for asynchronous generators

2019-01-17 Thread Thomas Krennwallner


New submission from Thomas Krennwallner :

The `inspect` module does not contain functions for determining the current 
state of asynchronous generators. That is, there is no introspection API for 
asynchronous generators that match the API for generators and coroutines: 
https://docs.python.org/3.8/library/inspect.html#current-state-of-generators-and-coroutines.

I propose to add `inspect.getasyncgenstate` and `inspect.getasyncgenlocals` 
(following `inspect.isasyncgenfunction` and `inspect.isasyncgen`).

% ./python
Python 3.8.0a0 (heads/fix-issue-getasyncgenstate:a24deae1e2, Jan 17 2019, 
11:44:45) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> async def agen():
... x = 1
... yield x
... x += 1
... yield x
... 
>>> ag = agen()
>>> inspect.getasyncgenstate(ag)
'AGEN_CREATED'
>>> inspect.getasyncgenlocals(ag)
{}
>>> ag.__anext__().__next__()
Traceback (most recent call last):
  File "", line 1, in 
StopIteration: 1
>>> inspect.getasyncgenstate(ag)
'AGEN_SUSPENDED'
>>> inspect.getasyncgenlocals(ag)
{'x': 1}
>>> ag.__anext__().__next__()
Traceback (most recent call last):
  File "", line 1, in 
StopIteration: 2
>>> inspect.getasyncgenstate(ag)
'AGEN_SUSPENDED'
>>> inspect.getasyncgenlocals(ag)
{'x': 2}
>>> ag.aclose().send(None)
Traceback (most recent call last):
  File "", line 1, in 
StopIteration
>>> inspect.getasyncgenstate(ag)
'AGEN_CLOSED'
>>> inspect.getasyncgenlocals(ag)
{}

--
components: Library (Lib)
files: 0001-inspect-add-introspection-API-for-asynchronous-gener.patch
keywords: patch
messages: 333861
nosy: tkren
priority: normal
severity: normal
status: open
title: inspect module does not implement introspection API for asynchronous 
generators
type: enhancement
versions: Python 3.8
Added file: 
https://bugs.python.org/file48066/0001-inspect-add-introspection-API-for-asynchronous-gener.patch

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This was already documented. We need to fix the documentation. See the 
discussion above.

--

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

Extract of memoryview pack_signal() function:

#define PACK_SINGLE(ptr, src, type) \
do { \
type x;  \
x = (type)src;   \
memcpy(ptr, (char *)&x, sizeof x);   \
} while (0)


/* floats */
case 'f': case 'd':
d = PyFloat_AsDouble(item);
if (d == -1.0 && PyErr_Occurred())
goto err_occurred;
if (fmt[0] == 'f') {
PACK_SINGLE(ptr, d, float);  // # BUG IS HERE ###
}
else {
PACK_SINGLE(ptr, d, double);
}
break;

Pseudo-code:

double d = PyFloat_AsDouble(item);
float x;
x = (float)d;
memcpy(ptr, (char *)&x, sizeo x);

--

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

https://docs.python.org/dev/whatsnew/3.8.html#optimizations

"""uuid.UUID now uses __slots__ to reduce its memory footprint. Note that this 
means that instances can no longer be weak-referenced and that arbitrary 
attributes can no longer be added to them."""

Oh ok, now I understand previous comments. Yeah, the note should be removed.

--

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Florian Weimer


Change by Florian Weimer :


--
nosy: +fweimer

___
Python tracker 

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



[issue35701] [uuid] 3.8 breaks weak references for UUIDs

2019-01-17 Thread David Heiberg


David Heiberg  added the comment:

Should the note on arbitrary attributes also be removed? If this was documented 
previously then I don't see the need for it here, but if this has never been 
documented then maybe some other way of wording it may be sensible to include?

--

___
Python tracker 

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



[issue35196] IDLE text squeezer is too aggressive and is slow

2019-01-17 Thread Tal Einat


Tal Einat  added the comment:

The recently merged PR GH-10454 significantly reduced the overhead of 
Squeezer's write() interception.  The overhead should now be entirely 
insignificant.

IMO that deals with the "... and is slow" part of this issue.  We've still to 
decide whether the auto-squeezing is "too aggressive".

I'll mention again that Raymond has brought up several additional important 
issues in the comments, that IMO should be processed into new issues and/or a 
roadmap for IDLE.  It's Terry's decision how to proceed, but I'll be happy to 
help with whatever direction he chooses.

--

___
Python tracker 

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



[issue35759] inspect module does not implement introspection API for asynchronous generators

2019-01-17 Thread Thomas Krennwallner


Change by Thomas Krennwallner :


--
pull_requests: +11284
stage:  -> patch review

___
Python tracker 

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



[issue35759] inspect module does not implement introspection API for asynchronous generators

2019-01-17 Thread Thomas Krennwallner


Change by Thomas Krennwallner :


--
pull_requests: +11284, 11285
stage:  -> patch review

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Florian Weimer


Florian Weimer  added the comment:

I believe this is a GCC bug, and filed 
.

--

___
Python tracker 

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



[issue35734] ipaddress's _BaseV4._is_valid_netmask fails to detect invalid netmask like 255.254.128.0

2019-01-17 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


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

___
Python tracker 

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



[issue35734] ipaddress's _BaseV4._is_valid_netmask fails to detect invalid netmask like 255.254.128.0

2019-01-17 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
keywords: +patch, patch
pull_requests: +11286, 11287
stage:  -> patch review

___
Python tracker 

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



[issue35734] ipaddress's _BaseV4._is_valid_netmask fails to detect invalid netmask like 255.254.128.0

2019-01-17 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
keywords: +patch, patch, patch
pull_requests: +11286, 11287, 11288
stage:  -> patch review

___
Python tracker 

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



[issue35710] Make dataclasses.field() accept another name for __init__ field's name

2019-01-17 Thread Théophile Chevalier

Change by Théophile Chevalier :


--
nosy: +theophile

___
Python tracker 

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



[issue35734] ipaddress's _BaseV4._is_valid_netmask fails to detect invalid netmask like 255.254.128.0

2019-01-17 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I opened https://github.com/python/cpython/pull/11591 to remove 
_valid_mask_octets, _is_valid_netmask and _is_hostmask from ipaddress, the 
patch proposed in issue27860 has a larger scope so it's probably better to 
remove those unused methods in this issue.

Does someone know how to set the skip news label on GitHub?

--

___
Python tracker 

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



[issue35760] test_asyncio: test_async_gen_asyncio_gc_aclose_09() race condition

2019-01-17 Thread STINNER Victor


New submission from STINNER Victor :

The test fails once on AMD64 Windows8.1 Non-Debug 3.x when the Python test 
suite is run in parallel, but pass if the test is run alone (when the system is 
more "idle").

https://buildbot.python.org/all/#/builders/12/builds/1898

==
FAIL: test_async_gen_asyncio_gc_aclose_09 
(test.test_asyncgen.AsyncGenAsyncioTest)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\test\test_asyncgen.py", 
line 684, in test_async_gen_asyncio_gc_aclose_09
self.assertEqual(DONE, 1)
AssertionError: 0 != 1


It can reproduce the failure on a very busy Windows using 2 terminals:

* python -m test -F -W -j4 test_asyncgen  test_asyncgen test_asyncgen 
test_asyncgen
* python -m test -j0 -r -u all 

The first command runs the test 4 times in parallel in a loop until if fails, 
the second command is just one way to stress the system.


The test is based on time and so has a race condition depending on the exact 
timing:

def test_async_gen_asyncio_gc_aclose_09(self):
DONE = 0

async def gen():
nonlocal DONE
try:
while True:
yield 1
finally:
await asyncio.sleep(0.01)
await asyncio.sleep(0.01)
DONE = 1

async def run():
g = gen()
await g.__anext__()
await g.__anext__()
del g

await asyncio.sleep(0.1)

self.loop.run_until_complete(run())
self.assertEqual(DONE, 1)

--
components: Library (Lib), Tests
messages: 333868
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_asyncio: test_async_gen_asyncio_gc_aclose_09() race condition
versions: 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



[issue35734] ipaddress's _BaseV4._is_valid_netmask fails to detect invalid netmask like 255.254.128.0

2019-01-17 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> I opened https://github.com/python/cpython/pull/11591 to remove 
> _valid_mask_octets, _is_valid_netmask and _is_hostmask from ipaddress, the 
> patch proposed in issue27860 has a larger scope so it's probably better to 
> remove those unused methods in this issue.

Thanks, the subject of the issue is misleading and I would propose changing the 
issue subject or closing this in favor of the other issue and opening a PR 
against issue27860 stating that this only removes the unused functions and not 
the complete patch attached. This would require a review from the module 
maintainer I hope though it's an internal function that is never used.

> Does someone know how to set the skip news label on GitHub?

It needs to be added by a core dev

--

___
Python tracker 

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



[issue35759] inspect module does not implement introspection API for asynchronous generators

2019-01-17 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

see also msg300475

--
nosy: +ncoghlan, xtreak, yselivanov

___
Python tracker 

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



[issue33687] uu.py calls os.path.chmod which doesn't exist

2019-01-17 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 17f05bbc78dbcd1db308266c31370da9ec1b1d47 by Berker Peksag (Timo 
Furrer) in branch 'master':
bpo-33687: Fix call to os.chmod() in uu.decode() (GH-7282)
https://github.com/python/cpython/commit/17f05bbc78dbcd1db308266c31370da9ec1b1d47


--
nosy: +berker.peksag

___
Python tracker 

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



[issue33687] uu.py calls os.path.chmod which doesn't exist

2019-01-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11289, 11290

___
Python tracker 

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



[issue33687] uu.py calls os.path.chmod which doesn't exist

2019-01-17 Thread Berker Peksag


Change by Berker Peksag :


--
pull_requests:  -11290

___
Python tracker 

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



[issue35761] Allow dataclasses to be updated in place

2019-01-17 Thread Théophile Chevalier

New submission from Théophile Chevalier :

Calling dataclasses.replace(instance, **changes) returns a new object of the 
same type.

>From my understanding there is, however, no method to update in place fields 
>of a dataclass from another one.

I propose to add dataclasses.update(instance_to_update, other_instance, 
**changes).

This would for instance allow one to change all fields of current object in a 
sturdy way.
In my case, I currently call obj.__dict__.update(other_obj.__dict__) to perform 
the operation, but I know it has always to be done pretty carefully.

If this is accepted, I'm willing to post the change.

--
messages: 333872
nosy: theophile
priority: normal
severity: normal
status: open
title: Allow dataclasses to be updated in place
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue35761] Allow dataclasses to be updated in place

2019-01-17 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue16638] support multi-line docstring signatures in IDLE calltips

2019-01-17 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Since many of the criteria mentioned in msg219204 are now implemented or out of 
date, should this issue now be re-closed?

--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11291
stage:  -> patch review

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11291, 11292
stage:  -> patch review

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11291, 11292, 11293
stage:  -> patch review

___
Python tracker 

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



[issue33687] uu.py calls os.path.chmod which doesn't exist

2019-01-17 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset a261b737617ca8d52e04bf3ead346b1b8786a212 by Berker Peksag (Miss 
Islington (bot)) in branch '3.7':
bpo-33687: Fix call to os.chmod() in uu.decode() (GH-7282)
https://github.com/python/cpython/commit/a261b737617ca8d52e04bf3ead346b1b8786a212


--

___
Python tracker 

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



[issue33687] uu.py calls os.path.chmod which doesn't exist

2019-01-17 Thread Berker Peksag


Berker Peksag  added the comment:

Thank you for the report, Poul-Henning and thank you for the PR, Timo!

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

> If gcc-8.0.1-0.14.fc28.ppc64le miscompiles memcpy(), perhaps the upstream 
> priority in https://bugzilla.redhat.com/show_bug.cgi?id=1540995 should be 
> "release blocker".

With the bug, memoryview doesn't round properly float: rounds to zero rather 
than rounding to nearest. It's not a critical crash or critical security 
vulnerability :-)

Anyway, I wrote a fix: PR 11593. My fix is to workaround the GCC compiler bug 
using volatile but only on ppc64. My change only impacts the 'f' type on ppc64 
when compiled by GCC. Other architectures, compilers and types are unaffected 
and so have no impact on performances.

--

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

The bug occurs when GCC emits a single instruction (stxsspx) for cast + memcpy.

I understand that the struct module is not affected because there is a 
condition branch (if) between the cast ("float x = ...") and the memcpy().

static int
np_float(char *p, PyObject *v, const formatdef *f)
{
float x = (float)PyFloat_AsDouble(v);
if (x == -1 && PyErr_Occurred()) {
PyErr_SetString(StructError,
"required argument is not a float");
return -1;
}
memcpy(p, (char *)&x, sizeof x);
return 0;
}

--

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah


Stefan Krah  added the comment:

Okay, so it's not a severe bug. That leaves us with the question
what to do about it. As I said above, other call sites could be
affected, too:

_struct.c:

static int
np_float(char *p, PyObject *v, const formatdef *f)
{
float x = (float)PyFloat_AsDouble(v);
if (x == -1 && PyErr_Occurred()) {
PyErr_SetString(StructError,
"required argument is not a float");
return -1;
}
memcpy(p, (char *)&x, sizeof x);
return 0;
}


Even if this one isn't (I can't test) I think I'd prefer a more
global fix for the affected gcc version. Does any switch like
-fno-inline or something else work? If so, we could detect the
issue in configure.ac.

--

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah


Stefan Krah  added the comment:

Our mails apparently crossed. :-)

--

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah


Stefan Krah  added the comment:

Or to put it differently, should we put a specific fix for a single
gcc version into memoryview.c? For all we know, a fix will be pushed
to Fedora 28 in the next 4 months.

--

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Florian Weimer


Florian Weimer  added the comment:

We don't know yet if the GCC bug is specific to POWER.  That depends on what 
causes it.  Other targets my have double-to-float conversion instructions which 
hard-code the wrong rounding mode.

--

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

A colleague working on clang asked me to test clang: no, clang doesn't have the 
bug. test_buffer pass as expected with clang -O3.

Machine code of the cast + memcpy:

(gdb) p $f31
$1 = -21.101

(gdb) disassemble $pc,$pc+40
=> 0x10078fbc :frspf0,f31
   0x10078fc0 :li  r3,0
   0x10078fc4 :stfsx   f0,0,r29

(gdb) stepi
0x10078fc0  1824PACK_SINGLE(ptr, d, float);

(gdb) p $f0
$3 = -21.10381469727

(gdb) stepi
0x10078fc4  1824PACK_SINGLE(ptr, d, float);
(gdb) stepi
0x10078fc8  1824PACK_SINGLE(ptr, d, float);

(gdb) p /x (*ptr)@4
$8 = {0xcd, 0xcc, 0xa8, 0xc1}

The first byte is 0xcd: GOOD.

Florian explained in the GCC bug report that "frsp" is needed and clang emits 
it.

"This is incorrect because stfs rounds to zero.  An frsp instruction is missing 
before the stfs (and would be emitted without the memcpy)."
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88892#c0

--

___
Python tracker 

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



[issue35762] subprocess.Popen with universal_newlines and nonblocking streams failes with "can't concat NoneType to bytes"

2019-01-17 Thread Samuel Bayer


New submission from Samuel Bayer :

This bug is probably related to issue 24560.

This:

>>> import subprocess, fcntl, os
 p = subprocess.Popen(["python", "-c", 'import time; time.sleep(5)'], stdin 
 = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, 
 universal_newlines= True)
>>> fcntl.fcntl(p.stderr.fileno(), fcntl.F_SETFL, os.O_NONBLOCK | 
>>> fcntl.fcntl(p.stderr.fileno(), fcntl.F_GETFL))
>>> p.stderr.read()

causes this:

Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/codecs.py", 
line 321, in decode
data = self.buffer + input
TypeError: can't concat NoneType to bytes

I'm assuming the problem is that the underlying unbuffered stream returns None 
and the incremental byte decoder that's induced by universal_newlines = True 
isn't expecting it.

--
components: IO
messages: 333883
nosy: sambayer
priority: normal
severity: normal
status: open
title: subprocess.Popen with universal_newlines and nonblocking streams failes 
with "can't concat NoneType to bytes"
type: crash
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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor


STINNER Victor  added the comment:

"Or to put it differently, should we put a specific fix for a single
gcc version into memoryview.c? For all we know, a fix will be pushed
to Fedora 28 in the next 4 months."

Right now, test_buffer is skipped in the python3.spec of Fedora (recipe to 
build the package which compiles Python and then runs the Python test suite) on 
pp64le because of this bug. With my packager hat: I'm done, the bug has been 
identified and is already worked around in the package.

With my Python hat: I'm not sure if I'm comfortable to have a known rounding 
issue on memoryview because of a compiler bug. I'm not sure that the GCC bug 
will be fixed quickly, nor if all operating systems will quickly update GCC or 
backport the fix.

Well, I wrote a fix, but I don't feel able to decide if the workaround is worth 
it or not.

For me, the main risk is to forget to remove the workaround once a new GCC 
version will be released (in N months).

I wouldn't bet that such GCC bug will be fixed and released in less than 4 
months.

--

___
Python tracker 

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



[issue35734] Remove unused _BaseV4._is_valid_netmask in ipaddress

2019-01-17 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I changed the subject of this issue as the scope of issue27860 is larger. I 
will review them and open a new PR for them if appropriate once this one is 
accepted.

--
title: ipaddress's _BaseV4._is_valid_netmask fails to  detect invalid netmask 
like 255.254.128.0 -> Remove unused _BaseV4._is_valid_netmask in ipaddress

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah


Stefan Krah  added the comment:

> For me, the main risk is to forget to remove the workaround once a new GCC 
> version will be released (in N months).

This is why I suggested using the reproducer in configure.ac, setting something
like HAVE_GCC_MEMCPY_ROUNDING_BUG and then either a) wrap the *entire* 
PACK_SINGLE()
macro in an #ifdef or b) *preferably* add a global flag like -fno-inline or any
other flag that prevents the issue to CFLAGS.

b) under the condition that any such flag exists.


I may do a) in the weekend, which also addresses Florian Weimer's observation
that it is not known whether the issue is limited to POWER.

--

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Would it help if define PACK_SINGLE as below?

#define PACK_SINGLE(ptr, src, type) \
do { \
union {  \
type value;  \
unsigned char raw[sizeof(type)]; \
} x; \
x.value = (type)src; \
memcpy(ptr, x.raw, sizeof(type));\
} while (0)

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Florian Weimer


Florian Weimer  added the comment:

No, GCC will optimize away the union.

--

___
Python tracker 

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



[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2019-01-17 Thread Sergey Bon.


Change by Sergey Bon. :


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

___
Python tracker 

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



[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2019-01-17 Thread Sergey Bon.


Change by Sergey Bon. :


--
keywords: +patch, patch
pull_requests: +11294, 11295
stage:  -> patch review

___
Python tracker 

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



[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2019-01-17 Thread Sergey Bon.


Change by Sergey Bon. :


--
keywords: +patch, patch, patch
pull_requests: +11294, 11295, 11296
stage:  -> patch review

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-17 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Thank you for the answers, Kyle!

> I'll be preparing a patch for our posix_spawn's signal handling.

Great!

> My mistake in my setuid assessment was pointed out to me- it doesn't seem 
> like a highly likely attack vector, but it is indeed possible.

The specific scenario with non-synchronized posix_spawn/setuid is certainly not 
a good practice and could probably be considered an application bug (such 
application effectively spawns a child with "random" privileges -- depending on 
whether setuid() completed before or after vfork()).

That said, in Linux C libraries protection from that scenario is usually 
achieved automatically if all signals are blocked before vfork(). This is the 
result of a Linux-specific detail: at syscall level, setuid() affects a single 
thread only, but setuid() library function must affect the process as a whole. 
This forces C libraries to signal all threads when setuid() is called and wait 
until all threads perform setuid() syscall. This waiting can't complete until 
vfork() returns (because signals are blocked), so setuid() is effectively 
postponed. I don't know how setuid() behaves on FreeBSD (so the above may be 
not applicable at all).

> If the child errored out, they will indeed be properly reapable at that point 
> due to how vfork is implemented -- any observation to the contrary is to be 
> considered a bug.

Ah, that's good, thanks for the confirmation!

--

___
Python tracker 

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



[issue24928] mock.patch.dict spoils order of items in collections.OrderedDict

2019-01-17 Thread Berker Peksag


Berker Peksag  added the comment:

While I agree having more tests are a good thing, I'm not sure if the test in 
PR 11437 should be merged as it's not specifically testing a feature of the 
mock module.

patch.dict() basically does the following operation (ignoring possible 
AttributeErrors):

   # Keep the original one to use later.
   d = original_dict.copy()

   original_dict.update(new_dict)

I think the relationship between dict and OrderedDict (including any other dict 
subclasses and dict-like objects) and anything related to insertion order 
should be tested either in test_dict or in test_ordered_dict.

Also, the test can be simplified, but I will let other core developers chime in 
with their thoughts before reviewing PR 11437 on GitHub.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue24928] mock.patch.dict spoils order of items in collections.OrderedDict

2019-01-17 Thread Berker Peksag


Change by Berker Peksag :


--
pull_requests:  -10872

___
Python tracker 

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



[issue35683] Enable manylinux1 builds on Pipelines for CI testing

2019-01-17 Thread Steve Dower


Steve Dower  added the comment:

I have made the changes I suggested (though correctly...), but ultimately we 
need to create our own Docker image suitable for running these tests.

So for now, I'm proposing in my PR to make most of the change, as well as a few 
other Pipelines/test-related improvements, but to leave this open in case 
someone wants to come in later with a suitable image. At that point, the only 
change necessary to enable the tests will be to add a "posix_deps_yum.sh" 
script, update the image name/tag and change the manylinux variable to 'true'.

PR 11493 also fixes a missing LICENSE.txt file in the app store package, which 
was causing an idlelib test to fail as the fallback text only has one line. 
*Way* too obscure a failure for my liking, but at least we had a test there, so 
thanks, Terry :)

--
nosy: +terry.reedy

___
Python tracker 

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



[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2019-01-17 Thread Felipe


Felipe  added the comment:

Please go ahead with the PR. I can't push this one through, but would be
great to have this finally land!

On Thu, 17 Jan 2019 at 03:42, Karthikeyan Singaravelan <
rep...@bugs.python.org> wrote:

>
> Karthikeyan Singaravelan  added the comment:
>
> @berker.peksag I have converted the patch at
> https://bugs.python.org/file40470/issue23078.patch and pushed it to a
> GitHub branch
> https://github.com/python/cpython/compare/master...tirkarthi:bpo23078 . I
> am willing to open a PR attributing to @fov in case you haven't had the
> time to look into this.
>
> I am removing 3.6 since it's security fixes only mode.
>
> Thanks
>
> --
> nosy: +cjw296, mariocj89, xtreak
> versions:  -Python 3.6
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue32866] zipimport loader.get_data() requires absolute zip file path

2019-01-17 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

I believe this bug does not affect Python 3.8:

(Using a Python 3.8 virtualenv):

% python demo.pyz 
Reading: resource.txt
Length: 19
% python `pwd`/demo.pyz 
Reading: resource.txt
Length: 19

I think it's too risky (and too much work, given it would have to be ported to 
the C implementation of zipimport) to change this in earlier Pythons.  So, 
closing.

--
resolution:  -> works for me
stage:  -> resolved
status: open -> closed
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



[issue32866] zipimport loader.get_data() requires absolute zip file path

2019-01-17 Thread Nina Zakharenko


Change by Nina Zakharenko :


--
nosy: +nnja

___
Python tracker 

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



[issue22393] multiprocessing.Pool shouldn't hang forever if a worker process dies unexpectedly

2019-01-17 Thread Chris Markiewicz


Chris Markiewicz  added the comment:

Just a bump to note that the PR (10441) is ready for another round of review.

--
nosy: +cjmarkie

___
Python tracker 

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



[issue34766] BaseProxy cache should be cleaned when Manager client is reconnected

2019-01-17 Thread Yongnan Wu


Yongnan Wu  added the comment:

ping

--

___
Python tracker 

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



[issue35763] IDLE calltips: make positional note less obtrusive

2019-01-17 Thread Terry J. Reedy


New submission from Terry J. Reedy :

#19903 made calltip.getargspec use inspect.signature.  The latter may include 
'/' following positional-only arguments.  Slashes are possible for the growing 
number of C-coded functions processed with Argument Clinic.  They appear in 
both help output and IDLE calltips, but not yet in the regular docs, let alone 
Python code.  The result, for instance, is 'float([x])' in the docs and 
'float(x=0, /)' in help() and calltips.

Since '/' is effectively undocumented, especially in anything beginners would 
see, and since there have been questions from beginners as to its meaning, the 
following note is added to calltips on a new line followed by a blank line:

  ['/' marks preceding arguments as positional-only]

The negative effect is somewhat obtrusively expanding what would typically be 2 
lines to 4 in order to say something that hopefully becomes useless.  Raymond's 
#16638 comment about big tips being distracting prompted me to consider some 
possible (non-exclusive) changes to reduce the impact.

0. Omit the blank line.  We added the blank line to make it clearer that the 
comment is not part of the docstring.  This can be done otherwise.

1. Change the font to something like smaller, red, italic characters.  Issue: 
the tip string is computed as a whole in the user execution process and 
inserted in the tip window in the IDLE process.  

2. Shorten and move the comment and mark it with '#'. Most builtins have short 
signatures, so a short enough comment could be appended to the signature line 
as a comment.  In combination with 0. (and 1., but not visible here), the float 
tip would shrink from the current

  float(x=0, /)
  ['/' marks preceding arguments as positional-only]

  Convert a string or number to a floating point number, if possible.

back down to

  float(x=0, /)  # / means positional-only
  Convert a string or number to a floating point number, if possible.

3. Limit the number of appearances in a particular session.  The following 
should work.

slash_comments = 3
...  
if '/' in sig:
if slash_comments:
slash_comments -= 1


I think 3 would be about enough.  I don't want to make it configurable.

Issue: restarting the user execution process would restart the count in that 
process, where the addition is currently made.


If the proposal to use '/' in the regular docs were ever accepted, I would 
remove the special calltip comment.

--
assignee: terry.reedy
components: IDLE
messages: 333897
nosy: rhettinger, terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE calltips: make positional note less obtrusive
type: enhancement
versions: 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



[issue35764] IDLE: revise calltip doc

2019-01-17 Thread Terry J. Reedy


New submission from Terry J. Reedy :

Add cross-reference from Menu section entry.  Document '/' for builtins.  Check 
other details.  (Also remove 'extension' from end of previous entry.)

--
assignee: terry.reedy
components: IDLE
messages: 333898
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE: revise calltip doc
type: enhancement
versions: 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



[issue35763] IDLE calltips: make positional note less obtrusive

2019-01-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

#35764 is about revising the calltip doc, including adding something about '/' 
in signatures.

--

___
Python tracker 

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



[issue16638] support multi-line docstring signatures in IDLE calltips

2019-01-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The standard calltip box is two lines: signature and docstring header.  In most 
cases, such as int, iter, and min, the effect of this patch is to get both 
lines of a docstring signature, so the result is not abnormally big.  And I 
agree with Serhiy that getting even more lines, when needed, is a bug fix.  (My 
change to 'enhancement' was in respect to Raymond's proposal, hence the 
reversion.)

Bytes is one of the very few functions with more than two header lines, and 
exceptional at 5.  It could be reduced to 4 if the first and last were combined 
as done for other functions.  I don't want to add an option or special code for 
this special case.

#19903 expands the calltip by 2 lines when the signature includes '/'.  This is 
increasingly common as more builtins get processed by Argument Clinic. I opened 
#35763 to revisit and revise this behavior.

--
status: open -> closed
type: enhancement -> behavior

___
Python tracker 

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



[issue23156] Update tix install information in tkinter tix chapter of doc

2019-01-17 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Since tix has been deprecated since 3.6 (according to the docs with commit 
bd63353b7433ea8aa831ffb158ac29fb646a6fc9), should this ticket be closed as out 
of date?

--
nosy: +cheryl.sabella

___
Python tracker 

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



  1   2   >