[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +16769
pull_request: https://github.com/python/cpython/pull/17276

___
Python tracker 

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



[issue38855] test_unpack.py does not catch the unpacking of a set

2019-11-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm also unclear on what you're looking for.  Unpacking is documented to allow 
any iterable.  This includes all kinds of potentially weird but potentially 
useful cases including unordered collections, strings, files, etc.  These 
behaviors are unlikely to change.

--
nosy: +rhettinger

___
Python tracker 

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



[issue38843] Document argparse behaviour when custom namespace object already has the field set

2019-11-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

For now, we should at least document that, "If the preexisting namespace has an 
attribute set, the action default will not over write it."

--

___
Python tracker 

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



[issue38843] Document argparse behaviour when custom namespace object already has the field set

2019-11-20 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Ivan, you don't need to specify default values to have typing.  This will 
suffice:

class CliArgs(object):
foo: Optional[str]
bar: int
baz: float

--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread David Cuthbert


David Cuthbert  added the comment:

Alright -- my first stab at the DeprecationWarning in 3.6.
https://github.com/dacut/cpython/commit/6a1e261678975e2c70ec6b5e98e8affa28702312

Please critique away, and don't fret about bruising my ego. :-)

Is there a more idiomatic way of getting a warning to show up against the first 
callee that's not in the current module? I'm not enamored of the monstrosity 
I'm put together around line 918 of base_events.py (but less enamored about 
displaying warnings that the user is going to tear their hair out over trying 
to find the offending source line):

https://github.com/dacut/cpython/commit/6a1e261678975e2c70ec6b5e98e8affa28702312#diff-08afa52ab2b1511bee8527814ad44d80R918

--

___
Python tracker 

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



[issue36041] email: folding of quoted string in display_name violates RFC

2019-11-20 Thread Ronald Evers


Change by Ronald Evers :


--
nosy: +ronaldevers

___
Python tracker 

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



[issue38698] While parsing email message id: UnboundLocalError

2019-11-20 Thread PCManticore


Change by PCManticore :


--
keywords: +patch
pull_requests: +16770
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17277

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Jukka Väisänen

Jukka Väisänen  added the comment:

David, in terms of documentation changes and the emitted deprecation warning 
itself, I think it would be appropriate to instruct that please set the 
parameter explicitly to True or False to silence the warning AND point out that 
setting it to True has significant security and previously incorrectly 
documented functional implications.

Now your updated docs and warning read more like we are working around a Linux 
security bug which is not really the case - this behavior was intentionally 
added to the kernels and some of the code I do for a living relies on it to 
work properly. Admittedly the restriction of having the same UID wouldn't hurt.

And browsing again through the hits to my github searches, it makes me cringe 
how many people are already explicitly setting reuse_address=True in their code 
because the current documentation mistakenly makes it seem harmless and 
desirable. Makes me wonder if we need to put out a CVE? At the very least, I 
will be putting in PRs to the asyncio packages that I myself use and understand.

--

___
Python tracker 

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



[issue37367] octal escapes applied inconsistently throughout the interpreter and lib

2019-11-20 Thread Tal Einat


Tal Einat  added the comment:

Alright, so let's push through the existing PR for rejecting such octal escapes 
in byte strings.

We'll also need another PR for raising a deprecation warning for such octal 
escapes in strings.

--
keywords: +easy, easy (C)

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

> Now your updated docs and warning read more like we are working around a 
> Linux security bug which is not really the case - this behavior was 
> intentionally added to the kernels and some of the code I do for a living 
> relies on it to work properly. Admittedly the restriction of having the same 
> UID wouldn't hurt.

I think you can use SO_REUSEPORT instead, and for UDP sockets it's identical to 
SO_REUSEADDR except with the same-UID restriction added?

If that's right then it might make sense to unconditionally switch SO_REUSEADDR 
-> SO_REUSEPORT, even in existing Python releases – on the theory that it fixes 
the main security hole, while being back-compatible enough to be acceptable for 
a point release.

--

___
Python tracker 

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



[issue17306] Improve the way abstract base classes are shown in help()

2019-11-20 Thread Jackson Riley


Change by Jackson Riley :


--
pull_requests: +16771
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17278

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7eee5beaf87be898a679278c480e8dd0df76d351 by Victor Stinner in 
branch 'master':
bpo-38858: Factorize Py_EndInterpreter() code (GH-17273)
https://github.com/python/cpython/commit/7eee5beaf87be898a679278c480e8dd0df76d351


--

___
Python tracker 

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



[issue36854] GC operates out of global runtime state.

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16772
pull_request: https://github.com/python/cpython/pull/17279

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16773
pull_request: https://github.com/python/cpython/pull/17280

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16774
pull_request: https://github.com/python/cpython/pull/17281

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16776
pull_request: https://github.com/python/cpython/pull/17283

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d51a363a4379385fdfe9c09a56324631465ede29 by Victor Stinner 
(Brandt Bucher) in branch 'master':
bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235)
https://github.com/python/cpython/commit/d51a363a4379385fdfe9c09a56324631465ede29


--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16775
pull_request: https://github.com/python/cpython/pull/17282

___
Python tracker 

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



[issue34716] MagicMock.__divmod__ should return a pair

2019-11-20 Thread Jackson Riley


Jackson Riley  added the comment:

Ah thank you Vedran, that makes sense.
In that case, I think I'll make a start on implementing Serhiy's second 
suggestion - returning a pair of MagicMock instances when MagicMock.__divmod__ 
is called.

--

___
Python tracker 

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



