[issue42509] Recursive calls crash interpreter when checking exceptions

2020-11-29 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

This might be the expected behavior. See https://bugs.python.org/issue25222

If you already caught a RecursionError and you keep recursing anyway, once you 
go 50 levels beyond sys.getrecursionlimit(), the interpreter crashes regardless 
of what is `except`ed. In /Python/ceval.c, there's this:

if (tstate->overflowed) {
if (tstate->recursion_depth > recursion_limit + 50) {
/* Overflowing while handling an overflow. Give up. */
Py_FatalError("Cannot recover from stack overflow.");
}
return 0;
}

In your Program 2, when the interpreter raises a `RecursionError`, it is raised 
normally and everything is fine.

In your Program 1, when the interpreter raises a `RecursionError`, it is 
`except`ed, so the interpreter thinks it's okay to keep going, and when it 
does, it raises more `RecursionError`s, which it keeps `except`ing, until it 
finally can't go any farther ( > 50 + sys.getrecursionlimit()), and has no 
option but to crash.

"Cannot recover from stack overflow." seems to make sense to me: when the 
interpreter tries to recover, the code won't let it.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue42509] Recursive calls crash interpreter when checking exceptions

2020-11-29 Thread Xinmeng Xia

New submission from Xinmeng Xia :

The following program 1 can crash in Python 3. We have reproduce it in the 
Python version 3.5, 3.6, 3.7, 3.8, 3.9, 3.10. This bug seems to be similar to 
issue 36272, however, the tracking system shows issue 36272 has been fixed and 
the program 2, which triggers issue 36272, will not cause crash (“core dump”) 
in Python 3.8, 3.9, 3.10.
We have attached the stack trace in the end of this report.

Program 1: 

import logging

def rec():
try:
logging.error("foo")
except:
pass
rec()
rec()


Program 2: 

import logging

def rec():
logging.error("foo")
rec()
rec()
==
The error message is like following:
“
ERROR:root:foo
ERROR:root:foo
ERROR:root:foo
ERROR:root:foo
…
ERROR:root:foo
ERROR:root:foo
ERROR:root:foo
Fatal Python error: _Py_CheckRecursiveCall: Cannot recover from stack overflow.
Python runtime state: initialized

Current thread 0x7f0fa440b700 (most recent call first):
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 420 in 
usesTime
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 643 in 
usesTime
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 675 in 
format
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 938 in 
format
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1094 in 
emit
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 963 in 
handle
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1673 in 
callHandlers
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1611 in 
handle
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1601 in 
_log
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1483 in 
error
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 2080 in 
error
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 8 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
….
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  ...
Aborted (core dumped)”

--
components: Interpreter Core
messages: 382111
nosy: xxm
priority: normal
severity: normal
status: open
title: Recursive calls crash interpreter when checking exceptions
type: crash
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



[issue42508] macOS IDLE with Tk 8.6.10 in 3.9.1rc1 universal2 installer fails smoke test

2020-11-29 Thread Ned Deily


New submission from Ned Deily :

An IDLE installation manual smoke test gives odd behavior when run on macOS 
using the Tcl/Tk 8.6.10 introduced with the new macOS universal2 installer 
variant as of 3.9.1rc1.  The test behaves as expected (without the duplicate 
and spurious error messages) when run using the traditional macOS 10.9 
installer variant that includes Tcl/Tk 8.6.8 built on macOS 10.9.

The test consists of: 
- launch the new IDLE by double-clicking on its icon in the applicable 
/Applications/Python 3.x folder
- press cmd-N to open a new edit window
- enter a three-line snippet with a syntax error, something like:
  x = 1
  y = $2
  print(x,y)
- press cmd-S to save the file entering any valid file name
- press F5 to run the snippet
- observe the popup "Invalid syntax" error window
- click OK to dismiss and observe previous "Invalid syntax" window replaced by 
an identical error window [ERROR]
- click OK to dismiss
- remove the syntax error and press cmd-S to resave
- press F5 to run again
- observe the output of the print function in the IDLE shell window
- observe popup error window over IDLE shell window with "The Python Shell 
window is already executing a command: please wait until it is finished." 
[ERROR]
- click OK to dismiss and observe previous "already executing" window replaced 
by an identical error window [ERROR]
- click OK to dismiss
- press cmd-Q to quit IDLE

As we are planning to introduce the universal2 installer variant on 3.8.x and 
3.10 to natively support Apple Silicon Macs and macOS 11 Big Sur, a quick 
resolution of this issue is important. While automated tests in the test suite 
show no new failures, it would be good to manually exercise IDLE in the new 
installer configuration to look for other unusual behaviors.

https://www.python.org/downloads/release/python-391rc1/

--
assignee: terry.reedy
components: IDLE, Tkinter, macOS
messages: 382110
nosy: ned.deily, ronaldoussoren, terry.reedy
priority: critical
severity: normal
status: open
title: macOS IDLE with Tk 8.6.10 in 3.9.1rc1 universal2 installer fails smoke 
test
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



[issue42507] test_ttk_guionly test failures on macOS with Tcl/Tk 8.6.10

2020-11-29 Thread Ned Deily


Change by Ned Deily :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42507] test_ttk_guionly test failures on macOS with Tcl/Tk 8.6.10

