[issue18943] argparse: default args in mutually exclusive groups

2020-12-04 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue42570] Try and Except doesn't work properly

2020-12-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Kshitish, it was inappropriate to reopen this issue.  This forum is for 
tracking actual bugs in Python as opposed to bugs in a user's understanding of 
Python.  My suggestion is that you post on StackOverflow so that the helpers 
there can explain what is going on with the posted example.

--
nosy: +rhettinger
resolution: works for me -> not a bug
status: open -> closed

___
Python tracker 

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



[issue42575] Suggest to add an LinkedList data structure to python

2020-12-04 Thread Sam Yan


New submission from Sam Yan :

There has been no LinkedList data structure for Python. Therefore suggest 
adding a LinkedList data structure.

--
components: C API
files: LinkedList.py
messages: 382557
nosy: SamUnimelb
priority: normal
severity: normal
status: open
title: Suggest to add an LinkedList data structure to python
type: enhancement
versions: Python 3.10
Added file: https://bugs.python.org/file49658/LinkedList.py

___
Python tracker 

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



[issue42570] Try and Except doesn't work properly

2020-12-04 Thread Kshitish


Kshitish  added the comment:

for i in range(1,11):
try:
if i == i:
print(i)
if i == 5:
continue
print(i,'poc')
except:
print("Out")

Output:

1
2
3
4
5
6
7
8
9
10


As you can see the continue keyword is not working. The out put should be like 
that:

1
2
3
4
6
7
9
10

But it is not and this is the bug because every keyword must work as their 
task. if they they not then may be the code will be affected by this 
vulnerability. 

Thank you

--
status: closed -> open
Added file: https://bugs.python.org/file49657/main.py

___
Python tracker 

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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-04 Thread Brandt Bucher


Change by Brandt Bucher :


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

___
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

2020-12-04 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 
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



[issue42574] Travis can't build the 3.8 branch right now

2020-12-04 Thread Brandt Bucher


New submission from Brandt Bucher :

Travis seems to be using the wrong Python executable for (at least) the "make 
-j4 regen-all" step on the 3.8 branch. I have a hunch it's using the system 
python3 executable (3.5?). It causes the following failure when building:

...
python3 ./Tools/scripts/update_file.py ./Include/graminit.h 
./Include/graminit.h.new
  File "./Tools/clinic/clinic.py", line 1772
filename_new = f"{filename}.new"
   ^
SyntaxError: invalid syntax
Makefile:574: recipe for target 'clinic' failed
make: *** [clinic] Error 1

Recent examples:

https://travis-ci.com/github/python/cpython/jobs/454447280
https://travis-ci.com/github/python/cpython/jobs/454551266
https://travis-ci.com/github/python/cpython/jobs/454650029
https://travis-ci.com/github/python/cpython/jobs/454907763

I know Travis has been fairly problematic for us in the past.

--
components: Build
messages: 382555
nosy: brandtbucher
priority: normal
severity: normal
status: open
title: Travis can't build the 3.8 branch right now
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



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

2020-12-04 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-04 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +22520
pull_request: https://github.com/python/cpython/pull/23652

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-04 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +22519
pull_request: https://github.com/python/cpython/pull/23651

___
Python tracker 

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



[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

2020-12-04 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue13966] Add disable_interspersed_args() to argparse.ArgumentParser

2020-12-04 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 
versions: +Python 3.10 -Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue41116] build on macOS 11 (beta) does not find system-supplied third-party libraries

2020-12-04 Thread Ned Deily


Ned Deily  added the comment:


New changeset 06002b3f0d4570424feef37103c7e9b7d16bd63d by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-41116: Fix setup.py test for macOS Tcl/Tk frameworks (GH-23649) 
(GH-23650)
https://github.com/python/cpython/commit/06002b3f0d4570424feef37103c7e9b7d16bd63d


--

___
Python tracker 

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



[issue41116] build on macOS 11 (beta) does not find system-supplied third-party libraries

2020-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22518
pull_request: https://github.com/python/cpython/pull/23650

___
Python tracker 

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



[issue41116] build on macOS 11 (beta) does not find system-supplied third-party libraries

2020-12-04 Thread Ned Deily


Ned Deily  added the comment:


New changeset 29afab6c5f656f07ac85c9b2cf089631b2557a11 by Ned Deily in branch 
'master':
bpo-41116: Fix setup.py test for macOS Tcl/Tk frameworks (GH-23649)
https://github.com/python/cpython/commit/29afab6c5f656f07ac85c9b2cf089631b2557a11


--

___
Python tracker 

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



[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)

2020-12-04 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 226a012d1cd61f42ecd3056c554922f359a1a35d by Brandt Bucher in 
branch 'master':
bpo-42536: GC track recycled tuples (GH-23623)
https://github.com/python/cpython/commit/226a012d1cd61f42ecd3056c554922f359a1a35d


--

___
Python tracker 

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



[issue41116] build on macOS 11 (beta) does not find system-supplied third-party libraries

2020-12-04 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +22517
pull_request: https://github.com/python/cpython/pull/23649