[issue37340] remove free_list for bound method objects

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16777
pull_request: https://github.com/python/cpython/pull/17284

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 2ea4c37c1ecf05a8495211d55ed6888439b1b9cf by Miss Islington (bot) 
in branch '3.8':
bpo-38823: Fix refleak in marshal init error path (GH-17260)
https://github.com/python/cpython/commit/2ea4c37c1ecf05a8495211d55ed6888439b1b9cf


--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 63f09e7628bd72f1bb2106226655b1f775757806 by Miss Islington (bot) 
in branch '3.7':
bpo-38823: Fix refleak in marshal init error path (GH-17260)
https://github.com/python/cpython/commit/63f09e7628bd72f1bb2106226655b1f775757806


--

___
Python tracker 

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



[issue36854] GC operates out of global runtime state.

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9da7430675ceaeae5abeb9c9f7cd552b71b3a93a by Victor Stinner in 
branch 'master':
bpo-36854: Clear the current thread later (GH-17279)
https://github.com/python/cpython/commit/9da7430675ceaeae5abeb9c9f7cd552b71b3a93a


--
nosy: +vstinner

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Kyle Stanley

Kyle Stanley  added the comment:

> I think you can use SO_REUSEPORT instead, and for UDP sockets it's identical 
> to SO_REUSEADDR except with the same-UID restriction added?

> If that's right then it might make sense to unconditionally switch 
> SO_REUSEADDR -> SO_REUSEPORT, even in existing Python releases – on the 
> theory that it fixes the main security hole, while being back-compatible 
> enough to be acceptable for a point release.

+1, I think this is the best proposal so far. From my reading of 
http://man7.org/linux/man-pages/man7/socket.7.html (specifically the 
SO_REUSEPORT section) this seems correct.


Emitting a `DeprecationWarning` and a delayed change for the default value of 
`reuse_address` not only leaves open a security concern for the near future 
(until the change is actually made); it also has a maintenance cost for users 
and libraries. Also, changing the default value wouldn't address the problem 
for those who explicitly specified `reuse_address=True`.

The way I see it, changing `socket.SO_REUSEADDR` to `socket.SO_REUSEPORT` would 
apply the security fix more rapidly, fix the issue for more users, and have a 
much lower (if not zero) maintenance cost for the majority of users. 

This would also allow us to apply the change to more previous Python versions, 
since it doesn't affect asyncio's public API. If we're just changing 
`socket.SO_REUSEADDR` to `socket.SO_REUSEPORT` at: 

https://github.com/python/cpython/blob/7eee5beaf87be898a679278c480e8dd0df76d351/Lib/asyncio/base_events.py#L1321

We should be able to apply to change starting from Python 3.5+, no? I should 
have the time to open a PR with backports within the next day if needed, 
particularly since it's a fairly small code change. I'll leave that up to 
Nathaniel though since he came up with the idea, let me know either way.

--
nosy: +aeros

___
Python tracker 

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



[issue36854] GC operates out of global runtime state.

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16778
pull_request: https://github.com/python/cpython/pull/17285

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset daf7a082b20e59a0518cda1500add42c36ab058f by Miss Islington (bot) 
in branch '3.8':
bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235)
https://github.com/python/cpython/commit/daf7a082b20e59a0518cda1500add42c36ab058f


--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 1d7245c3e0cfe4508855c5025b25d8894155ecc5 by Miss Islington (bot) 
in branch '3.7':
bpo-38823: Fix refleak in _tracemalloc init error handling (GH-17235)
https://github.com/python/cpython/commit/1d7245c3e0cfe4508855c5025b25d8894155ecc5


--

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16779
pull_request: https://github.com/python/cpython/pull/17286

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

> New changeset ef5aa9af7c7e493402ac62009e4400aed7c3d54e by Victor Stinner in 
> branch 'master':
> bpo-38858: Reorganize pycore_init_types() (GH-17265)

This change introduced a reference leak:

https://buildbot.python.org/all/#builders/80/builds/771

test_atexit leaked [792, 792, 792] references, sum=2376
test_capi leaked [528, 528, 528] references, sum=1584
test__xxsubinterpreters leaked [17954, 17952, 17954] references, sum=53860
test_threading leaked [792, 792, 792] references, sum=2376

It should be fixed by PR 17286.

--

___
Python tracker 

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



[issue36854] GC operates out of global runtime state.

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 67e0de6f0b060ac8f373952f0ca4b3117ad5b611 by Victor Stinner in 
branch 'master':
bpo-36854: gcmodule.c gets its state from tstate (GH-17285)
https://github.com/python/cpython/commit/67e0de6f0b060ac8f373952f0ca4b3117ad5b611


--

___
Python tracker 

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



[issue36854] GC operates out of global runtime state.

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16780
pull_request: https://github.com/python/cpython/pull/17287

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-20 Thread Miro Hrončok

Miro Hrončok  added the comment:

I have consistent behavior on Fedora 32 in mock [0] and podman [1]. Wanted to 
test docker as well, but my docker setup is currently broken.

# python3.9
Python 3.9.0a1 (default, Nov 20 2019, 00:00:00) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.pidfd_open(-1)
Traceback (most recent call last):
  File "", line 1, in 
PermissionError: [Errno 1] Operation not permitted


=> the test fails.


[0] https://github.com/rpm-software-management/rpm
[1] https://podman.io/

--
nosy: +hroncok

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e7e699e4df73420ddccaa0057cd07ebb3b590b9b by Victor Stinner in 
branch 'master':
bpo-38858: Fix reference leak in pycore_init_types() (GH-17286)
https://github.com/python/cpython/commit/e7e699e4df73420ddccaa0057cd07ebb3b590b9b


--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-20 Thread Miro Hrončok

Miro Hrončok  added the comment:

BTW my kernel is: 5.3.7-301.fc31.x86_64

Sorry for commenting twice, I forgot to mention that.

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-20 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