2020-11-29 Thread Ned Deily


New submission from Ned Deily :

As of 3.9.1rc1 (and coming soon to 3.10.x and 3.8.x), we now provide a new 
additional macOS universal2 installer variant that, for various reasons, 
provides a built-in version of Tcl/Tk 8.6.10, instead of 8.6.8 as has been 
provided with the 10.9 installer variant.  Using 8.6.10 on nacOS, six 
test_ttk_guionly tests fail while passing using 8.6.8 ib nacOS. Similar results 
were obtained when running the tests on either macOS 10.15.7 or 11.0.1. The 
failures:

==
FAIL: test_identify (tkinter.test.test_ttk.test_widgets.ComboboxTest)
--
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py",
 line 334, in test_identify
self.assertIn(self.entry.identify(5, 5),
AssertionError: '' not found in ('textarea', 'Combobox.button')

==
FAIL: test_identify (tkinter.test.test_ttk.test_widgets.EntryTest)
--
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py",
 line 334, in test_identify
self.assertIn(self.entry.identify(5, 5),
AssertionError: '' not found in ('textarea', 'Combobox.button')

==
FAIL: test_command (tkinter.test.test_ttk.test_widgets.SpinboxTest)
--
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py",
 line 1155, in test_command
self.assertTrue(success)
AssertionError: [] is not true

==
FAIL: test_identify (tkinter.test.test_ttk.test_widgets.SpinboxTest)
--
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py",
 line 334, in test_identify
self.assertIn(self.entry.identify(5, 5),
AssertionError: 'Spinbox.field' not found in ('textarea', 'Combobox.button')

==
FAIL: test_bbox (tkinter.test.test_ttk.test_widgets.TreeviewTest)
--
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py",
 line 1353, in test_bbox
self.assertIsBoundingBox(bbox)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/widget_tests.py",
 line 197, in assertIsBoundingBox
self.assertIsInstance(bbox, tuple)
AssertionError: '' is not an instance of 

==
FAIL: test_identify (tkinter.test.test_ttk.test_widgets.WidgetTest)
--
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py",
 line 68, in test_identify
self.assertEqual(self.widget.identify(
AssertionError: '' != 'label'
+ label


https://www.python.org/downloads/release/python-391rc1/

--
components: Tkinter, macOS
messages: 382109
nosy: ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: test_ttk_guionly test failures on macOS with Tcl/Tk 8.6.10
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



[issue42195] Inconsistent __args__ between typing.Callable and collections.abc.Callable

2020-11-29 Thread Shantanu


Shantanu  added the comment:

You're right that Callable[[P], int] is invalid, so a flat representation isn't 
currently ambiguous. But a flat representation would foist the responsibility 
for checking that to all users of `__args__`. If your code isn't ParamSpec 
aware, your failures will probably be less obvious or even silent.

The flat representation trades off a) implementation complexity with b) 
usability / aesthetics, c) future proof-ness. I'm not morally opposed to such a 
tradeoff / am happy to defer to people with more experience in making such 
tradeoffs.

--

___
Python tracker 

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



[issue12920] inspect.getsource only works for objects loaded from files, not interactive session

2020-11-29 Thread Alexey Volkov


Alexey Volkov  added the comment:

This is also an issue even for non-interactive scenarios:

When doing `python -c ''` inspect.getsource does not work and there 
are no stack traces.

Perhaps this case will be easier to fix?

--
nosy: +Ark-kun

___
Python tracker 

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



[issue42506] Unexpected output when running test_format

2020-11-29 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue42474] improve test coverage for TracebackException's __eq__

2020-11-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks!

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



[issue42474] improve test coverage for TracebackException's __eq__

2020-11-29 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset d82e08d185d52086f4d921c08b853c76c80bebbe by Irit Katriel in 
branch '3.8':
[3.8] bpo-42474: test TracebackException comparison to non-equal instances 
(GH-23558)
https://github.com/python/cpython/commit/d82e08d185d52086f4d921c08b853c76c80bebbe


--

___
Python tracker 

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



[issue42474] improve test coverage for TracebackException's __eq__

2020-11-29 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 586bdd1add2ca7236e3096ab7167862cf17f0939 by Irit Katriel in 
branch '3.9':
[3.9] bpo-42474: test TracebackException comparison to non-equal instances 
(GH-23557)
https://github.com/python/cpython/commit/586bdd1add2ca7236e3096ab7167862cf17f0939


--

___
Python tracker 

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



[issue42195] Inconsistent __args__ between typing.Callable and collections.abc.Callable

2020-11-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

Now that I've seen and reviewed KJ's implementation using _PosArgs, I am 
worried about it, as it looks quite complicated. @Shantanu, do we really need 
to worry that Callable[P, R] could be ambiguous? If P is a ParamSpec, wouldn't 
Callable[[P], R] be invalid?

--

___
Python tracker 

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



[issue41837] Upgrade installers to OpenSSL 1.1.1h

2020-11-29 Thread Ned Deily


Ned Deily  added the comment:

Christian, ping?

--

___
Python tracker 

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



[issue42455] Add decorator_factory function to functools module

2020-11-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I've add Nick so that he can opine.  For me, I'm -0 on this one. It does 
factor-out a common pattern, but I find it less obvious what it does and would 
not enjoy debugging code that used this decorator.

The idea is definitely interesting and worth discussing.  If Nick doesn't come 
along shortly, please bring this up on python-ideas.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue42506] Unexpected output when running test_format