___
Python tracker 

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



[issue42572] Better path handling with argparse

2020-12-04 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +paul.j3, rhettinger

___
Python tracker 

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



[issue39947] [C API] Make the PyThreadState structure opaque (move it to the internal C API)

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-35949 lists Py_ALLOW_RECURSION and Py_END_ALLOW_RECURSION which access 
> PyThreadState.recursion_critical member directly.

Oh, problem solved by:

commit dcc54215ac1eb4b6fab2a9ffe1abcdf3ac4bb77e
Author: Serhiy Storchaka 
Date:   Mon Oct 5 12:32:00 2020 +0300

bpo-41936. Remove macros Py_ALLOW_RECURSION/Py_END_ALLOW_RECURSION 
(GH-22552)

--

___
Python tracker 

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



[issue30459] PyList_SET_ITEM could be safer

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

I propose to merge my PR 23645 change right now. If it breaks too many C 
extensions, we still have time before Python 3.10.0 final scheduled at Monday, 
2021-10-04, to revert the change.


"if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0)"

Well, this is obviously a bug in py-qt4 and it's a good thing to get a compiler 
error on such code. I guess that the intent was to use PyList_SetItem().

It's also an issue for Python implementation other than CPython which does not 
behave exactly like CPython C API. I prefer to fix the C API to make it respect 
its own documentation (return "void").


Espie Marc: "Well, there is not going to be a lot of breakage. This problem is 
the only instance I've encountered in the full OpenBSD ports tree."

Oh, thanks for providing this very useful feedback! That's very promising.

Did you report the issue to py-qt4 upstream? If yes, can you please copy here 
the link to your report?

--

___
Python tracker 

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



[issue42373] PEP 626 does not specify behavior of tracing for keywords.

2020-12-04 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> In Windows, the fopen() and _wfopen() calls here should use the non-standard 
> "N" flag [1] to open a non-inheritable file descriptor and skip calling 
> set_inheritable().

Interesting. Do you want to propose a PR to enhance the Python implementation?

--

___
Python tracker 

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



[issue32865] os.pipe creates inheritable FDs with a bad internal state on Windows

2020-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue26131] Raise ImportWarning when loader.load_module() is used

2020-12-04 Thread Brett Cannon


Brett Cannon  added the comment:


New changeset 2de5097ba4c50eba90df55696a7b2e74c93834d4 by Brett Cannon in 
branch 'master':
bpo-26131: Deprecate usage of load_module() (GH-23469)
https://github.com/python/cpython/commit/2de5097ba4c50eba90df55696a7b2e74c93834d4


--

___
Python tracker 

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



[issue30858] Keyword can't be an expression?

2020-12-04 Thread Irit Katriel


Irit Katriel  added the comment:

I get this now on 3.10:


>>> print(end1 + end2 + end3 + end4 + end5 + end6 + end=' ')
  File "", line 1
print(end1 + end2 + end3 + end4 + end5 + end6 + end=' ')
  ^
SyntaxError: expression cannot contain assignment, perhaps you meant "=="?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue20415] Could method "isinstance" take a list as parameter?

2020-12-04 Thread Irit Katriel


Irit Katriel  added the comment:

Interesting discussion, and the reason seems to be here:
https://mail.python.org/pipermail/python-ideas/2011-July/010642.html

Lists need to be checked for cycles, tuples don't.

--
nosy: +iritkatriel
resolution:  -> rejected
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



[issue42545] Check that all symbols in the limited ABI are exported

2020-12-04 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 79c1849b9e5b635bd36b13e1be9dc7cbc2bd6312 by Pablo Galindo in 
branch 'master':
bpo-42545: Improve the error message in the stable API script (GH-23648)
https://github.com/python/cpython/commit/79c1849b9e5b635bd36b13e1be9dc7cbc2bd6312


--

___
Python tracker 

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



[issue37166] inspect.findsource doesn't handle shortened files gracefully

2020-12-04 Thread Irit Katriel


Irit Katriel  added the comment:

Fixed under issue17735.

--
nosy: +iritkatriel
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



[issue42545] Check that all symbols in the limited ABI are exported

2020-12-04 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +22516
pull_request: https://github.com/python/cpython/pull/23648

___
Python tracker 

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



[issue17735] inspect.findsource raises IndexError

2020-12-04 Thread Tal Einat


Tal Einat  added the comment:

Thanks for reporting this, Kyle!

Thanks for the PR, Irit!

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



[issue42572] Better path handling with argparse

2020-12-04 Thread Austin Scola


New submission from Austin Scola :

One of the types of arguments that I find myself most often passing to 
`argparse.ArgumentParser` is paths. I think that I am probably not alone in 
frequent usage of paths as arguments. Given this, it would be extremely helpful 
to have an `argparse.Action` in `argparse` or an type similar to `FileType` 
that converted the string to a path. A path type factory could also have an 
arguments to optionally check if the path exists, or is a directory, or other 
similar predicates.

--
components: Library (Lib)
messages: 382542
nosy: ascola
priority: normal
severity: normal
status: open
title: Better path handling with argparse
type: enhancement