I don't know about podman, but it sounds like mock and docker both use buggy 
sandboxing: https://bugzilla.redhat.com/show_bug.cgi?id=1770154

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

> BTW my kernel is: 5.3.7-301.fc31.x86_64

I get a different error on Fedora 31 with Linux kernel 5.3.9-300.fc31.x86_64:

$ ./python
Python 3.9.0a1+ (heads/method_freelist:e34fa9b8d7, Nov 20 2019, 12:09:54) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
>>> import os
>>> os.pidfd_open(-1)
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 22] Invalid argument

--

___
Python tracker 

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



[issue38835] pyfpe.h: Exclude PyFPE_START_PROTECT and PyFPE_END_PROTECT from the Py_LIMITED_API

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 488d02a24142948bfb1fafd19fa48e61fcbbabc5 by Victor Stinner in 
branch 'master':
bpo-38835: Exclude PyFPE macros from the stable API (GH-17228)
https://github.com/python/cpython/commit/488d02a24142948bfb1fafd19fa48e61fcbbabc5


--

___
Python tracker 

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



[issue38835] pyfpe.h: Exclude PyFPE_START_PROTECT and PyFPE_END_PROTECT from the Py_LIMITED_API

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

Pablo asked on PR 17231:
> Do you want to left the empty macro in Include/pyfpe.h?

https://github.com/python/cpython/pull/17231#pullrequestreview-319366200

I replied:
> If someone wants to remove them, I would suggest to first deprecate them, and 
> wait at least one Python release before removing them. And do that in a 
> separated issue: https://bugs.python.org/issue38835 title is "pyfpe.h: 
> Exclude PyFPE_START_PROTECT and PyFPE_END_PROTECT from the Py_LIMITED_API", 
> it's not directly related :-)

https://github.com/python/cpython/pull/17231#issuecomment-555732122

In short, I'm not interested to remove it right now :-)

The initial issue has been fixed, so I close the issue. Thanks for your review 
Pablo ;-)

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



[issue36854] GC operates out of global runtime state.

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7247407c35330f3f6292f1d40606b7ba6afd5700 by Victor Stinner in 
branch 'master':
bpo-36854: Move _PyRuntimeState.gc to PyInterpreterState (GH-17287)
https://github.com/python/cpython/commit/7247407c35330f3f6292f1d40606b7ba6afd5700


--

___
Python tracker 

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



[issue36854] GC operates out of global runtime state.

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

It's now done in the future Python 3.9!

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

___
Python tracker 

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



[issue24554] GC should happen when a subinterpreter is destroyed

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

bpo-36854 has been fixed, so it's time to reconsider fixing this issue :-)

--
nosy: +vstinner

___
Python tracker 

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



[issue9625] argparse: Problem with defaults for variable nargs when using choices

2019-11-20 Thread Jan Hutař

Jan Hutař  added the comment:

I think there is a same issue with "nargs='+'" - if you are aware of the, 
please ignore me.

$ python3 --version
Python 3.7.5

With "choices=...", there seems to be a problem:


$ cat bbb.py 
#!/usr/bin/env python3

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('choices', nargs='*',
default=['a', 'b', 'c'],
choices=['a', 'b', 'c'])
args = parser.parse_args()

print(args)
$ ./bbb.py 
usage: bbb.py [-h] [{a,b,c} [{a,b,c} ...]]
bbb.py: error: argument choices: invalid choice: ['a', 'b', 'c'] (choose from 
'a', 'b', 'c')
$ ./bbb.py a c
Namespace(choices=['a', 'c'])


but without choices it works:


$ cat bbb.py 
#!/usr/bin/env python3

import argparse

parser = argparse.ArgumentParser()
parser.add_argument('choices', nargs='*',
default=['a', 'b', 'c'])
args = parser.parse_args()

print(args)
$ ./bbb.py 
Namespace(choices=['a', 'b', 'c'])
$ ./bbb.py a c
Namespace(choices=['a', 'c'])


As I said, if this is a known issue, I'm sorry for the noise.

--
nosy: +Jan Hutař

___
Python tracker 

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



[issue37340] remove free_list for bound method objects

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 4dedd0f0ddc5a983a57bf0105eb34f948a91d2c4 by Victor Stinner in 
branch 'master':
bpo-37340: Remove PyMethod_ClearFreeList() and PyCFunction_ClearFreeList() 
(GH-17284)
https://github.com/python/cpython/commit/4dedd0f0ddc5a983a57bf0105eb34f948a91d2c4


--
nosy: +vstinner

___
Python tracker 

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



[issue38576] CVE-2019-18348: CRLF injection via the host part of the url passed to urlopen()

2019-11-20 Thread kim


Change by kim :


--
nosy: +kim

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Jukka Väisänen

Jukka Väisänen  added the comment:

Going to SO_REUSEPORT will fix the security issue and emitting a deprecation 
warning for default value invocation will catch the eyes of some maintainers 
but it will not prevent what caused me to catch this issue in the first place - 
starting two processes (with same UID) accidentally listening on the same UDP 
port (in my case it was port 5060 as a default SIP port).

Since there already is a reuse_port parameter to create_datagram_endpoint(), I 
assume the proposal is to set default value for reuse_addresss=False and 
reuse_port=True? But if reuse_address is explicitly set to True, are we going 
to just set SO_REUSEPORT instead and always leave SO_REUSEADDR unset? This 
would leave the reuse_address parameter completely useless and still allow 
accidental port reuse.

What if I really do want SO_REUSEADDR? Ok I can create a socket separately, 
call setsockopt() on it and pass it as the sock parameter to 
create_datagram_endpoint(). 