2020-11-29 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue42506] Unexpected output when running test_format

2020-11-29 Thread Zackery Spytz


New submission from Zackery Spytz :

./python -We -m test test_format
0:00:00 load avg: 0.64 Run tests sequentially
0:00:00 load avg: 0.64 [1/1] test_format
Unexpected   : '%d format: a real number is required, not 
str'
Unexpected   : '%d format: a real number is required, not 
str'
Unexpected   : '%d format: a real number is required, not 
bytes'
Unexpected   : '%d format: a real number is required, not 
bytes'

== Tests result: SUCCESS ==

1 test OK.

Total duration: 180 ms
Tests result: SUCCESS


This seems to be due to the changes in bpo-41974 / 
e2ec0b27c02a158d0007c11dcc1f2d7a95948712.

--
components: Tests
messages: 382100
nosy: ZackerySpytz
priority: normal
severity: normal
status: open
title: Unexpected output when running test_format
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



[issue34570] Segmentation fault in _PyType_Lookup

2020-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

Python 2.7 is no longer supported. If you are having the issue with Python 3, 
please open a new issue.

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

___
Python tracker 

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



[issue18213] py-bt errors on backtrace with PyRun_SimpleString and friends

2020-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

Python 2-only issue.

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

___
Python tracker 

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



[issue42406] Importing multiprocessing breaks pickle.whichmodule

2020-11-29 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

thanks Renato!

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

___
Python tracker 

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



[issue42501] Improve error messages for argparse choices using enum

2020-11-29 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



[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

How does PR 23563 look to you all?

--

___
Python tracker 

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



[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue42497] New pathlib.Path attribute

2020-11-29 Thread ThatXliner


ThatXliner  added the comment:

Ok, so I just made a patch implementing this using os.access. It adds the 
following methods to pathlib.Path

 - can_read= Returns True if the user can read the path
 - can_write   = Returns True if the user can write on the path
 - can_execute = Returns True if the user can execute the path

These are implemented via

 - return os.access(str(self), os.R_OK)
 - return os.access(str(self), os.W_OK)
 - return os.access(str(self), os.X_OK)

respectively.

--
keywords: +patch
Added file: https://bugs.python.org/file49637/implement.patch

___
Python tracker 

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



[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread paul j3


paul j3  added the comment:

choices is fine for a few strings, but quickly becomes awkward with other types 
and large numbers.  The testing isn't an issue, since it just does a simple 
`in/contains` test.  But display, whether in usage, help or error, is 
problematic if you try anything too fancy.  metavar gets around some of those 
issues, but doesn't change the error messages.

Custom type or action is the best alternative.

I'm in favor omitting the enums mention in the docs, since it seems to be more 
confusing than helpful.

--

___
Python tracker 

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



[issue42495] socket.gethostbyaddr raises error if invalid unicode in hosts

2020-11-29 Thread Christian Heimes


Christian Heimes  added the comment:

I cannot reproduce the issue on Linux:

# echo "127.0.0.2 xn-9q8h" >> /etc/hosts
# python3.8
>>> import socket
>>> socket.gethostbyaddr("127.0.0.2")
('xn-9q8h', [], ['127.0.0.2'])

--
nosy: +christian.heimes
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue29732] Heap out of bounds read in tok_nextc()

2020-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

Kamil, I got the same result as Batuhan on a recent version. Are you seeing 
this on Python 3, or is it a python 2.7 issue?

--
nosy: +iritkatriel
status: open -> pending

___
Python tracker 

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



[issue41734] Refactor b32{encode,decode} tests

2020-11-29 Thread Filipe Laíns

Filipe Laíns  added the comment:

Friendly ping on this.

--

___
Python tracker 

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



[issue42450] Docstrings in itertools recipes should have triple-quotes

2020-11-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset a83119d7be95dd3f5ff22abe289da6091584f853 by Miss Islington (bot) 
in branch '3.9':
bpo-42450: Minor updates to the itertools recipes (GH-23555) (GH-23562)
https://github.com/python/cpython/commit/a83119d7be95dd3f5ff22abe289da6091584f853


--

___
Python tracker 

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



[issue39096] "Format Specification Mini-Language" doc mistake for Decimal

2020-11-29 Thread Mark Dickinson


Mark Dickinson  added the comment:

The 'default precision' issue is addressed; the issues that Michael reported 
about the `None` presentation type are still valid, I think.

--

___
Python tracker 

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



[issue42450] Docstrings in itertools recipes should have triple-quotes

2020-11-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset fc40b3020cf3c869833fd5d3720cf9768fe3bb46 by Raymond Hettinger in 
branch 'master':
bpo-42450: Minor updates to the itertools recipes (GH-23555)
https://github.com/python/cpython/commit/fc40b3020cf3c869833fd5d3720cf9768fe3bb46


--

___
Python tracker 

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



[issue42406] Importing multiprocessing breaks pickle.whichmodule

2020-11-29 Thread miss-islington


miss-islington  added the comment:


New changeset fcf7391f598e027a083173662a3ecf7865251291 by Miss Islington (bot) 
in branch '3.9':
bpo-42406: Fix whichmodule() with multiprocessing (GH-23403)
https://github.com/python/cpython/commit/fcf7391f598e027a083173662a3ecf7865251291


--

___
Python tracker 

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



[issue42450] Docstrings in itertools recipes should have triple-quotes

2020-11-29 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +22443
pull_request: https://github.com/python/cpython/pull/23562

___
Python tracker 

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



[issue42406] Importing multiprocessing breaks pickle.whichmodule

2020-11-29 Thread miss-islington


miss-islington  added the comment:


New changeset b1c48e513624641d6472262c33d09624170ea1f5 by Miss Islington (bot) 
in branch '3.8':
bpo-42406: Fix whichmodule() with multiprocessing (GH-23403)
https://github.com/python/cpython/commit/b1c48e513624641d6472262c33d09624170ea1f5


--

___
Python tracker 

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



[issue42406] Importing multiprocessing breaks pickle.whichmodule

2020-11-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22442
pull_request: https://github.com/python/cpython/pull/23561

___
Python tracker 

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



[issue42406] Importing multiprocessing breaks pickle.whichmodule

2020-11-29 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +22441
pull_request: https://github.com/python/cpython/pull/23560

___
Python tracker 

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



[issue42406] Importing multiprocessing breaks pickle.whichmodule

2020-11-29 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 86684319d3dad8e1a7b0559727a48e0bc50afb01 by Renato Cunha in 
branch 'master':
bpo-42406: Fix whichmodule() with multiprocessing (GH-23403)
https://github.com/python/cpython/commit/86684319d3dad8e1a7b0559727a48e0bc50afb01


--

___
Python tracker 

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



[issue42497] New pathlib.Path attribute

2020-11-29 Thread ThatXliner


ThatXliner  added the comment:

Now I think of it, it would be weird to just add attributes testing for 
executable permissions. Why not add the attributes from os.access to 
pathlib.Path?

 - Path.can_execute = os.access(path, os.X_OK)
 - Path.can_read= os.access(path, R_OK) 
...

--

___
Python tracker 

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



[issue42497] New pathlib.Path attribute

2020-11-29 Thread ThatXliner


ThatXliner  added the comment:

Also, an App (at least on MacOS) is technically an executable (I've ran 
iMessage from the command line before).

--

___
Python tracker 

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



[issue42497] New pathlib.Path attribute

2020-11-29 Thread ThatXliner


ThatXliner  added the comment:

Since pathlib.Path has module os synonyms, I think it would be reasonable to 
test with os.X_OK. Correct me if I'm wrong.

I think most people would want to check if the current user running the script 
could execute something.

--
type:  -> enhancement

___
Python tracker 

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



[issue42437] crypt produces wrong hashes for passwords containing dollar sign

2020-11-29 Thread Eric V. Smith


Change by Eric V. Smith :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue35534] SIGSEGV in stackdepth_walk