___
Python tracker 

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



[issue17735] inspect.findsource raises IndexError

2020-12-04 Thread Tal Einat


Tal Einat  added the comment:


New changeset d1f07419c7560ed3ba52ba4f667f4eec9b5fe95d by Miss Islington (bot) 
in branch '3.9':
bpo-17735: inspect.findsource now raises OSError when co_lineno is out of range 
(GH-23633)
https://github.com/python/cpython/commit/d1f07419c7560ed3ba52ba4f667f4eec9b5fe95d


--

___
Python tracker 

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



[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-04 Thread Eryk Sun


Eryk Sun  added the comment:

> To implement PEP 446: create non-inheritable file descriptors.

Side note. That aspect is still wonky in Windows, for which set_inheritable() 
cannot be implemented reliably since there's no way to change whether an 
existing CRT file descriptor is inheritable. The current implementation just 
puts the combination of CRT fd and OS handle in a bad state (discussed in more 
detail in bpo-32865, an issue about fixing os.pipe, but related). In Windows, 
the fopen() and _wfopen() calls here should use the non-standard "N" flag [1] 
to open a non-inheritable file descriptor and skip calling set_inheritable().

---

[1] 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=msvc-160

--
nosy: +eryksun

___
Python tracker 

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



[issue42482] TracebackException should not hold reference to the exception traceback

2020-12-04 Thread Irit Katriel


Change by Irit Katriel :


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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> immutables: https://github.com/MagicStack/immutables/issues/46

I proposed a fix: https://github.com/MagicStack/immutables/pull/52

> mercurial https://bugzilla.redhat.com/show_bug.cgi?id=1897178

I proposed a fix: https://bz.mercurial-scm.org/show_bug.cgi?id=6451

--

___
Python tracker 

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



[issue42545] Check that all symbols in the limited ABI are exported

2020-12-04 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I want to make some tweaks to the script, so I will leave this open

--

___
Python tracker 

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



[issue14111] IDLE Debugger should handle interrupts

2020-12-04 Thread Mark Roseman


Mark Roseman  added the comment:

Terry, I agree that Ctrl-C should act just as an interrupt when the debugger is 
active. I also agree that a way to interrupt the debugger through the user 
interface is needed (in the revised UI, there's an explicit 'stop' button for 
that).

--

___
Python tracker 

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



[issue42545] Check that all symbols in the limited ABI are exported

2020-12-04 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 85f1dedb8d05774e0d3739be0a11cd970b98097f by Pablo Galindo in 
branch 'master':
bpo-42545: Check that all symbols in the limited ABI are exported (GH-23616)
https://github.com/python/cpython/commit/85f1dedb8d05774e0d3739be0a11cd970b98097f


--

___
Python tracker 

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



[issue29249] Pathlib glob ** bug

2020-12-04 Thread Miroslav Šedivý

Miroslav Šedivý  added the comment:

Today when porting some random project from os.path to pathlib I encountered a 
homemade filename matching method that I wanted to port to pathlib.Path.match. 
Unfortunately

>>> pathlib.Path('x').match('**/x')
False

although if I have a file called `x` in the current directory, both

>>> pathlib.Path('.').glob('**/x')

and zsh's

$ ls **/x

can find it. It would be really nice to have analogous .glob and .match methods.

--
nosy: +eumiro

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

Status:

* Py_SET_REFCNT(), Py_SET_TYPE() and Py_SET_SIZE() functions added to Python 
3.9.
* Python and Cython have been modified to use Py_TYPE(), Py_SET_REFCNT(), 
Py_IS_TYPE(), etc.
* pythoncapi_compat.h header file has been created to provide new functions to 
Python 3.6: https://github.com/pythoncapi/pythoncapi_compat
* Script has been created to upgrade C extensions to add support for Python 
3.10 without losing support for old Python versions: 
https://github.com/pythoncapi/pythoncapi_compat
* PEP 620 "Hide implementation details from the C API" written
* Py_TYPE() and Py_SIZE() were converted to a static inline function to deny 
"Py_TYPE(obj) = type;" syntax, but this change has been reverted during Python 
3.10 development cycle since it broke too many C extension modules. (msg381337)

TODO:

* Maybe add a new formatter for type names (msg361523)
* Avoid sizeof(PyObject) in PyType_FromSpec() (msg366473)

The purpose of this issue is only to fix the API part. Replacing static inline 
functions with opaque function calls (stable ABI) is not in the scope of this 
issue.

--

___
Python tracker 

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



[issue17735] inspect.findsource raises IndexError

2020-12-04 Thread miss-islington


miss-islington  added the comment:


New changeset a4e7d5f750e06e31a80a83c2af02b1a40cecd0ff by Miss Islington (bot) 
in branch '3.8':
bpo-17735: inspect.findsource now raises OSError when co_lineno is out of range 
(GH-23633)
https://github.com/python/cpython/commit/a4e7d5f750e06e31a80a83c2af02b1a40cecd0ff


--

___
Python tracker 

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



[issue42570] Try and Except doesn't work properly

2020-12-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Code is working correctly, not a bug. Perhaps you are mistaking `continue` for 
`break`.

Kshitish, we keep telling you not to use the bug tracker as a help desk. This 
is now your eighth "bug report" that was 100% your misunderstanding. There are 
many other resources where you can ask for help:

https://mail.python.org/mailman/listinfo/tutor

https://www.reddit.com/r/learnpython/

are good places to start. There are many others, which we have already 
suggested to you in previous issues. Please stop wasting our time.

--
nosy: +steven.daprano
resolution:  -> works for me
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



[issue17735] inspect.findsource raises IndexError

2020-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22515
pull_request: https://github.com/python/cpython/pull/23647

___
Python tracker 

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



[issue17735] inspect.findsource raises IndexError

2020-12-04 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +22514
pull_request: https://github.com/python/cpython/pull/23646

___
Python tracker 

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



[issue17735] inspect.findsource raises IndexError

2020-12-04 Thread Tal Einat


Tal Einat  added the comment:


New changeset 2e0760bb2edb595050aff82f236cd32b44d3dfb3 by Irit Katriel in 
branch 'master':
bpo-17735: inspect.findsource now raises OSError when co_lineno is out of range 
(GH-23633)
https://github.com/python/cpython/commit/2e0760bb2edb595050aff82f236cd32b44d3dfb3


--
nosy: +taleinat

___
Python tracker 

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



[issue42571] [docs] add links to Glossary#parameter in libraries

2020-12-04 Thread Frederic Gagnon


New submission from Frederic Gagnon :

Could be helpful to make it so that, in libraries, / * * and **  
(i.e. positional-only, keyword-only, var-positional and var-keyword indicators) 
link to https://docs.python.org/3/glossary.html#term-parameter

This come from someone relatively new to python that had a somewhat hard time 
understanding what the ", *," stood for in 
https://docs.python.org/3/library/glob.html#glob.glob

--
assignee: docs@python
components: Documentation
messages: 382530
nosy: docs@python, fredg1
priority: normal
severity: normal
status: open
title: [docs] add links to Glossary#parameter in libraries
type: enhancement

___
Python tracker 

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



[issue42482] TracebackException should not hold reference to the exception traceback

2020-12-04 Thread miss-islington


miss-islington  added the comment:


New changeset 40b92f1cc06f9aaba813ae38266f424e0969b089 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-42482: remove reference to exc_traceback from TracebackException 
(GH-23531) (GH-23578)
https://github.com/python/cpython/commit/40b92f1cc06f9aaba813ae38266f424e0969b089


--

___
Python tracker 

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



[issue42116] Inspect library ignore comments at the end of a function (inspect.getsource)

2020-12-04 Thread miss-islington


miss-islington  added the comment:


New changeset 81ac030d03bdaedd724603af6f89f9248a5f2700 by Miss Islington (bot) 
in branch '3.9':
bpo-42116: Fix inspect.getsource handling of trailing comments (GH-23630)
https://github.com/python/cpython/commit/81ac030d03bdaedd724603af6f89f9248a5f2700


--

___
Python tracker 

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



[issue42116] Inspect library ignore comments at the end of a function (inspect.getsource)

2020-12-04 Thread miss-islington


miss-islington  added the comment:


New changeset 3b14f18205b17d1634e21bd7bc48152247590d9f by Miss Islington (bot) 
in branch '3.8':
bpo-42116: Fix inspect.getsource handling of trailing comments (GH-23630)
https://github.com/python/cpython/commit/3b14f18205b17d1634e21bd7bc48152247590d9f


--

___
Python tracker 

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



[issue42116] Inspect library ignore comments at the end of a function (inspect.getsource)

2020-12-04 Thread Tal Einat


Tal Einat  added the comment:

Thank you for reporting this, Noureddine Hamid!

Thanks for the PR, Irit!

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



[issue31904] Python should support VxWorks RTOS

2020-12-04 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 8d4f57dbd10846ffb4881b6509a511be0ab3b913 by pxinwr in branch 
'master':
bpo-31904: fix test_doctest.py failures for VxWorks (GH-23419)
https://github.com/python/cpython/commit/8d4f57dbd10846ffb4881b6509a511be0ab3b913


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue42558] waitpid/waitid race caused by change to Popen.send_signal in Python 3.9