Maybe I'm not fully grasping the proposal.. or maybe we should just deprecate 
reuse_port from both create_datagram_endpoint() and create_server() + 
reuse_addr from create_datagram_endpoint()? 

This would leave the TCP create_server() with the reuse_addr parameter, 
defaulting reasonably to True. To use TCP/UDP SO_REUSEPORT or UDP SO_REUSEADDR, 
the docs would tell you to bake your own socket with socket.socket(). Those few 
(like me) who really need the functionality can survive without all-in-one 
convenience functions on asyncio.loop

--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Here is another suggestion:

- make the "reuse_address" parameter a no-op, and raise an error when 
"reuse_address=True" is passed

- add a new "allow_multiple_bind=False" parameter that enables SO_REUSEPORT

- do that in 3.8 as well

This way we 1) solve the security issue 2) ensure that anyone that passed 
"reuse_address=True" explicitly is notified that they were doing something 
dangerous unwillingly.

--
nosy: +pitrou

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
Removed message: https://bugs.python.org/msg357067

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

(previous message deleted, I hadn't noticed the "reuse_port" parameter)

My preference for create_datagram_endpoint() would be:

- make the "reuse_address" parameter a no-op, and raise an error when 
"reuse_address=True" is passed

- do that in 3.8 as well

This way we 1) solve the security issue 2) ensure that anyone that passed 
"reuse_address=True" explicitly is notified that they were doing something 
dangerous unwillingly.

And, yes, someone who really wants SO_REUSEADDR can set it manually, for 
example by calling `transport.get_extra_info('socket')`.

--

___
Python tracker 

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



[issue38821] argparse calls ngettext with deprecated non-integer value

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16781
pull_request: https://github.com/python/cpython/pull/17288

___
Python tracker 

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



[issue38821] argparse calls ngettext with deprecated non-integer value

2019-11-20 Thread Tal Einat


Tal Einat  added the comment:


New changeset be5c79e0338005d675a64ba6e5b137e850d556d1 by Tal Einat (Federico 
Bond) in branch 'master':
bpo-38821: Fix crash in argparse when using gettext (GH-17192)
https://github.com/python/cpython/commit/be5c79e0338005d675a64ba6e5b137e850d556d1


--
nosy: +taleinat

___
Python tracker 

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



[issue38821] argparse calls ngettext with deprecated non-integer value

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16782
pull_request: https://github.com/python/cpython/pull/17289

___
Python tracker 

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



[issue38821] argparse calls ngettext with deprecated non-integer value

2019-11-20 Thread Tal Einat


Tal Einat  added the comment:

Thanks for the report and the PR with a fix, Federico!

As discussed on in the PR comments, the PR did not include tests since there 
are currently no tests for argparse i18n. Please create a new issue for that, 
referencing this one.

--

___
Python tracker 

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



[issue38821] argparse calls ngettext with deprecated non-integer value

2019-11-20 Thread Tal Einat


Change by Tal Einat :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue38821] argparse calls ngettext with deprecated non-integer value

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset ecb2afc1bc1c2f3f9f99b09dd866100c3c7dcab7 by Miss Islington (bot) 
in branch '3.7':
bpo-38821: Fix crash in argparse when using gettext (GH-17192)
https://github.com/python/cpython/commit/ecb2afc1bc1c2f3f9f99b09dd866100c3c7dcab7


--
nosy: +miss-islington

___
Python tracker 

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



[issue38821] argparse calls ngettext with deprecated non-integer value

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 836f137f7ae0799de937e5281cb1da2bfdb8a69d by Miss Islington (bot) 
in branch '3.8':
bpo-38821: Fix crash in argparse when using gettext (GH-17192)
https://github.com/python/cpython/commit/836f137f7ae0799de937e5281cb1da2bfdb8a69d


--

___
Python tracker 

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



[issue38576] CVE-2019-18348: CRLF injection via the host part of the url passed to urlopen()

2019-11-20 Thread Justin Capella

Justin Capella  added the comment:

Can't see the specifics of that "restricted" redhat bug, but this was 
interesting bug and I wanted to ask if perhaps the domain in such cases should 
be IDN / punycoded ://xn--n28h.ws/ for example is ://💩.la

--
nosy: +b1tninja

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


New submission from Siwon Kang :

is_cgi() in CGIHTTPRequestHandler class separates given path into (dir, rest) 
then checks if dir is in cgi_directories. However, it divides based on the 
first seen '/', multi-level directories like /sub/dir/cgi-bin/hello.py is 
divided into head=/sub, rest=dir/cgi-bin/hello.py then check whether '/sub' 
exists in cgi_directories = [..., '/sub/dir/cgi-bin'].
If the function divides by last seen '/', it works correctly as 
head=/sub/dir/cgi-bin, rest=hello.py

--
components: Library (Lib)
files: sample.tar.xz
messages: 357074
nosy: kkangshawn
priority: normal
severity: normal
status: open
title: http.server is_cgi() does not correctly separate dir
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48725/sample.tar.xz

___
Python tracker 

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



[issue22107] tempfile module misinterprets access denied error on Windows

2019-11-20 Thread Erik Aronesty


Erik Aronesty  added the comment:

This is the fist of what I'm using: 
https://gist.github.com/earonesty/a052ce176e99d5a659472d0dab6ea361

Seems OK for my use cases.   There's probably issues with relying on __del__ 
this way.   But it solves the Windows close/reopen problem, too.

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue since the discussion restarted.

--
status: closed -> open

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16783
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/17290

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

As I already proposed previously, I proposed PR 17290 to simply skip 
test_pidfd_open() if os.pidfd_open() fails with a PermissionError.

I don't propose to change os.pidfd_open(), only the test unit for practical 
reasons: not bother users who have to use a strict Linux sandbox using a 
syscalls whitelist.