2020-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

Python 2-only issue.

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

___
Python tracker 

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



[issue10312] intcatcher() can deadlock

2020-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

This is a python 2-only issue.

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

___
Python tracker 

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



[issue42392] remove the deprecated 'loop' parameter asyncio API

2020-11-29 Thread Yurii Karabas


Yurii Karabas <1998uri...@gmail.com> added the comment:

Looks like we have done everything, we can close this issue

--

___
Python tracker 

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



[issue33153] interpreter crash when multiplying large tuples

2020-11-29 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved

___
Python tracker 

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



[issue33153] interpreter crash when multiplying large tuples

2020-11-29 Thread Irit Katriel


Change by Irit Katriel :


--
stage: resolved -> 

___
Python tracker 

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



[issue33153] interpreter crash when multiplying large tuples

2020-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

This is a python 2-only issue.

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

___
Python tracker 

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



[issue41918] exec fails to take locals into account when running list comprehensions or functions

2020-11-29 Thread patterns


patterns  added the comment:

Also occurs in Python 3.6.9

--
nosy: +patterns

___
Python tracker 

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



[issue42474] improve test coverage for TracebackException's __eq__

2020-11-29 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +22440
pull_request: https://github.com/python/cpython/pull/23558

___
Python tracker 

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



[issue42474] improve test coverage for TracebackException's __eq__

2020-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

Yes.

I haven't managed to get the cherry-picker script working for me yet so this is 
a manual cherry-pick. 

I'm surprised the automatic backport failed - there was no merge conflict.

--

___
Python tracker 

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



[issue42474] improve test coverage for TracebackException's __eq__

2020-11-29 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +22439
pull_request: https://github.com/python/cpython/pull/23557

___
Python tracker 

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



[issue39096] "Format Specification Mini-Language" doc mistake for Decimal

2020-11-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

These changes are a big improvement. Thanks, Mark. Should this issue be closed, 
or are you thinking of more changes?

Personally I think we should leave it as it is now, and open another issue if 
people find fault with the new docs.

--

___
Python tracker 

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



[issue42504] Failure to build with MACOSX_DEPLOYMENT_TARGET=11 on Big Sur

2020-11-29 Thread FX Coudert