2020-12-04 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I agree with Victor.  When code launches a process with subprocess APIs, it is 
expected that the subprocess module manages the process.

Calling os.waitpid directly instead of using subprocess's APIs breaks that 
expectation.

Also, WNOWAIT and waitid() (not waitpid()) are not available on all platforms.  
Nor is pidfd_open().  Code using any of those for such a PR needs to be 
conditional on their runtime availability.

--

___
Python tracker 

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



[issue42248] Raised exception in Enum keeping user objects alive unnecessarily

2020-12-04 Thread Gerald Dalley


Gerald Dalley  added the comment:

I and a few others have run into issues with the Enum constructors producing 
spurious reference cycles. This can cause memory explosions if large objects 
like numpy arrays are held in any of the relevant stack frames. Based on 
https://bugs.python.org/issue36820, it looks like the maintainers of CPython 
are open to fixing similar issues, and PRs look like the way to make progress.

--
nosy: +gerald.dalley2
type:  -> enhancement

___
Python tracker 

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



[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is the problem? What real code imports __init__?

--

___
Python tracker 

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



[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-04 Thread Steve Dower


Steve Dower  added the comment:

If the GIL is not held, no exception should be raised, so the fact that you've 
got one there means that the GIL is held and the main.c-specific error message 
is the bit that's wrong.

So it should be, "if they fail and you're in a context where exceptions are 
allowed, raise an exception" (which will chain back to the one raised from an 
audit hook".

--

___
Python tracker 

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



[issue24711] Document getpass.getpass behavior on ^C

2020-12-04 Thread Irit Katriel


Irit Katriel  added the comment:

I don't see a difference between getpass and input in this respect:


import getpass

try:
getpass.getpass('getpass: ')
except:
pass
print('goodbye getpass')


try:
input('input: ')
except:
pass
print('goodbye input')

--

If I run that script and ^C after each prompt, I get this:

>python.bat x.py
Running Release|x64 interpreter...
getpass: goodbye getpass
input: goodbye input

--
nosy: +iritkatriel
resolution:  -> works for me
status: open -> pending

___
Python tracker 

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



[issue30459] PyList_SET_ITEM could be safer

2020-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22513
pull_request: https://github.com/python/cpython/pull/23645

___
Python tracker 

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



[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-04 Thread Gregory Szorc


Gregory Szorc  added the comment:

I worked around this in PyOxidizer by stripping a trailing `.__init__` from 
module names when resolving the indexed resource data. This allows the import 
to work since it can find the data now, but it also preserves the double module 
object, which isn't ideal IMO.

My preferred solution would be to either ban `__init__` in module name 
components or strip trailing `.__init__` from the name in `find_spec()`, 
effectively normalizing it away. Either of these would be backwards 
incompatible. Could either of these be considered for 3.10?

It's worth noting that `__init__` could potentially occur in the interior of 
the module name. e.g. `foo.__init__.bar`. This would require filenames like 
`foo/__init__/bar.py`. I wouldn't be surprised if this exists somewhere in the 
wild.

--

___
Python tracker 

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



[issue42564] "from .__init__ import ..." syntax imports a duplicate module

2020-12-04 Thread Brett Cannon


Brett Cannon  added the comment:

I agree with Serhiy; don't do this. The only way we could fix this would be to 
always set a `__init__` module for every package implicitly, but then that 
would break anyone who wanted to clear out a package in sys.modules as the 
`__init__` reference in sys.modules becomes a dangling reference.

--
resolution:  -> wont fix
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



[issue37166] inspect.findsource doesn't handle shortened files gracefully

2020-12-04 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
superseder:  -> inspect.findsource raises IndexError

___
Python tracker 

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



[issue42570] Try and Except doesn't work properly

2020-12-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

You've not said what happens, nor what you're expecting to happen, so we cannot 
help you.

--
nosy: +eric.smith

___
Python tracker 

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



[issue36541] Make lib2to3 grammar better match Python, support the := walrus

2020-12-04 Thread Peter Ludemann


Peter Ludemann  added the comment:

I made a suggestion for augmenting ast.parse with some of lib2to3's features; 
but nobody seemed interested. 

RIP lib2to3. Like many pieces of software, it was used for far more than for 
what it was originally intended.

https://mail.python.org/archives/list/python-id...@python.org/thread/X2HJ6I6XLIGRZDB27HRHIVQC3RXNZAY4/

--

___
Python tracker 

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



[issue42570] Try and Except doesn't work properly

2020-12-04 Thread Kshitish


New submission from Kshitish :

Try & Except doesn't work probably. 
In the except continue keyword doesn't work probably.

--
files: main.py
messages: 382515
nosy: blue555
priority: normal
severity: normal
status: open
title: Try and Except doesn't work properly
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49656/main.py

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> Isn't it a part of the public API? I can't find it in the docs, but it seems 
> to be declared in the public header.

The Python C API has a strange history...

--

___
Python tracker 

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



[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-04 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

> To implement PEP 446: create non-inheritable file descriptors.

Yes, I understand that was the original role. But currently there is no easy 
way to deal with errors from the helpers because of exception vs. errno 
conundrum. Maybe they should be split to two functions each (one that always 
reports errors via an exception, and the other is a low-level one)? Or, 
alternatively, keep only exception-reporting variants but check all callers so 
that they don't use errno and call them from the right context (with GIL, etc.)?

--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

> It seems like PyErr_ProgramText() is no longer used in Python.

Isn't it a part of the public API? I can't find it in the docs, but it seems to 
be declared in the public header.

--

___
Python tracker 

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



[issue42545] Check that all symbols in the limited ABI are exported

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

My collection of links about the Python stable ABI:
https://pythoncapi.readthedocs.io/stable_abi.html

--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> Just so it doesn't get lost: the problem with the contract of 
> PyErr_ProgramText() which I mentioned in my dup 42568 is still there.

It seems like PyErr_ProgramText() is no longer used in Python. 
PyErr_ProgramTextObject() is used and it pass the filename as Python object to 
_Py_fopen_obj().

--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Thanks for the patch, Victor, it looks good.

Just so it doesn't get lost: the problem with the contract of 
PyErr_ProgramText() which I mentioned in my dup 42568 is still there.

--

___
Python tracker 

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



[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> Understanding that seems to be required to deal with issue 32381.

I wrote PR 23642 to fix bpo-32381.

--

___
Python tracker 

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



[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> Could somebody share the current intended status/role of these helpers?

To implement PEP 446: create non-inheritable file descriptors.

--

___
Python tracker 

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



[issue42558] waitpid/waitid race caused by change to Popen.send_signal in Python 3.9

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

If you care about race conditions in send_signal(), I suggest you to write a PR 
to use the newly added os.pidfd_open() in subprocess:
https://docs.python.org/dev/library/os.html#os.pidfd_open

--

___
Python tracker 

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



[issue42116] Inspect library ignore comments at the end of a function (inspect.getsource)

2020-12-04 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +22511
pull_request: https://github.com/python/cpython/pull/23643

___
Python tracker 

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



[issue42116] Inspect library ignore comments at the end of a function (inspect.getsource)

2020-12-04 Thread Tal Einat


Tal Einat  added the comment:


New changeset 6e1eec71f59c344fb23c7977061dc2c97b77d51b by Irit Katriel in 
branch 'master':
bpo-42116: Fix inspect.getsource handling of trailing comments (GH-23630)
https://github.com/python/cpython/commit/6e1eec71f59c344fb23c7977061dc2c97b77d51b


--

___
Python tracker 

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



[issue42116] Inspect library ignore comments at the end of a function (inspect.getsource)

2020-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22512
pull_request: https://github.com/python/cpython/pull/23644

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

bpo-42568 is marked 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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread STINNER Victor

STINNER Victor  added the comment:

I can reproduce the issue on Python 3.10 with a script called 北京市.py which 
contains: print("hello").

c:\> python 北京市.py
hello

c:\>python __pycache__\北京市.cpython-310.pyc
python: Can't reopen .pyc file

And with my PR 23642 fix, it works as expected:

C:\>python __pycache__\北京市.cpython-310.pyc
hello

--

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22510
pull_request: https://github.com/python/cpython/pull/23642

___
Python tracker 

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Thanks, Eryk, for catching the dup, I missed it somehow.

@ZackerySpytz: do you plan to proceed with your PR? If not, I can pick it up -- 
this issue broke the software I develop after upgrade to 3.8.

I filed issue 42569 to hopefully clarify the status of _Py_fopen() which became 
murky to me.

--
nosy: +izbyshev

___
Python tracker 

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



[issue42563] max function reports type errors in incorrect order

2020-12-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

I don't think making a change would be worth the risk.

--
nosy: +eric.smith
priority: low -> normal
versions: +Python 3.8 -Python 3.10

___
Python tracker 

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



[issue38352] In typing docs, note explicit import needed for IO and Pattern/Match

2020-12-04 Thread Guido van Rossum

Guido van Rossum  added the comment:

Wait, is the OP maybe that there’s a difference between typeshed an the stdlib 
typing.py?

--

___
Python tracker 

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



[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-04 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

Before addition of audit hooks in 3.8, _Py_fopen() and _Py_wfopen() were simple 
wrappers around corresponding C runtime functions. They didn't require GIL, 
reported errors via errno and could be safely called during early interpreter 
initialization.

With the addition of PySys_Audit() calls, they can also raise an exception, 
which makes it unclear how they should be used. At least one caller[1] is 
confused, so an early-added hook (e.g. from sitecustomize.py) that raises a 
RuntimeError on at attempt to open the main file causes the following:

$ ./python /home/test/test.py
./python: can't open file '/home/test/test.py': [Errno 22] Invalid argument
Traceback (most recent call last):
  File "/home/test/.local/lib/python3.10/site-packages/sitecustomize.py", line 
10, in hook
raise RuntimeError("XXX")
RuntimeError: XXX

"Invalid argument" is reported by pymain_run_file() due to a bogus errno, and 
the real problem (exception from the hook) is noticed only later.

Could somebody share the current intended status/role of these helpers? 
Understanding that seems to be required to deal with issue 32381.

[1] https://github.com/python/cpython/blob/066394018a84/Modules/main.c#L314

--
components: Interpreter Core
messages: 382499
nosy: izbyshev, steve.dower, vstinner
priority: normal
severity: normal
status: open
title: Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit 
hooks
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



[issue42558] waitpid/waitid race caused by change to Popen.send_signal in Python 3.9

2020-12-04 Thread Jack O'Connor


Jack O'Connor  added the comment:

Right, the example above is contrived to demonstrate the race and the crash.

In real life code, the good reason I know of to write code like this is to use 
os.waidid(WNOWAIT) to solve the wait/kill race properly. This is what Duct has 
been doing, and Nathaniel Smith also described this strategy in 
https://bugs.python.org/issue38630. The idea is that a waiting thread follows 
these steps:

1. waitid() with WNOWAIT set, without locking the child
2. after waitid returns, indicating the child has exited, lock the child
3. waitid() without WNOWAIT, or just waitpid(), to reap the zombie child
4. stash the exit status and unlock

Meanwhile a killing thread follows these steps:

1. lock the child
2. check the stashed exit status, and unlock and exit early if it's set
3. otherwise, signal the child and unlock

This strategy solves the race. The killing thread is free to signal while the 
waiting thread is blocked in step 1. If the killing thread happens to race in 
between when waitid() returns and when the waiting thread acquires the child 
lock, the child is a zombie and the kill signal has no effect. This is safe 
even if other threads (or e.g. the OOM killer) can randomly kill our child: 
*they* might have to worry about PID reuse, but their signals can never cause 
*us* to kill an unrelated process. What breaks this scheme is if some thread 
calls waitpid() and reaps the child outside of the lock, but normally that'd be 
a pretty unreasonable thing to do, especially since it can only be done by 
other threads in the parent process. (There's also some complexity around 
whether multiple threads are allowed to call waitid(WNOWAIT) on the same PID at 
the same time. I've just had one thread call it, and had other blocking waiters 
block on a second lock, but maybe that's overcautious.)

So anyway, if you use the strategy above -- precisely because you care about 
the PID reuse race and want to solve it properly -- and you also happen to use 
Popen.kill(), then changing Popen.send_signal to reap the child can break you.

I don't think this is a bug per se, but it's a behavior change, which matters 
to a small set of (abnormally) correct programs. But then again, if Duct is the 
only project that hits this in practice, maybe I'm making a mountain out of a 
molehill :)

--

___
Python tracker 

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



[issue38352] In typing docs, note explicit import needed for IO and Pattern/Match

2020-12-04 Thread Walter Dörwald

Walter Dörwald  added the comment:

Shadowing the real modules `re` and `io` by

   from typing import *

would indeed be bad, but that argument IMHO doesn't hold for the types `IO`, 
`TextIO` and `BinaryIO`, yet they are not listed in `typing.__all__`. Is there 
a reason for that? And if not, could `IO`, `TextIO` and `BinaryIO` be added to 
`typing.__all__`?

--
nosy: +doerwalter

___
Python tracker 

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



[issue41473] test_gdb fails on AMD64 Fedora Rawhide 3.x [gdb 9.2 bug]

2020-12-04 Thread miss-islington


miss-islington  added the comment:


New changeset c7cf66d2fe1b85cc02153be6422dfc5e34811638 by Miss Islington (bot) 
in branch '3.9':
bpo-41473: Reenable test_gdb on gdb 9.2 and newer (GH-23637)
https://github.com/python/cpython/commit/c7cf66d2fe1b85cc02153be6422dfc5e34811638


--

___
Python tracker 

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



[issue41473] test_gdb fails on AMD64 Fedora Rawhide 3.x [gdb 9.2 bug]

2020-12-04 Thread miss-islington


miss-islington  added the comment:


New changeset 8e8f82dd9459b9f62c21480528d737cffd6146bc by Miss Islington (bot) 
in branch '3.8':
bpo-41473: Reenable test_gdb on gdb 9.2 and newer (GH-23637)
https://github.com/python/cpython/commit/8e8f82dd9459b9f62c21480528d737cffd6146bc


--

___
Python tracker 

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



[issue41473] test_gdb fails on AMD64 Fedora Rawhide 3.x [gdb 9.2 bug]

2020-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22509
pull_request: https://github.com/python/cpython/pull/23641

___
Python tracker 

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



[issue41473] test_gdb fails on AMD64 Fedora Rawhide 3.x [gdb 9.2 bug]

2020-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22508
pull_request: https://github.com/python/cpython/pull/23640

___
Python tracker 

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



[issue41473] test_gdb fails on AMD64 Fedora Rawhide 3.x [gdb 9.2 bug]

2020-12-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 066394018a8463643cc63d933493f0afa99d72cc by Victor Stinner in 
branch 'master':
bpo-41473: Reenable test_gdb on gdb 9.2 and newer (GH-23637)
https://github.com/python/cpython/commit/066394018a8463643cc63d933493f0afa99d72cc


--

___
Python tracker 

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



[issue42568] Python can't run .pyc files with non-ASCII path on Windows

2020-12-04 Thread Eryk Sun


Change by Eryk Sun :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Python 3.6 cannot reopen .pyc file with non-ASCII path

___
Python tracker 

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



[issue42562] dis failed to parse function that has only annotations

2020-12-04 Thread Mark Shannon


Mark Shannon  added the comment:

Thanks Yurii

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



[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread Eryk Sun


Change by Eryk Sun :


--
versions: +Python 3.10

___
Python tracker 

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



[issue42246] Implement PEP 626

2020-12-04 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset eaccc12aa986f92ea05f3f0a63cedbff78dd67f1 by Mark Shannon in 
branch 'master':
bpo-42246: Don't forget the entry block when ensuring that all exits have a 
line number (GH-23636)
https://github.com/python/cpython/commit/eaccc12aa986f92ea05f3f0a63cedbff78dd67f1


--

___
Python tracker 

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



[issue42562] dis failed to parse function that has only annotations

2020-12-04 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset f24b8101a01fa98b1e3ec042ba896aeb4c24d4bc by Yurii Karabas in 
branch 'master':
bpo-42562: Fix issue when dis failed to parse function that has no line numbers 
(GH-23632)
https://github.com/python/cpython/commit/f24b8101a01fa98b1e3ec042ba896aeb4c24d4bc


--

___
Python tracker 

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



[issue42568] Python can't run .pyc files with non-ASCII path on Windows

2020-12-04 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

> python тест.pyc
python: Can't reopen .pyc file

The issue is caused by _Py_fopen() being used as though it can deal with paths 
encoded in FS-default encoding (UTF-8 by default on Windows), but in fact it's 
just a simple wrapper around fopen() from the C runtime, so it uses the current 
ANSI code page, breaking if PYTHONLEGACYWINDOWSFSENCODING is not enabled.

I could find only two callers if _Py_fopen() on Windows:

* https://github.com/python/cpython/blob/db68544122f5/Python/pythonrun.c#L380 
(which caused this issue)

* https://github.com/python/cpython/blob/db68544122f5/Python/errors.c#L1708

PyErr_ProgramText() doesn't seem to be called in CPython, but 
https://github.com/python/cpython/blob/db68544122f5/Include/pyerrors.h#L243 
claims that filename is "decoded from the filesystem encoding", which doesn't 
match the code.

--
components: Interpreter Core, Windows
messages: 382490
nosy: izbyshev, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: Python can't run .pyc files with non-ASCII path on Windows
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



[issue42567] Enum: manually call __init_subclass__ after members are added

2020-12-04 Thread Ethan Furman


New submission from Ethan Furman :

__init_subclass__ is being automatically called when the initial Enum is 
created, but before the members have been added, greatly reducing that method's 
usefulness.

--
assignee: ethan.furman
components: Library (Lib)
messages: 382489
nosy: ethan.furman
priority: normal
severity: normal
stage: needs patch
status: open
title: Enum: manually call __init_subclass__ after members are added
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue42554] distutils.util.get_platform() depends on minor version for macOS 11

2020-12-04 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

> Now, the next minor releases will be 11.0.1 (that has shipped already), 
> 11.1.0 (will ship soon), then either 11.1.1 or 11.2.0 (we don't know). The 
> next major version will of course be 12.0.0.
> 
> The question is: for 11.1.x or 11.2.x, which are minor updates, should 
> the pypi/wheel tags increase to 11_1 and 11_2, or stay at 11_0? Has 
> that been decided, and will be applied consistently? (11_0 makes more 
> sense, and it is what wheel is currently applying)

It depends :-)

We should advise everyone to build for deployment target 11.0 (and or 12.0 next 
year *if necessary*), but IMHO we shouldn't enforce this is in the stdlib.

If someone decides they want to build with MACOSX_DEPLOYMENT_TARGET=11.3 that's 
their choice and should be reflected in the result of get_platform(). We 
shouldn't default to that though just because you're building on macOS 11.3. 

Something we can work on is an informational PEP that describes the best way to 
build wheels on macOS, in cooperation with the PyPA, delocate, ciwheelbuild, 
and whoever else is interested in this.  And then try to teach the tooling to 
do the right thing.

In most cases it should be fairly easy to create wheels that target an earlier 
version of macOS (like the installers on Python.org).  The annoying part are 
(C) libraries with configure scripts that can detect and use functions that 
aren't available on the deployment target. For most libraries that I've created 
bindings for (most of them in-house) this hasn't been a problem in practice, 
but that's a very limited sample. 

Sorry about going of on a tangent, none of this is relevant for this particular 
issue ;-)

--

___
Python tracker 

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



[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-12-04 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 4.0 -> 5.0
pull_requests: +22507
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23639

___
Python tracker 

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



[issue42554] distutils.util.get_platform() depends on minor version for macOS 11

2020-12-04 Thread FX Coudert


FX Coudert  added the comment:

> having "11.0" as the version a number is ship that has sailed

I understand. What is needed is consistency and predictability.

Now, the next minor releases will be 11.0.1 (that has shipped already), 11.1.0 
(will ship soon), then either 11.1.1 or 11.2.0 (we don't know). The next major 
version will of course be 12.0.0.

The question is: for 11.1.x or 11.2.x, which are minor updates, should the 
pypi/wheel tags increase to 11_1 and 11_2, or stay at 11_0? Has that been 
decided, and will be applied consistently? (11_0 makes more sense, and it is 
what wheel is currently applying)

--

___
Python tracker 

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



[issue42470] DeprecationWarning triggers for sequences which happen to be sets as well

2020-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Open it against master.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



  1   2   >