--

___
Python tracker 

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



[issue34716] MagicMock.__divmod__ should return a pair

2019-11-20 Thread Jackson Riley


Change by Jackson Riley :


--
keywords: +patch
pull_requests: +16784
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17291

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


Change by Siwon Kang :


--
keywords: +patch
pull_requests: +16785
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17292

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16786
pull_request: https://github.com/python/cpython/pull/17293

___
Python tracker 

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



[issue38864] dbm: Can't open database with bytes-encoded filename

2019-11-20 Thread John Goerzen


New submission from John Goerzen :

This simple recipe fails:

>>> import dbm
>>> dbm.open(b"foo")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.7/dbm/__init__.py", line 78, in open
result = whichdb(file) if 'n' not in flag else None
  File "/usr/lib/python3.7/dbm/__init__.py", line 112, in whichdb
f = io.open(filename + ".pag", "rb")
TypeError: can't concat str to bytes

Why does this matter?  On POSIX, a filename is any string of bytes that does 
not contain 0x00 or '/'.  A database with a filename containing, for instance, 
German characters in ISO-8859-1, can't be opened by dbm, EVEN WITH decoding.

For instance:

file = b"test\xf7"
>>> dbm.open(file.decode())
Traceback (most recent call last):
  File "", line 1, in 
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf7 in position 4: invalid 
start byte
db = dbm.open(file.decode('iso-8859-1'), 'c')
db.close()

Then:

ls *.db | hd
  74 65 73 74 c3 b7 2e 64  62 0a|test...db.|
000a

Note that it didn't insert the 0xf7 here; rather, it inserted the Unicode 
sequence corresponding to the division character (which is what 0xf7 in 
iso-8859-1 is).  It is not possible to open a filename named "test\xf7.db" with 
the dbm module.

--
messages: 357078
nosy: jgoerzen
priority: normal
severity: normal
status: open
title: dbm: Can't open database with bytes-encoded filename

___
Python tracker 

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



[issue38841] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2019-11-20 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
keywords: +patch
pull_requests: +16787
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17294

___
Python tracker 

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



[issue38853] set.repr breaches docstring contract

2019-11-20 Thread Cat Chenal


Cat Chenal  added the comment:

Thank you for pointing out my lack of clarity: I apologize.
I probably should not have split this issue in two (issue38855).

My confusion stems from the fact that I expected the unpacking of a set to 
return the same output as that obtained from the unpacking of a list.
>From my testing, I gather that the unpacking of a set is performed via its 
>repr, which uses "some ordering".

In closing, I want to note two points:

1. repr is apparently platform-dependent (here: Python 3.6.7 [MSC v.1900 64 bit 
(AMD64)]):

The code given by steven.daprano run in a jupyter lab cell or in VS Code yields 
a different output:
>>> repr({4, 5, 2**31+1, 2, 2**31+2, 3, 2**31, 0})
'{2147483648, 2147483649, 2, 2147483650, 4, 5, 3, 0}'

2. Testing reviewer's assertion: "The specific order you see will depend on the 
specific values in the set, as well as the order that they were inserted, 
deleted, and/or re-inserted in some arbitrary way."
This counter example, where element 0 is moved to the second position, shows 
that there is not such order dependence: 
>>> repr({4, 0, 5, 2**31+1, 2, 2**31+2, 3, 2**31})
'{0, 2147483649, 2, 2147483650, 4, 5, 3, 2147483648}'

--

___
Python tracker 

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



[issue38865] Can Py_Finalize() be called if the current interpreter is not the main interpreter?

2019-11-20 Thread STINNER Victor


New submission from STINNER Victor :

Programs/_testembed.c contains the following test used by test_embed:

static int test_audit_subinterpreter(void)
{
Py_IgnoreEnvironmentFlag = 0;
PySys_AddAuditHook(_audit_subinterpreter_hook, NULL);
_testembed_Py_Initialize();

Py_NewInterpreter(); 
Py_NewInterpreter(); 
Py_NewInterpreter(); 
 
Py_Finalize(); 

switch (_audit_subinterpreter_interpreter_count) {
case 3: return 0;
case 0: return -1;
default: return _audit_subinterpreter_interpreter_count;
}
}

When Py_Finalize() is called, the current interpreter is a subinterpreter (the 
3rd interpreter), not the main interpreter.

* Is it correct to call Py_Finalize() in such case?
* Is Python supposed to magically destroy the 3 interpreters?

In bpo-38858, I'm trying to reuse the same code to initialize and finalize the 
"main" interpreter and subinterpreters. I had an issue with 
test_audit_subinterpreter() when working on the PR 17293.

I modified my PR 17293 to not expect that Py_Finalize() can only be called from 
the main interpreter, but actually check if the current interpreter is the main 
interpreter or not. It fix test_audit_subinterpreter() but again, I'm not sure 
what is the correct behavior?

--

Last year, we had a similar discussion about calling Py_Main() *after* 
Py_Initialize(). I hacked the code to make it possible because it was supported 
previously, even if the Py_Main() configuration is only partially applied. But 
I understood that Nick Coghlan would prefer to deprecate supporting to call 
Py_Initialize() before Py_Main().

PEP 587 added Py_RunMain() which provides a different solution to this problem:
https://docs.python.org/dev/c-api/init_config.html#c.Py_RunMain

--
components: Interpreter Core
messages: 357080
nosy: eric.snow, nanjekyejoannah, ncoghlan, vstinner
priority: normal
severity: normal
status: open
title: Can Py_Finalize() be called if the current interpreter is not the main 
interpreter?
versions: Python 3.9

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