Change by FX Coudert :


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

___
Python tracker 

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



[issue42474] improve test coverage for TracebackException's __eq__

2020-11-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

Irit, can you,do the manual backports?

--

___
Python tracker 

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



[issue42504] Failure to build with MACOSX_DEPLOYMENT_TARGET=11 on Big Sur

2020-11-29 Thread James Guillochon


Change by James Guillochon :


--
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue42505] MACOSX_DEPLOYMENT_TARGET should accept non-decimal (int) value versions

2020-11-29 Thread James Guillochon


James Guillochon  added the comment:

Closing in favor of https://bugs.python.org/issue42504 which has more details

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



[issue42505] MACOSX_DEPLOYMENT_TARGET should accept non-decimal (int) value versions

2020-11-29 Thread James Guillochon


New submission from James Guillochon :

See the discussion here 
https://github.com/Homebrew/homebrew-core/pull/65866#issuecomment-735366297, 
but this is currently a blocker for compilation via home-brew on Apple Silicon. 
Current workaround is to set the deployment target to "11.0" (rather than the 
"11" currently passed into it, which should be valid).

--
components: macOS
messages: 382072
nosy: guillochon, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: MACOSX_DEPLOYMENT_TARGET should accept non-decimal (int) value versions
type: compile error
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



[issue42504] Failure to build with MACOSX_DEPLOYMENT_TARGET=11 on Big Sur

2020-11-29 Thread FX Coudert


New submission from FX Coudert :

With macOS Big Sur (11.y.z), the major version is 11 (instead of the earlier 
10.15, 10.14, etc). Therefore, MACOSX_DEPLOYMENT_TARGET=11 has become a valid 
setting. It is accepted by system tools:

$ MACOSX_DEPLOYMENT_TARGET=11 clang a.c && echo $?
0

But it leads to failure in Python compilation in setup.py:

DYLD_FRAMEWORK_PATH=/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0 
CC='clang' LDSHARED='clang -bundle -undefined dynamic_lookup -isysroot 
/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk   ' OPT='-DNDEBUG -g 
-fwrapv -O3 -Wall'   _TCLTK_INCLUDES='' _TCLTK_LIBS=''   ./python.exe -E 
./setup.py  build
running build
running build_ext
Traceback (most recent call last):
  File "/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/./setup.py", 
line 2614, in 
main()
  File "/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/./setup.py", 
line 2584, in main
setup(# PyPI Metadata (PEP 301)
  File 
"/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/Lib/distutils/core.py",
 line 148, in setup
dist.run_commands()
  File 
"/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/Lib/distutils/dist.py",
 line 966, in run_commands
self.run_command(cmd)
  File 
"/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/Lib/distutils/dist.py",
 line 985, in run_command
cmd_obj.run()
  File 
"/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/Lib/distutils/command/build.py",
 line 135, in run
self.run_command(cmd_name)
  File 
"/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/Lib/distutils/cmd.py",
 line 313, in run_command
self.distribution.run_command(command)
  File 
"/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/Lib/distutils/dist.py",
 line 985, in run_command
cmd_obj.run()
  File 
"/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/Lib/distutils/command/build_ext.py",
 line 340, in run
self.build_extensions()
  File "/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/./setup.py", 
line 470, in build_extensions
self.detect_modules()
  File "/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/./setup.py", 
line 1807, in detect_modules
self.detect_readline_curses()
  File "/private/tmp/python@3.9-20201127-81873-q9b09s/Python-3.9.0/./setup.py", 
line 1038, in detect_readline_curses
(tuple(int(n) for n in dep_target.split('.')[0:2])
AttributeError: 'int' object has no attribute 'split'
make: *** [sharedmods] Error 1

See the full report here: https://github.com/Homebrew/brew/issues/9329

The problem is here: 
https://github.com/python/cpython/blob/master/setup.py#L1015
When MACOSX_DEPLOYMENT_TARGET=11, this call:
sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
returns an int (with value 11) instead of a string (as is the case if 11.0, 
10.15, etc).

And therefore the subsequent call to: dep_target.split('.')[0:2] fails, because 
split() cannot be called on an int.

--
components: Build
messages: 382071
nosy: fxcoudert
priority: normal
severity: normal
status: open
title: Failure to build with MACOSX_DEPLOYMENT_TARGET=11 on Big Sur
type: compile error
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



[issue42500] crash with unbounded recursion in except statement

2020-11-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

Note that changing the os.fstat line to just "raise OSError()" no longer causes 
the "Fatal Python error", but rather gives the expected recursion exception.

Here's a shorter version that causes the fatal error in Windows native 3.9, 
cygwin 3.8.3, and Fedora Linux 3.7.7. So this isn't new with 3.9.

import os

def status():
try:
st = os.fstat(4)
except status() as e:
pass

status()

--

___
Python tracker 

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



[issue42455] Add decorator_factory function to functools module

2020-11-29 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
title: Add decorator_with_params function to functools module -> Add 
decorator_factory function to functools module

___
Python tracker 

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



[issue42500] crash with unbounded recursion in except statement

2020-11-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

Here's the smallest reproducer I could come up with. It fails on Windows with 
3.9 native(compiled locally) (Fatal Python error: _Py_CheckRecursiveCall: 
Cannot recover from stack overflow), works (raises RecursionError) with cygwin 
3.8.3.

import os

def status():
for fd in range(4):
try:
st = os.fstat(fd)
except status() as e:
pass

status()

--
nosy: +eric.smith

___
Python tracker 

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



[issue42455] Add decorator_with_params function to functools module

2020-11-29 Thread Yurii Karabas


Yurii Karabas <1998uri...@gmail.com> added the comment:

I agree, decorator factory definitely a better name

--

___
Python tracker 

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



[issue42502] Conflict between get_traced_memory and setrlimit

2020-11-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

1 KiB is too low for Python. The interpreter itself needs more than 10 MiB to 
start, and more if it imports some modules. I suppose that the limit set affect 
only new requests for memory from OS, but Python already have some free memory 
reserved in the memory pool.

With larger limit you can get more reliable data. Note that get_traced_memory() 
counts only dynamically allocated memory, it does not count static memory, 
stack memory and memory reserved for the memory pool.

--
nosy: +serhiy.storchaka, vstinner

___
Python tracker 

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



[issue42500] crash with unbounded recursion in except statement

2020-11-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +Mark.Shannon, serhiy.storchaka

___
Python tracker 

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



[issue42503] Cannot declare method or static function parameter or return type as self of the class

2020-11-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

You can already write such code in 3.10. In earlier Python versions you can 
either write annotation explicitly as string or (since 3.7) use and import 
suggested by Irit.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue42455] Add decorator_with_params function to functools module

2020-11-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I would call it decorator_factory.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42503] Cannot declare method or static function parameter or return type as self of the class