CGI programs are stored in a directory which must be configured in the web 
server. The path is typically SERVER_ROOT/cgi-bin, so the URL looks like
http://www.domain/cgi-bin/script

So IMHO, is_cgi's assumption is correct.
IMHO, this is not the wrong code.

--
nosy: +corona10

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

In addition, the code is not about the path on the file system,
but about the web request path.

https://bugs.python.org/msg216960 will help you to understand.

--

___
Python tracker 

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



[issue38840] incorrect __all__ list in multiprocessing.managers module

2019-11-20 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
keywords: +patch
pull_requests: +16788
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17296

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fff7bbfdb6b7c143b73b6b4b6b40e828c101110c by Victor Stinner in 
branch 'master':
bpo-38858: Add _Py_IsMainInterpreter(tstate) (GH-17293)
https://github.com/python/cpython/commit/fff7bbfdb6b7c143b73b6b4b6b40e828c101110c


--

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Siwon Kang


Siwon Kang  added the comment:

Thank you for your message and the info about 21323. I agree with the idea that 
cgi files are conventionally placed at the cgi-bin of the root but there is no 
explicit regulation so other servers, apache for example, handle this kind of 
sub directories successfully. In short, there is no violation in the form of 
/subdir/cgi-bin so this is nice to have if the http.server processes this case 
correctly. By the way, I didn't consider the case of continuous slashes so PR 
must be modified.

--

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16789
pull_request: https://github.com/python/cpython/pull/17297

___
Python tracker 

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



[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-20 Thread Brett Cannon


Brett Cannon  added the comment:

OK, then my vote is to provide getter and setter methods that are 
underscore-prefixed to mark them as "internal" with clear comments specifying 
that they are part of PEP 523 and thus should not be needlessly broken in a 
bugfix release.

--

___
Python tracker 

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



[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-20 Thread Brett Cannon


Brett Cannon  added the comment:

It's also possible the leading underscore was used to prevent name collisions.

Unfortunately I don't know the history of _attributes, so without someone 
digging through the git history or personally knowing the reason behind it I 
don't know whether we should be exposing it.

--

___
Python tracker 

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



[issue38866] test_pyclbr replace asyncore

2019-11-20 Thread Jackson Riley


New submission from Jackson Riley :

sub-issue of (issue28533)[https://bugs.python.org/issue28533]

--
components: Tests
files: pyclbr.patch
keywords: patch
messages: 357087
nosy: jacksonriley
priority: normal
severity: normal
status: open
title: test_pyclbr replace asyncore
Added file: https://bugs.python.org/file48726/pyclbr.patch

___
Python tracker 

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



[issue28533] Replace asyncore

2019-11-20 Thread Jackson Riley


Jackson Riley  added the comment:

Lib/test/test_pyclbr.py - subissue issue38866
A trivial one!

--
nosy: +jacksonriley

___
Python tracker 

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



[issue38863] http.server is_cgi() does not correctly separate dir

2019-11-20 Thread Dong-hee Na


Dong-hee Na  added the comment:

Yes, IMHO, but this code is related to the http.server.CGIHTTPRequestHandler.
This code looks like to be executed on the http.server.CGIHTTPRequestHandler 
not the apache server.

According to docs,
This defaults to ['/cgi-bin', '/htbin'] and describes directories to treat as 
containing CGI scripts.

reference: 
https://docs.python.org/3.9/library/http.server.html?highlight=cgihttprequesthandler#http.server.CGIHTTPRequestHandler.cgi_directories

--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2019-11-20 Thread Steve Dower


Steve Dower  added the comment:


New changeset de148f263fba75cd10d2cb010fe9c495cee4ec83 by Steve Dower in branch 
'master':
bpo-33125: Add support for building and releasing Windows ARM64 packages 
(GH-16828)
https://github.com/python/cpython/commit/de148f263fba75cd10d2cb010fe9c495cee4ec83


--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2019-11-20 Thread Steve Dower


Steve Dower  added the comment:

I've merged the change to master, but note that the release is not enabled, so 
we aren't actually releasing ARM64 builds yet (though they will be compiled 
[but not tested] in PRs - nothing should be different from other Windows builds 
though). There's no harm in giving the build scripts a bit of bake time.

I'm also not concerned about backporting to 3.8 to make it easier to build that 
version, which I've heard a little bit of demand for. But let's run the scripts 
in master for a little while first.

Deliberately leaving the stage as "commit review" rather than "backport needed" 
for now.

--
stage: patch review -> commit review

___
Python tracker 

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



[issue38858] new_interpreter() should reuse more Py_InitializeFromConfig() code

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b93f31fcd9f10b213c614d4944baf9ca2df2016c by Victor Stinner in 
branch 'master':
bpo-38858: Fix Py_Finalize() when called from a subinterpreter (GH-17297)
https://github.com/python/cpython/commit/b93f31fcd9f10b213c614d4944baf9ca2df2016c


--

___
Python tracker 

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



[issue38867] Enable Tkinter on Windows ARM

2019-11-20 Thread Steve Dower


New submission from Steve Dower :

(Split out from issue33125)

We currently do not have ARM/ARM64 builds of Tcl/Tk for Windows, so we cannot 
enable tkinter on this platform.

When builds of the dependencies become possible (in 8.6.10, apparently), we can 
enable it again.

--
components: Tkinter, Windows
messages: 357093
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Enable Tkinter on Windows ARM
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2019-11-20 Thread Steve Dower


Steve Dower  added the comment:

I also filed issue38867 specifically for enabling Tkinter on Windows ARM.

--

___
Python tracker 

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



[issue38546] test_concurrent_futures: reap_children() warnings on RHEL7 and RHEL8 buildbots

2019-11-20 Thread STINNER Victor


STINNER Victor  added the comment:

AMD64 Debian PGO 3.x:
https://buildbot.python.org/all/#/builders/47/builds/3851

test_submit_keyword 
(test.test_concurrent_futures.ProcessPoolSpawnProcessPoolExecutorTest) ... 
0.62s Warning -- reap_children() reaped child process 32627
Warning -- multiprocessing.process._dangling was modified by 
test_concurrent_futures

--

___
Python tracker 

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



[issue38823] Improve stdlib module initialization error handling.

2019-11-20 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +16790
pull_request: https://github.com/python/cpython/pull/17298

___
Python tracker 

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



[issue38843] Document argparse behaviour when custom namespace object already has the field set

2019-11-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue38841] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset 559bad1a70ed50cc9caa7cb303b6ac1fe6a34af3 by Miss Islington (bot) 
(xdegaye) in branch 'master':
bpo-38841: Skip asyncio test_create_datagram_endpoint_existing_sock_unix 
(GH-17294)
https://github.com/python/cpython/commit/559bad1a70ed50cc9caa7cb303b6ac1fe6a34af3


--
nosy: +miss-islington

___
Python tracker 

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



[issue38841] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2019-11-20 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16791
pull_request: https://github.com/python/cpython/pull/17299

___
Python tracker 

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



[issue38868] Shutil cannot delete a folder that contains an .ini file

2019-11-20 Thread Svetlana Vodianova


New submission from Svetlana Vodianova :

I posted my problem on Stack Overflow, but as of right now haven't received any 
answers. 

Link: 
https://stackoverflow.com/questions/58922332/shutil-cannot-delete-a-folder-with-a-hidden-desktop-ini-file

To summarize my problem: If you use copytree to copy a source folder that 
contains a desktop.ini file to a destination, and then call rmtree() to remove 
the source folder, it will throw an error indicating it doesn't have permission 
to remove the folder. Using ignore_patterns() doesn't help either, or to quote 
my problem on SO:

It seems once the source contains a .ini file, even if it isn't copied to the 
destination, rmtree() will have a problem removing the source folder.

Powershell has almost the same issue, however, unlike Python, if you tell PS to 
ignore the .ini file, it will remove the folder without crashing.

rmtree has no problem removing folders containing 0 ini files.

--
components: IO, Windows
messages: 357097
nosy: QueenSvetlana, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Shutil cannot delete a folder that contains an .ini file
type: crash
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



[issue38848] compileall fails when the platform lacks a functional sem_open()

2019-11-20 Thread Xavier de Gaye


Xavier de Gaye  added the comment:

Changing the title to "compileall fails when the platform lacks a functional  
sem_open()" as the problem lies in the compileall module itself.
Nosying Antoine as the author of issue #36786.


compileall fails on android API 24:

generic_x86_64:/data/local/tmp/python $ python -m compileall --workers=2 .
Traceback (most recent call last):
  File "/data/local/tmp/python/lib/python3.9/multiprocessing/synchronize.py", 
line 28, in 
from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'SemLock' from '_multiprocessing' 
(/data/local/tmp/python/lib/python3.9/lib-dynload/_multiprocessing.cpython-39d.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/local/tmp/python/lib/python3.9/runpy.py", line 192, in 
_run_module_as_main
return _run_code(code, main_globals, None,
  File "/data/local/tmp/python/lib/python3.9/runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "/data/local/tmp/python/lib/python3.9/compileall.py", line 425, in 

exit_status = int(not main())
  File "/data/local/tmp/python/lib/python3.9/compileall.py", line 403, in main
if not compile_dir(dest, maxlevels, args.ddir,
  File "/data/local/tmp/python/lib/python3.9/compileall.py", line 91, in 
compile_dir
with ProcessPoolExecutor(max_workers=workers) as executor:
  File "/data/local/tmp/python/lib/python3.9/concurrent/futures/process.py", 
line 555, in __init__
self._call_queue = _SafeQueue(
  File "/data/local/tmp/python/lib/python3.9/concurrent/futures/process.py", 
line 165, in __init__
super().__init__(max_size, ctx=ctx)
  File "/data/local/tmp/python/lib/python3.9/multiprocessing/queues.py", line 
42, in __init__
self._rlock = ctx.Lock()
  File "/data/local/tmp/python/lib/python3.9/multiprocessing/context.py", line 
67, in Lock
from .synchronize import Lock
  File "/data/local/tmp/python/lib/python3.9/multiprocessing/synchronize.py", 
line 30, in 
raise ImportError("This platform lacks a functioning sem_open" +
ImportError: This platform lacks a functioning sem_open implementation, 
therefore, the required synchronization primitives needed will not function, 
see issue 3770.

--
components: +Library (Lib) -Tests
nosy: +pitrou
title: test_compileall fails when the platform lacks a functional  sem_open() 
-> compileall fails when the platform lacks a functional  sem_open()

___
Python tracker 

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



[issue38868] Shutil cannot delete a folder that contains an .ini file

2019-11-20 Thread Svetlana Vodianova


Svetlana Vodianova  added the comment:

I posted my problem on Stack Overflow, but as of right now haven't received any 
answers. 

Link: 
https://stackoverflow.com/questions/58922332/shutil-cannot-delete-a-folder-with-a-hidden-desktop-ini-file

To summarize my problem: If you use copytree to copy a source folder that 
contains a desktop.ini file to a destination, and then call rmtree() to remove 
the destination folder (for example after zipping, you may want to remove the 
uncompressed destination folder), it will throw an error indicating it doesn't 
have permission to remove the folder. Using ignore_patterns() doesn't help 
either, or to quote my problem on SO:

It seems once the source contains a .ini file, even if it isn't copied to the 
destination, rmtree() will have a problem removing the destination folder.

Powershell has almost the same issue, however, unlike Python, if you tell PS to 
ignore the .ini file, it will remove the folder without crashing.

rmtree has no problem removing folders containing 0 ini files.

--

___
Python tracker 

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



[issue38841] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2019-11-20 Thread miss-islington


miss-islington  added the comment:


New changeset b762375ba28893be73f166576aecde44ad2f4001 by Miss Islington (bot) 
in branch '3.8':
bpo-38841: Skip asyncio test_create_datagram_endpoint_existing_sock_unix 
(GH-17294)
https://github.com/python/cpython/commit/b762375ba28893be73f166576aecde44ad2f4001


--

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread David Cuthbert


David Cuthbert  added the comment:

Jukka -- Fair enough; will reword this a bit. I'm trying to keep the 
DeprecationWarning short enough so people's eyes don't glaze over; will see 
what wordsmithing I can do here. (Once you get beyond a certain length, the 
number of folks who actually read the message goes down the longer it is.)

--

___
Python tracker 

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



[issue38853] set.repr breaches docstring contract

2019-11-20 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> My confusion stems from the fact that I expected the unpacking of a 
> set to return the same output as that obtained from the unpacking of a 
> list.

Why did you expect that?

Sets aren't lists. Lists are ordered, so they hold their items in a 
specific order. Sets are unordered, so there is no guarantee what order 
you will see when you unpack them.

If you create the list [foo, bar, baz] then the output will always be 
[foo, bar, baz] on every platform. That's a guarantee.

Sets are unordered, as documented, so there are no guarantee about what 
order you will see: it might be {foo, baz, bar} or {bar, baz, foo} or 
{foo, bar, baz} or {baz, foo, bar}, any permutation is equally valid, 
regardless of what order you created the set.

> 1. repr is apparently platform-dependent

Quite likely. Since there's no guarantee what order you will see, 
there's no guarantee that the order won't change from platform to 
platform, or version to version.

> 2. Testing reviewer's assertion: "The specific order you see will 
> depend on the specific values in the set, as well as the order that 
> they were inserted, deleted, and/or re-inserted in some arbitrary 
> way."
> This counter example, where element 0 is moved to the second position, 
> shows that there is not such order dependence:

Your example shows that the output order changes when you change the 
input order, in an unpredicatable, arbitrary way, just like I said. 
That's not a counter-example.

--

___
Python tracker 

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



[issue38841] [asyncio] bind() on a unix socket raises PermissionError on Android for a non-root user

2019-11-20 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue38848] compileall fails when the platform lacks a functional sem_open()

2019-11-20 Thread Xavier de Gaye


Change by Xavier de Gaye :


--
keywords: +patch
pull_requests: +16792
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17300

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-11-20 Thread David Cuthbert


David Cuthbert  added the comment:

On the completely deprecate reuse_address and rewrite/force folks to use 
reuse_port proposals, I'm a bit dubious of this approach.

Right now, we have two knobs that directly correspond to (potential) 
kernel-level socket parameters, SO_REUSEADDR and SO_REUSEPORT. We just chose an 
unfortunate default for one of them. Otherwise, the behavior is nicely explicit.

Rewriting or forbidding it, even when the user has (essentially) acknowledged 
they're accepting risks by passing reuse_address=True, seems to fly in the face 
of this. Users get bitten when we start convoluting logic here (I was just 
bitten by fcntl.lockf() not actually calling lockf() last month and ended up 
having to call lockf() via ctypes.).

There are some platforms (Linux pre-3.9 kernels) that don't have SO_REUSEPORT. 
I wish I could say I don't care about such platforms; alas, I just had to 
compile Python 3.7 on a system running a 2.6 kernel last month at a client site.

Finally, I've only scratched the surface with my test cases, on single-homed 
systems, IPv4, and binding to 0.0.0.0. There are a lot of parameters to try 
here before we decree that reuse_address has no purpose existing, and an OS 
could later reimplement saner defaults on SO_REUSEADDR.

Changing a default already has some controversy (Yury was -1 on this change). 
This seems much bigger and I'm not convinced we fully understand its 
ramifications.

That said, I'll happily implement whatever the consensus ends up being, or 
consensus as designated by the vBDFL, or wherever that decision needs to come 
from. :-)

--

___
Python tracker 

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



[issue38864] dbm: Can't open database with bytes-encoded filename

2019-11-20 Thread John Goerzen


John Goerzen  added the comment:

As has been pointed out to me, the surrogateescape method could be used here; 
however, it is a bit of an odd duckling itself, and the system's open() call 
accepts bytes; couldn't this as well?

--

___
Python tracker 

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



[issue38869] Unexpectedly variable result

2019-11-20 Thread Ian Carr-de Avelon


New submission from Ian Carr-de Avelon :

I can't understand why the result of changes() in the example file changes. I 
get:
[[6.90642211e-310]
 [1.01702662e-316]
 [1.58101007e-322]]
[[0.]
 [0.]
 [0.]]
with an Ubuntu 14 system that has had a lot of changes made. I've checked the 
same happens on pythonanywhere.com so it does not seem to just be my system is 
broken. I wondered if there was some strange state in cv2 I don't know about, 
but as commenting out the tvec=np.zeros(3) line removes the behaviour I think 
there is something strange here. Now I've got it down to a few lines I can find 
a work around  and obviously numpy and opencv are huge packages and it may be 
in their court, but I think it is worth someone taking a look who knows more 
than me.
Yours
Ian

--
files: bug.py
messages: 357105
nosy: IanCarr
priority: normal
severity: normal
status: open
title: Unexpectedly variable result
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file48727/bug.py

___
Python tracker 

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



  1   2   >