2020-11-29 Thread Irit Katriel


Irit Katriel  added the comment:

Add at the top of your script:

from __future__ import annotations

--
nosy: +iritkatriel

___
Python tracker 

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



[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread shangxiao


shangxiao  added the comment:

Oh apologies, I had "open" selected when I searched for prior issues.

Upon reading that issue I agree with Mr Hettinger's points about enum values 
not being a concern of the parser.

The solution for my needs was simple enough: I made my own action which simply 
set choices based on member values (I'm using user-friendly strings) and 
converted to the correct type upon being called [1].

Instead of removing any mention of enums from the docs - would a small example 
showing how to deal with them be worthwhile?


[1]
def enum_action_factory(enum_class):

class EnumAction(argparse.Action):
def __init__(self, option_strings, dest, **kwargs):
kwargs["choices"] = [member.value for member in enum_class]
super().__init__(option_strings, dest, **kwargs)

def __call__(self, parser, namespace, values, option_string):
if isinstance(values, str):
converted_values = enum_class(values)
else:
converted_values = [enum_class(value) for value in values]
setattr(namespace, self.dest, converted_values)

return EnumAction

--

___
Python tracker 

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



[issue42496] Don't change indentation of RST markup

2020-11-29 Thread Andrés Delfino

Andrés Delfino  added the comment:

When I open a PR fixing mark-up it's because it has visual effects.

--

___
Python tracker 

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



[issue42503] Cannot declare method or static function parameter or return type as self of the class

2020-11-29 Thread parsa mpsh


New submission from parsa mpsh :

python raises error `Undefined class X` when you declaring parameter type or 
return type of method as the self of class:

class MyClass:
def mymethod(self, a: MyClass): # parameter type is class self
pass

# or

class MyClass:
def mymethod(self) -> MyClass: # return type is class self
pass
# or both of them

error `Undefined class ...` will be raised.

--
messages: 382061
nosy: parsampsh
priority: normal
severity: normal
status: open
title: Cannot declare method or static function parameter or return type as 
self of the class
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, 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



[issue42392] remove the deprecated 'loop' parameter asyncio API

2020-11-29 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 86150d39c888579b65841f4391d054b7b3eff9f2 by Yurii Karabas in 
branch 'master':
bpo-42392: Remove deprecated loop parameter from docs (GH-23552)
https://github.com/python/cpython/commit/86150d39c888579b65841f4391d054b7b3eff9f2


--

___
Python tracker 

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



[issue42500] crash with unbounded recursion in except statement

2020-11-29 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

The value of the recursion limit is not relevant here, I get the same crash 
when I set the recursion limit to 100 (in my reproducer scriptlet).

There might be a missing recursion level check in the exception handling 
machinery though, self-recursion in an except-clause is rather unusual. But 
that's just a blind guess, I haven't though much about what is supposed to 
happen here.

--

___
Python tracker 

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



[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

https://bugs.python.org/issue25061 also had some discussion over error message 
display for enums

--
nosy: +xtreak

___
Python tracker 

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



[issue42500] crash with unbounded recursion in except statement

2020-11-29 Thread Vedran Čačić

Vedran Čačić  added the comment:

Recursion limit is probably set too high, but nonetheless, the program is 
nonsensical, the line 39 especially.

The reason for difference in behavior is that RecursionError is caught by blank 
except in the earlier Pythons, while it crashes the stack in later ones. In any 
case, it's almost certain this isn't what you wanted to write.

(And yet another reason to remove blank except from Python: it abuse to correct 
use ratio is probably over two orders of magnitude.)

--
nosy: +veky

___
Python tracker 

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



[issue42502] Conflict between get_traced_memory and setrlimit

2020-11-29 Thread Vipul Cariappa


New submission from Vipul Cariappa :

I would first like to thank the python developers, contributors and the 
community for this wonderful programming language.
I am trying to limit the memory consumption of a function; at the same time 
trying to figure out the maximum memory used during the execution of the same 
function. I have uploaded the source code and the output of the program I am 
using to achieve this.
The Memory Used is more than the Memory Limit I have set. Is this the expected 
output. Or a bug in the code. I am using Python3.8 in ubuntu 20.04 wsl. Any 
suggestion regarding implementing the functionality I have mentioned would be 
helpful.
And I am very very sorry if this is the expected output.
Thank You.

--
files: memory.py
messages: 382056
nosy: Vipul-Cariappa
priority: normal
severity: normal
status: open
title: Conflict between get_traced_memory and setrlimit
type: resource usage
versions: Python 3.8
Added file: https://bugs.python.org/file49636/memory.py

___
Python tracker 

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



[issue42450] Docstrings in itertools recipes should have triple-quotes

2020-11-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +22436
pull_request: https://github.com/python/cpython/pull/23555

___
Python tracker 

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



[issue42500] crash with unbounded recursion in except statement

2020-11-29 Thread Ronald Oussoren


Change by Ronald Oussoren :


--
title: status() crashes on Python3.9 and 3.10 -> crash with unbounded recursion 
in except statement

___
Python tracker 

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



[issue42500] status() crashes on Python3.9 and 3.10

2020-11-29 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

The crash is not nice, but

The script contains the following line in the definition of status():

except status() as e:

That will cause unbounded recursion when os.fstat raises an exception, which 
likely happens here. You probably want to catch OSError (or os.error) instead.


This scriptlet is a smaller reproduction of the problem:

def status():

   try:
  1/0

   except status():
  pass

status()

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm inclined to state in the docs that choices is designed to work with 
collections of strings and that there is no special support for enums.

Paul, what do you think?

--

___
Python tracker 

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



[issue42496] Don't change indentation of RST markup

2020-11-29 Thread Georg Brandl


Georg Brandl  added the comment:

To be clear, this has nothing to do with the amount of indentation, but that 
the directive below (the versionadded) has 4 spaces, and the paragraph above 
had 5 before the change. Therefore the further-indented paragraph is taken as a 
blockquote.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue42501] Improve error messages for argparse choices using enum

2020-11-29 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



[issue39529] Deprecate get_event_loop()

2020-11-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue42433] mailbox.mbox fails on non ASCII characters

2020-11-29 Thread Florian Klink


Florian Klink  added the comment:

I opened https://github.com/python/cpython/pull/23553 - PTAL.

I made this an enhancement for 3.10 - but it could probably also be backported 
to older versions

--
keywords: +patch
message_count: 4.0 -> 5.0
pull_requests: +22434
stage:  -> patch review
type:  -> enhancement
versions:  -Python 3.8, Python 3.9
pull_request: https://github.com/python/cpython/pull/23553

___
Python tracker 

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



[issue28764] test_mailbox fails when run as a non-root user on Android API 24

2020-11-29 Thread Florian Klink


Change by Florian Klink :


--
nosy: +flokli
nosy_count: 3.0 -> 4.0
pull_requests: +22433
pull_request: https://github.com/python/cpython/pull/23553

___
Python tracker 

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



[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread shangxiao


New submission from shangxiao :

Summary
---

The argparse module mentions that it will happily accept an enum for the 
choices argument option [1].  There are currently 2 issues with this:

1. The usage displays non user-friendly values for the enum;
2. The error message for invalid values is not consistent with those provided 
by iterable-based choices in that it doesn't show the list of available 
choices. This becomes a problem when you specify the metavar as no choices are 
displayed at all.


Example of 1


For example using the GameMove example in the argparse documentation:

class GameMove(Enum):
 ROCK = 'rock'
 PAPER = 'paper'
 SCISSORS = 'scissors'

parser = argparse.ArgumentParser(prog='game.py')
parser.add_argument('move', type=GameMove, choices=GameMove)
parser.print_help()


Gives the usage:

usage: game.py [-h] {GameMove.ROCK,GameMove.PAPER,GameMove.SCISSORS}

positional arguments:
  {GameMove.ROCK,GameMove.PAPER,GameMove.SCISSORS}

optional arguments:
  -h, --helpshow this help message and exit


As you can see, the string representations of the valid enum members is used 
instead of the values.



Example of 2


Below is an example of the error message shown for invalid enum values, with 
metavar specified:

parser = argparse.ArgumentParser(prog='game.py')
parser.add_argument('move', metavar='your-move', type=GameMove, 
choices=GameMove)
parser.parse_args(['asdf'])

Gives the following output:

usage: game.py [-h] your-move
game.py: error: argument your-move: invalid GameMove value: 'asdf'


This is in contrast with using standard iterable-based choices:

parser = argparse.ArgumentParser(prog='game.py')
parser.add_argument('move', metavar='your-move', choices=[x.value for x in 
GameMove])
parser.parse_args(['asdf'])

Gives the following output:

usage: game.py [-h] your-move
game.py: error: argument your-move: invalid choice: 'asdf' (choose from 
'rock', 'paper', 'scissors')


Analysis of 2
--

The reason for this behaviour is because argparse attempts to convert to the 
correct type before checking the choices membership and an invalid enum value 
results in the first error message.

It would be helpful (& consistent) if the choices are also displayed along with 
the invalid value message.


Possible Solution
-

I believe that both issues could be solved by using the enum member values in 
the choices and then checking for choice membership _before_ the value is 
converted to an enum (ie for enums only).



[1] https://docs.python.org/3/library/argparse.html#choices

--
components: Library (Lib)
messages: 382051
nosy: shangxiao
priority: normal
severity: normal
status: open
title: Improve error messages for argparse choices using enum
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



[issue42392] remove the deprecated 'loop' parameter asyncio API

2020-11-29 Thread Yurii Karabas


Change by Yurii Karabas <1998uri...@gmail.com>:


--
pull_requests: +22432
pull_request: https://github.com/python/cpython/pull/23552

___
Python tracker 

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



[issue42497] New pathlib.Path attribute

2020-11-29 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

As a new feature, this could only go into 3.10, 3.9 is in feature freeze.

The requirements are unclear, it could mean any of:

- the file's *owner* has the execute bit set;

- the file's mode has any execute bit set;

- the *current user* has execute permission (regardless of whether they are the 
file owner, part of the file's group, or other);

- the file is an executable file (an app or exe) rather than a script that 
calls an executable file;

- the file is *not* on a file system that has disabled execution;

- if the file is double-clicked in a graphical shell, the file will run as a 
script or program (as opposed to merely open for reading);

etc.

So the concept of "is this file executable?" is more complex than it seems.

But you could start with getting the execute bit for the file's owner:


import pathlib
import stat
p = pathlib.Path('some file')
p.stat().st_mode & stat.S_IXUSR


or you could try this to find out whether the file *may* be executable for the 
current user:


os.access(p, os.X_OK)



but read the docs for some complications:

https://docs.python.org/3/library/os.html#os.access

--
nosy: +steven.daprano
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



[issue39096] "Format Specification Mini-Language" doc mistake for Decimal

2020-11-29 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset c3009a5818112b5fb8867d786ce33e0e9489f4e0 by Miss Islington (bot) 
in branch '3.8':
bpo-39096: Improve description of 'e', 'f' and 'g' presentation types 
(GH-23537) (GH-23551)
https://github.com/python/cpython/commit/c3009a5818112b5fb8867d786ce33e0e9489f4e0


--

___
Python tracker 

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



[issue39096] "Format Specification Mini-Language" doc mistake for Decimal

2020-11-29 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset cf47b3969e21f66655fcb414ff9bfdd503069c2d by Miss Islington (bot) 
in branch '3.9':
bpo-39096: Improve description of 'e', 'f' and 'g' presentation types 
(GH-23537) (GH-23550)
https://github.com/python/cpython/commit/cf47b3969e21f66655fcb414ff9bfdd503069c2d


--

___
Python tracker 

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



[issue42496] Don't change indentation of RST markup

2020-11-29 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue39096] "Format Specification Mini-Language" doc mistake for Decimal

2020-11-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +22431
pull_request: https://github.com/python/cpython/pull/23551

___
Python tracker 

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



[issue39096] "Format Specification Mini-Language" doc mistake for Decimal

2020-11-29 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +22430
pull_request: https://github.com/python/cpython/pull/23550

___
Python tracker 

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



[issue39096] "Format Specification Mini-Language" doc mistake for Decimal

2020-11-29 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset c642374b3ef72f6f300616f07aea2a3f9ed83e51 by Mark Dickinson in 
branch 'master':
bpo-39096: Improve description of 'e', 'f' and 'g' presentation types (#23537)
https://github.com/python/cpython/commit/c642374b3ef72f6f300616f07aea2a3f9ed83e51


--

___
Python tracker 

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



[issue42496] Don't change indentation of RST markup

2020-11-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for checking.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue42469] Space in re's {min, max} should raise an error, rather than fail silently

2020-11-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

"{" has special meaning only when it is used in the special forms "\{[0-9]+\}", 
"\{,[0-9]+\}" or "\{[0-9]+,[0-9]+\}". In all other cases it means literal "{". 
I once tried to emit warnings when non-escaped "{" is used in literal meaning, 
but it did break a lot of code (for example in string.Template). I decided that 
it is too destructive change.

Now, we can emit a warning (and later error) if there are extra spaces. It is a 
breaking change, but I hope it will not break much user code. But which cases 
should be recognized as error and which silently accepted with literal meaning 
of "{"? Should we only handle spaces after comma, or before and after digits? 
Should we check spaces only or tabs and newlines and other whitespaces?

What about the verbose mode? Currently the third-party regex module ignores 
whitespace and comments in the verbose mode in more places than the re module. 
The re module consider some sequences atomic and does not allow whitespaces 
inside them even in the verbose mode, for simplicity and performance.

--

___
Python tracker 

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



[issue39529] Deprecate get_event_loop()

2020-11-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The most visible effect in tests is that asyncio.gatcher() and some other 
synchronous functions will need a running loop if any of arguments is a 
coroutine.

--

___
Python tracker 

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