[issue45106] Issue formating for log on Linux machines

2021-09-06 Thread Inada Naoki


Inada Naoki  added the comment:

It is fixed in Python 3.9.

* https://github.com/python/cpython/pull/14008
* https://bugs.python.org/issue37111

Python 3.8 is "security" status for now. Non-security issues won't be fixed.
Please migrate to Python 3.9.

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



[issue45067] Failed to build _curses on CentOS 7

2021-09-06 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

According to https://invisible-island.net/ncurses/NEWS.html#index-t20170401 the 
function extended_color_content was introduced in 2017, maybe the detection of 
support for this function doesn't work properly for some reason (although the 
preprocessor logic in Modules/_cursesmodule.c looks sane).

That said, I don't have a CentOS VM at the moment so cannot debug this myself.

--

___
Python tracker 

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



[issue45111] whole website translation error

2021-09-06 Thread W Huang


New submission from W Huang :

Traditional Chinese is translated incorrectly into Simplified Chinese.
But Taiwanese CAN NOT read Simplified Chinese fluently.
In addition, there are many words called by different name between Chinese and 
Taiwanese.
Sometimes Taiwanese CAN NOT understand what a word used in China means.

--
messages: 401126
nosy: m4jp62
priority: normal
severity: normal
status: open
title: whole website translation error

___
Python tracker 

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

Hai Shi:
> IMO, I suggest to create a new function, PyStructSequence_FromModuleAndDesc()

Please create a new issue. If possible, I would prefer to have a sub-issue for 
that, to keep this issue as a tracking issue for all issues related to 
subinterpreters.

--

___
Python tracker 

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



[issue45112] Python exception object is different after pickle.loads and pickle.dumps

2021-09-06 Thread Chen Zero


New submission from Chen Zero :

Hi, when I'm trying to serialize/deserialize python exception object through 
pickle, I found that deserialize result is not the same as the original 
object...

My python version is 3.9.1, working os: macOS Big Sur 11.4

Here is minimum reproducing code example:

import pickle

class ExcA(Exception):
def __init__(self, want):
msg = "missing "
msg += want
super().__init__(msg)

ExcA('bb')   # this will output ExcA("missing bb"), which is good
pickle.loads(pickle.dumps(ExcA('bb')))  # this will output ExcA("missing 
missing bb"), which is different from `ExcA('bb')`

--
files: screenshot.png
messages: 401128
nosy: yonghengzero
priority: normal
severity: normal
status: open
title: Python exception object is different after pickle.loads and pickle.dumps
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file50262/screenshot.png

___
Python tracker 

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



[issue45112] Python exception object is different after pickle.dumps and pickle.loads

2021-09-06 Thread Chen Zero


Change by Chen Zero :


--
title: Python exception object is different after pickle.loads and pickle.dumps 
-> Python exception object is different after pickle.dumps and pickle.loads

___
Python tracker 

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



[issue42959] AttributeError: module 'signal' has no attribute 'SIGHUP'

2021-09-06 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +iritkatriel
nosy_count: 6.0 -> 7.0
pull_requests: +26608
pull_request: https://github.com/python/cpython/pull/23688

___
Python tracker 

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



[issue42959] AttributeError: module 'signal' has no attribute 'SIGHUP'

2021-09-06 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests:  -26608

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 Thread hai shi


New submission from hai shi :

Copied from https://bugs.python.org/issue40512#msg399847:

Victor: PyStructSequence_InitType2() is not compatible with subinterpreters: it 
uses static types. Moreover, it allocates tp_members memory which is not 
released when the type is destroyed. But I'm not sure that the type is ever 
destroyed, since this API is designed for static types.

> PyStructSequence_InitType2() is not compatible with subinterpreters: it uses 
> static types. Moreover, it allocates tp_members memory which is not released 
> when the type is destroyed. But I'm not sure that the type is ever destroyed, 
> since this API is designed for static types.

IMO, I suggest to create a new function, 
PyStructSequence_FromModuleAndDesc(module, desc, flags) to create a heaptype 
and don't aloocates memory block for tp_members,something like 
'PyType_FromModuleAndSpec()`.

--
components: C API
messages: 401129
nosy: petr.viktorin, shihai1991, vstinner
priority: normal
severity: normal
status: open
title: [subinterpreters][C API] Add a new function to create PyStructSequence 
from Heap.
versions: Python 3.11

___
Python tracker 

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2021-09-06 Thread hai shi


hai shi  added the comment:

bpo-45113: [subinterpreters][C API] Add a new function to create 
PyStructSequence from Heap.

--
versions: +Python 3.11 -Python 3.10

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 Thread Petr Viktorin


Petr Viktorin  added the comment:

I think you will run into issues with allocating tp_members, because there 
isn't a good mechanism to for type objects to manage C-level data.

But I encourage you to try, so you get a better understanding of the problem :)

--

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 Thread Hai Shi


Hai Shi  added the comment:

> But I encourage you to try, so you get a better understanding of the problem 
> :)

OK, thanks, Petr. I try to add this C API to see what will happen :)

--

___
Python tracker 

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



[issue45114] bad example for os.stat

2021-09-06 Thread Harri


New submission from Harri :

The example on https://docs.python.org/3/library/stat.html should be improved 
to avoid endless recursion, if there is a symlink loop. I would suggest to use 
os.lstat instead of os.stat.

--
assignee: docs@python
components: Documentation
messages: 401133
nosy: docs@python, harridu
priority: normal
severity: normal
status: open
title: bad example for os.stat
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



[issue44863] Allow TypedDict to inherit from Generics

2021-09-06 Thread Samodya Abey


Samodya Abey  added the comment:

My initial intention to create this ticket was to explore the idea that if we 
could side step from creating a PEP or updating PEP-589.

IMO only contribution from a new PEP will be:
1. relaxing this line from PEP-589 and be explicit to include Generic: "A 
TypedDict cannot inherit from both a TypedDict type and a non-TypedDict base 
class." (IMO by thinking `Generic` as a mixin even this is not needed)
2. may be syntax for generic in the alternative syntax (side note: collecting 
typevars from the values is hard to implement because of forward refs)
3. Some explicit generic examples for good measure

I believe PEP-589 is complete in covering all semantic details even with 
Generics. Even structural subtyping because it says: "Value types behave 
invariantly, since TypedDict objects are mutable."

My understanding was that during initial implementation this was not done for 
the sake of implementation simplicity (days before PEP-560).

All that said, a new PEP would be a good way to notify the type checkers of 
this capability.

Is there a better place to have this conversation?

--

___
Python tracker 

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



[issue45112] Python exception object is different after pickle.dumps and pickle.loads

2021-09-06 Thread Irit Katriel


Irit Katriel  added the comment:

The default __reduce__ method of Exception returns the arg you pass to the 
Exception constructor:

>>> a = ExcA("a banana")
>>> a.__reduce__()
(, ('missing a banana',))
>>> 


This is then pickled, and when unpickled the arg is passed to the ExcA 
constructor. 

If you want to change this, you can implement __reduce__ on ExcA o return just 
the part you want it to return.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue30637] Syntax error reported on compile(...), but not on compile(..., ast.PyCF_ONLY_AST)

2021-09-06 Thread Irit Katriel


Irit Katriel  added the comment:

Adding Pablo, a.k.a The King of Errors.

--
nosy: +iritkatriel, pablogsal

___
Python tracker 

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



[issue45112] Python exception object is different after pickle.dumps and pickle.loads

2021-09-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Pickling customized subclasses can be tricky.  The essential details are here:  
https://docs.python.org/3/library/pickle.html#object.__reduce__

Here's some code to get you started.

class ExcA(Exception):
def __init__(self, want):
msg = "missing "
msg += want
super().__init__(msg)
def __reduce__(self):
return (type(self), self.args, self.args)
def __setstate__(self, state):
self.args = stat

--
nosy: +rhettinger

___
Python tracker 

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



[issue45112] Python exception object is different after pickle.dumps and pickle.loads

2021-09-06 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue45112] Python exception object is different after pickle.dumps and pickle.loads

2021-09-06 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue44863] Allow TypedDict to inherit from Generics

2021-09-06 Thread Guido van Rossum

Guido van Rossum  added the comment:

Since this primarily affects static type checkers such as mypy, Pyre and 
pyright, it’s best to discuss it on typing-sig.

--

___
Python tracker 

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



[issue45103] IDLE: make configdialog font page survive font failures

2021-09-06 Thread E. Paine


E. Paine  added the comment:

FTR, the issue mentioned is issue42225.

msg380227 still applies for me (with Tk 8.6.11), with segfaults when I try to 
preview the font. For some reason, however, the segfault appears to be when 
we're closing the options window:

Python 3.9.6 (default, Jun 30 2021, 10:22:16) 
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import faulthandler
>>> faulthandler.enable()
>>> import idlelib.idle
Fatal Python error: Segmentation fault

Current thread 0x7f0ca44c7740 (most recent call first):
  File "/usr/lib/python3.9/tkinter/__init__.py", line 2580 in destroy
  File "/usr/lib/python3.9/tkinter/__init__.py", line 2579 in destroy
  File "/usr/lib/python3.9/tkinter/__init__.py", line 2579 in destroy
  File "/usr/lib/python3.9/tkinter/__init__.py", line 2579 in destroy
  File "/usr/lib/python3.9/tkinter/__init__.py", line 2579 in destroy
  File "/usr/lib/python3.9/tkinter/__init__.py", line 2579 in destroy
  File "/usr/lib/python3.9/tkinter/__init__.py", line 2579 in destroy
  File "/usr/lib/python3.9/idlelib/configdialog.py", line 199 in destroy
  File "/usr/lib/python3.9/idlelib/configdialog.py", line 177 in ok
  File "/usr/lib/python3.9/tkinter/__init__.py", line 1892 in __call__
  File "/usr/lib/python3.9/tkinter/__init__.py", line 696 in wait_window
  File "/usr/lib/python3.9/idlelib/configdialog.py", line 94 in __init__
  File "/usr/lib/python3.9/idlelib/editor.py", line 583 in config_dialog
  File "/usr/lib/python3.9/tkinter/__init__.py", line 1892 in __call__
  File "/usr/lib/python3.9/tkinter/__init__.py", line 1858 in event_generate
  File "/usr/lib/python3.9/idlelib/editor.py", line 1185 in command
  File "/usr/lib/python3.9/tkinter/__init__.py", line 1892 in __call__
  File "/usr/lib/python3.9/tkinter/__init__.py", line 1429 in mainloop
  File "/usr/lib/python3.9/idlelib/pyshell.py", line 1572 in main
  File "/usr/lib/python3.9/idlelib/idle.py", line 14 in 
  File "", line 228 in _call_with_frames_removed
  File "", line 850 in exec_module
  File "", line 680 in _load_unlocked
  File "", line 986 in _find_and_load_unlocked
  File "", line 1007 in _find_and_load
  File "", line 1 in 
fish: Job 1, 'python' terminated by signal SIGSEGV (Address boundary error)

I do not experience any problems loading the IDLE preferences page. I will look 
into whether I can reproduce the problem described on Windows.

--
nosy: +epaine

___
Python tracker 

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



[issue45103] IDLE: make configdialog font page survive font failures

2021-09-06 Thread E. Paine


E. Paine  added the comment:

Apologies, my previous message was not clear. When the segfault occurs is not 
consistent and sometimes occurs when previewing the font (as reported in the 
linked message) but more often when clicking the "ok" button (for which the 
faulthandler details are included).

--

___
Python tracker 

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



[issue45115] Windows: enable compiler optimizations when building Python in debug mode

2021-09-06 Thread STINNER Victor


New submission from STINNER Victor :

The Visual Studio project of Python, PCBuild\ directory, disables compiler 
optimizations when Python is built in debug mode. It seems to be the default in 
Visual Studio.

Disabling compiler optimizations cause two kinds of issues:

* It increases the stack memory: tests using a deep call stack are more likely 
to crash (test_pickle, test_marshal, test_exceptions).

* Running the Python test suite take 19 min 41 sec instead of 12 min 19 sec on 
Windows x64: 1.6x slower. Because of that, we cannot use a debug build in the 
GitHub Action pre-commit CI, and we miss bugs which are catched "too late", in 
Windows buildbots. See my latest attempt to use a debug build in GitHub 
Actions: https://github.com/python/cpython/pull/24914

Example of test_marshal:

# The max stack depth should match the value in Python/marshal.c.
# BUG: https://bugs.python.org/issue33720
# Windows always limits the maximum depth on release and debug builds
#if os.name == 'nt' and hasattr(sys, 'gettotalrefcount'):
if os.name == 'nt':
MAX_MARSHAL_STACK_DEPTH = 1000
else:
MAX_MARSHAL_STACK_DEPTH = 2000

I propose to only change the compiler options for the pythoncore project which 
builds most important files for the Python "core". See attached PR.

--
components: Windows
messages: 401141
nosy: paul.moore, steve.dower, tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: Windows: enable compiler optimizations when building Python in debug mode
versions: Python 3.11

___
Python tracker 

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



[issue45115] Windows: enable compiler optimizations when building Python in debug mode

2021-09-06 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue45115] Windows: enable compiler optimizations when building Python in debug mode

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

This change is motivated by my PR 28128 which converts the Py_TYPE() macro to a 
static inline function. The problem is that by default, MSC disables inlining 
and test_exceptions does crash with a stack overflow, since my change increases 
the usage of the stack memory: see bpo-44348.

By the problem is wider than just Py_TYPE().

See also bpo-45094: "Consider using __forceinline and 
__attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) 
for debug builds".

--

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows

2021-09-06 Thread neonene


New submission from neonene :

pyperformance on Windows shows some gap between 3.10a7 and 3.10b1.
The following are the ratios compared with 3.10a7 (the higher the slower).

-
Windows x64 |  PGO   release  official-binary
+
20210405|
3.10a7  |  1.00   1.241.00 (PGO?)
20210408-07:58  |
b98eba5 |  0.98
20210408-10:22  |
  * PR25244 |  1.04
20210503|
3.10b1  |  1.07   1.211.07
-
Windows x86 |  PGO   release  official-binary
+
20210405|
3.10a7  |  1.00   1.251.27 (release?)
20210408-07:58  |
b98eba5bc   |  1.00
20210408-10:22  |
  * PR25244 |  1.11
20210503|
3.10b1  |  1.14   1.281.29

Since PR25244 (28d28e053db6b69d91c2dfd579207cd8ccbc39e7),
_PyEval_EvalFrameDefault() in ceval.c has seemed to be unoptimized with PGO 
(msvc14.29.16.10).
At least the functions below have become un-inlined there at all.

  (1) _Py_DECREF() (from Py_DECREF,Py_CLEAR,Py_SETREF)
  (2) _Py_XDECREF()(from Py_XDECREF,SETLOCAL)
  (3) _Py_IS_TYPE()(from PyXXX_CheckExact)
  (4) _Py_atomic_load_32bit_impl() (from CHECK_EVAL_BREAKER)

I tried in vain other linker options like thread-safe-profiling, 
agressive-code-generation, /OPT:NOREF.
3.10a7 can inline them in the eval-loop even if profiling only test_array.py.

I measured overheads of (1)~(4) on my own build whose eval-loop uses macros 
instead of them.

-
Windows x64 |  PGO   patched  overhead in eval-loop
+
3.10a7  |  1.00
20210802|
3.10rc1 |  1.09   1.054%  (slow 43, fast  5, same 10)
20210831-20:42  |
863154c |  0.95   0.905%  (slow 48, fast  3, same  7)
   (3.11a0+)|
-
Windows x86 |  PGO   patched  overhead in eval-loop
+
3.10a7  |  1.00
20210802|
3.10rc1 |  1.15   1.132%  (slow 29, fast 14, same 15)
20210831-20:42  |
863154c |  1.05   1.023%  (slow 44, fast  7, same  7)
   (3.11a0+)|

--
components: C API, Interpreter Core, Windows
files: 310rc1_confirm_overhead.patch
keywords: patch
messages: 401143
nosy: Mark.Shannon, neonene, pablogsal, paul.moore, steve.dower, tim.golden, 
vstinner, zach.ware
priority: normal
severity: normal
status: open
title: Performance regression 3.10b1 and later on Windows
type: performance
versions: Python 3.10, Python 3.11
Added file: https://bugs.python.org/file50263/310rc1_confirm_overhead.patch

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows

2021-09-06 Thread neonene


Change by neonene :


Added file: https://bugs.python.org/file50264/ceval_310rc1_patched.c

___
Python tracker 

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



[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

Sadly, Py_ALWAYS_INLINE does *not* prevent test_exceptions to crash with my PR 
28128 (convert Py_TYPE macro to a static inline function). Even if the 
Py_TYPE() static inline function is inlined, the stack memory still increases. 
MSC produces inefficient machine code. It allocates useless variables on the 
stack which requires more stack memory.

I propose a different approach: bpo-45115 "Windows: enable compiler 
optimizations when building Python in debug mode".

--

___
Python tracker 

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



[issue45115] Windows: enable compiler optimizations when building Python in debug mode

2021-09-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +26610
pull_request: https://github.com/python/cpython/pull/28128

___
Python tracker 

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



[issue45115] Windows: enable compiler optimizations when building Python in debug mode

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

I recently documented the "Python debug build":
https://docs.python.org/dev/using/configure.html#python-debug-build

--

___
Python tracker 

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



[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-09-06 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Ok, that's what I was able to find.

Original BPO: https://bugs.python.org/issue35813
Original PRs (sources + tests):
- https://github.com/python/cpython/pull/11664 it was a little bit "rushed"
- https://github.com/python/cpython/pull/11816 follow up

Related: https://bugs.python.org/issue38169

1. The test fails because `sms.size != sms2.size`
2. The `sms2` object is a pickle-unpickle copy of `sms`
3. The `__reduce__` method defined in `SharedMemory` returns `(name=self.name, 
create=False, size=self.size)` tuple
4. So, when `sms2` is constructed, `size` is ignored, because `create` is 
`False`

Moreover, even when `size` is passed with `create=True` the docs say that the 
final amount of allocated memory is platform specific (no details on the exact 
platforms): it can be larger or equal. Link: 
https://github.com/python/cpython/blame/main/Doc/library/multiprocessing.shared_memory.rst#L61
 

So, this statement makes `self.assertEqual(sms.size, sms2.size)` potentially 
flaky.

After reading all this my suggestion is:
1. Remove `self.assertEqual(sms.size, sms2.size)` line, since this behavior is 
not guaranteed to work
2. Add docs about how `pickle` works with `SharedMemory` / `ShareableList`. 
Right now it is not clear. This should be just an explanation of the current 
status-quo
3. Add more tests on unpickled `Shared*` objects. Including overflowing set 
memory limits on unpickled objects and other implemetation details

I will start with `1.` right now, later I can work on `3.`.
But, I feel like someone more knowledgeable should take `2.` (or at least guide 
me, since `SharedMemory` is not something I use everyday).

--

___
Python tracker 

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



[issue28451] pydoc.safeimport() raises ErrorDuringImport() if __builtin__.__import__ is monkey patched

2021-09-06 Thread Irit Katriel


Irit Katriel  added the comment:

It is no longer using the traceback check:

https://github.com/python/cpython/blob/37272f5800ee1e9fcb2da4a1766366519b9b3d94/Lib/pydoc.py#L445

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



[issue30060] Crash with subinterpreters and Py_NewInterpreter()

2021-09-06 Thread Irit Katriel


Irit Katriel  added the comment:

Closing as there was no followup to Eric's question. Please create a new issue 
if you still see this problem on a version >= 3.9.

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

___
Python tracker 

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



[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-09-06 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows

2021-09-06 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy:  -pablogsal

___
Python tracker 

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



[issue45117] `dict` not subscriptable despite using `__future__` typing annotations

2021-09-06 Thread Ștefan Istrate

New submission from Ștefan Istrate :

According to PEP 585 
(https://www.python.org/dev/peps/pep-0585/#implementation), I expect that 
typing aliases could simply use `dict` instead of `typing.Dict`. This works 
without problems in Python 3.9, but in Python 3.8, despite using `from 
__future__ import annotations`, I get the following error:



$ /usr/local/Cellar/python@3.8/3.8.11/bin/python3.8
Python 3.8.11 (default, Jun 29 2021, 03:08:07)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import annotations
>>> from typing import Any
>>> JsonDictType = dict[str, Any]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'type' object is not subscriptable



However, `dict` is subscriptable when not used in an alias:



$ /usr/local/Cellar/python@3.8/3.8.11/bin/python3.8
Python 3.8.11 (default, Jun 29 2021, 03:08:07)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import annotations
>>> from typing import Any
>>> def f(d: dict[str, Any]):
... print(d)
...
>>> f({"abc": 1, "def": 2})
{'abc': 1, 'def': 2}

--
messages: 401149
nosy: stefanistrate
priority: normal
severity: normal
status: open
title: `dict` not subscriptable despite using `__future__` typing annotations
type: behavior
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



[issue44348] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

Another *working* approach to fix this issue: bpo-45115 "Windows: enable 
compiler optimizations when building Python in debug mode".

--

___
Python tracker 

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



[issue7391] [doc] restore the "Idioms and Anti-Idioms in Python" document

2021-09-06 Thread Irit Katriel


Change by Irit Katriel :


--
title: Re-title the "Using Backslash to Continue Statements" anti-idiom -> 
[doc] restore the "Idioms and Anti-Idioms in Python" document
versions: +Python 3.11 -Python 3.2, Python 3.3

___
Python tracker 

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



[issue45118] regrtest no longer lists "re-run tests" in the second summary

2021-09-06 Thread STINNER Victor


New submission from STINNER Victor :

When running Python with test -w/--verbose2 command line option to re-run tests 
which failed, the failing tests are listed in the first summary, and they are 
not listed in the final summary.

Example with Lib/test/test_x.py:
---
import builtins
import unittest

class Tests(unittest.TestCase):
def test_succeed(self):
return

def test_fail_once(self):
if not hasattr(builtins, '_test_failed'):
builtins._test_failed = True
self.fail("bug")
---

Current output when running test_sys (success) and test_x (failed once, then 
pass):
---
$ ./python -m test test_sys test_x -w
0:00:00 load avg: 0.80 Run tests sequentially
0:00:00 load avg: 0.80 [1/2] test_sys
0:00:01 load avg: 0.80 [2/2] test_x
test test_x failed -- Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_x.py", line 11, in 
test_fail_once
self.fail("bug")

AssertionError: bug

test_x failed (1 failure)

== Tests result: FAILURE ==

1 test OK.

1 test failed:
test_x

1 re-run test:
test_x
0:00:01 load avg: 0.80
0:00:01 load avg: 0.80 Re-running failed tests in verbose mode
0:00:01 load avg: 0.80 Re-running test_x in verbose mode (matching: 
test_fail_once)
test_fail_once (test.test_x.Tests) ... ok

--
Ran 1 test in 0.000s

OK

== Tests result: FAILURE then SUCCESS ==

All 2 tests OK.

Total duration: 2.0 sec
Tests result: FAILURE then SUCCESS
---

"re-run tests" is missing in the last summary.

--
components: Tests
messages: 401151
nosy: vstinner
priority: normal
severity: normal
status: open
title: regrtest no longer lists "re-run tests" in the second summary
versions: Python 3.11

___
Python tracker 

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



[issue45118] regrtest no longer lists "re-run tests" in the second summary

2021-09-06 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

Rather than defining again functions as macro, you should consider using 
__forceinline function attribute: see bpo-45094.

--

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-09-06 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



[issue45105] Incorrect handling of unicode character \U00010900

2021-09-06 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



[issue45112] Python exception object is different after pickle.dumps and pickle.loads

2021-09-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

It would be nice if exception pickling was more friendly to subclasses.  
Perhaps, the default should be to store and restore all state including args 
and a __dict__ if any.

--

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows

2021-09-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Perhaps these critical code sections should have been left as macros. It is 
difficult to assuring system wide inlining across modules.

--
nosy: +rhettinger

___
Python tracker 

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



[issue18534] [doc] State clearly that open() 'file' param is "name" attr of the result

2021-09-06 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
title: State clearly that open() 'file' param is "name" attr of the result -> 
[doc] State clearly that open() 'file' param is "name" attr of the result
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.3, Python 3.4

___
Python tracker 

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



[issue7391] [doc] restore the "Idioms and Anti-Idioms in Python" document

2021-09-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The document out of date when it was removed and is now another dozen years 
older.  Since then no one has expresses any interest with this and other tools 
have emerged to deal with code formatting.

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



[issue45115] Windows: enable compiler optimizations when building Python in debug mode

2021-09-06 Thread Steve Dower


Steve Dower  added the comment:

I strongly disagree. If CI needs to be faster, please just change the CI 
configuration. If contributors have to wait a few minutes longer, they can wait 
- they'll save that time in local compilations.

Local debugging absolutely relies on debug builds. You'd be destroying the 
workflow of most Windows-based developers with this change. It's not worth it.

--

___
Python tracker 

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



[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-09-06 Thread Steve Dower


Steve Dower  added the comment:


New changeset 19871fce3b74fc3f37e334a999e00d0ef65a8f1e by Nikita Sobolev in 
branch 'main':
bpo-45052: Unskips a failing `test_shared_memory_basics` test (GH-28182)
https://github.com/python/cpython/commit/19871fce3b74fc3f37e334a999e00d0ef65a8f1e


--

___
Python tracker 

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



[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-09-06 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 9.0 -> 10.0
pull_requests: +26613
pull_request: https://github.com/python/cpython/pull/28185

___
Python tracker 

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



[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-09-06 Thread Steve Dower


Steve Dower  added the comment:

The test fix looks good to me. That resolves this issue, yes? The other work is 
going on elsewhere?

--
nosy:  -miss-islington

___
Python tracker 

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



[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-09-06 Thread Nikita Sobolev

Nikita Sobolev  added the comment:

I think that adding extra tests and docs are two separate new tasks. I will
open them today.

Thanks a lot, everyone!

пн, 6 сент. 2021 г. в 19:56, Steve Dower :

>
> Steve Dower  added the comment:
>
> The test fix looks good to me. That resolves this issue, yes? The other
> work is going on elsewhere?
>
> --
> nosy:  -miss-islington
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue28978] a redundant right parentheses in the EBNF rules of parameter_list

2021-09-06 Thread Irit Katriel


Irit Katriel  added the comment:

This doc has changed, and it's now like this:

parameter_list::=  defparameter ("," defparameter)* "," "/" ["," 
[parameter_list_no_posonly]]
 | parameter_list_no_posonly
parameter_list_no_posonly ::=  defparameter ("," defparameter)* ["," 
[parameter_list_starargs]]
   | parameter_list_starargs
parameter_list_starargs   ::=  "*" [parameter] ("," defparameter)* ["," ["**" 
parameter [","]]]
   | "**" parameter [","]

--
nosy: +iritkatriel
resolution:  -> out of date
stage: needs patch -> 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



[issue44348] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds

2021-09-06 Thread Steve Dower


Steve Dower  added the comment:

It should also be possible to reduce the stack size of each frame. We've done 
that before, because there were multiple temporary buffers allocated on the 
stack that were trivially moved into functions. I bet we can also reduce the 
number of indirections, as last time I had to investigate a native stack we 
seem to have bloated up to 6-7 C frames for each Python frame.

Failing that, I'd rather have an option to build with higher stack size just 
for tests (or users who care that much - my experience is that people tend to 
care more about many Python processes rather than high recursion). That only 
affects python[w][_uwp].exe.

We could also add a threading API to allow creating new threads with larger 
stack size. That would allow us to write tests that can do it, and also enable 
users who may run into it. I'd prefer Windows just be able to expand the stack 
better at runtime, but the reserved address space apparently wins the 
back-compat argument.

--

___
Python tracker 

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



[issue45119] test_signal.test_itimer_virtual() failed on AMD64 Fedora Rawhide 3.x

2021-09-06 Thread STINNER Victor


New submission from STINNER Victor :

AMD64 Fedora Rawhide 3.x:
https://buildbot.python.org/all/#/builders/285/builds/685

It is likely test_itimer_virtual() of test_signal which failed.

On the buildbot worker:

$ rpm -q glibc
glibc-2.34.9000-5.fc36.x86_64
$ uname -r
5.15.0-0.rc0.20210902git4ac6d90867a4.4.fc36.x86_64

test.pythoninfo:

platform.libc_ver: glibc 2.34.9000
platform.platform: 
Linux-5.15.0-0.rc0.20210902git4ac6d90867a4.4.fc36.x86_64-x86_64-with-glibc2.34.9000

Logs:

test test_signal crashed -- Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/libregrtest/runtest.py",
 line 340, in _runtest_inner
refleak = _runtest_inner2(ns, test_name)
  ^^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/libregrtest/runtest.py",
 line 297, in _runtest_inner2
test_runner()
^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/libregrtest/runtest.py",
 line 261, in _test_module
support.run_unittest(tests)
^^^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/support/__init__.py",
 line 1123, in run_unittest
_run_suite(suite)
^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/support/__init__.py",
 line 998, in _run_suite
result = runner.run(suite)
 ^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/runner.py",
 line 176, in run
test(result)

  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/suite.py",
 line 84, in __call__
return self.run(*args, **kwds)
   ^^^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/suite.py",
 line 122, in run
test(result)

  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/suite.py",
 line 84, in __call__
return self.run(*args, **kwds)
   ^^^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/suite.py",
 line 122, in run
test(result)

  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/suite.py",
 line 84, in __call__
return self.run(*args, **kwds)
   ^^^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/suite.py",
 line 122, in run
test(result)

  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/case.py",
 line 652, in __call__
return self.run(*args, **kwds)
   ^^^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/case.py",
 line 569, in run
result.startTest(self)
^^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/support/testresult.py",
 line 41, in startTest
super().startTest(test)
^^^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/runner.py",
 line 54, in startTest
self.stream.write(self.getDescription(test))
  ^
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/unittest/runner.py",
 line 44, in getDescription
def getDescription(self, test):
  File 
"/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/test_signal.py",
 line 739, in sig_vtalrm
raise signal.ItimerError("setitimer didn't disable ITIMER_VIRTUAL "
^^^
signal.itimer_error: setitimer didn't disable ITIMER_VIRTUAL timer.


Code of the test:

def sig_vtalrm(self, *args):
self.hndl_called = True

if self.hndl_count > 3:
# it shouldn't be here, because it should have been disabled.
raise signal.ItimerError("setitimer didn't disable ITIMER_VIRTUAL " 
 # < HERE
"timer.") # 
<=== HERE
elif self.hndl_count == 3:
# disable ITIMER_VIRTUAL, this function shouldn't be called anymore
signal.setitimer(signal.ITIMER_VIRTUAL, 0)

self.hndl_count += 1

# Issue 3864, unknown if this affects earlier versions of freebsd also  
  
@unittest.skipIf(sys.platform in ('netbsd5',),  
  
'itimer not reliable (does not mix well with threading) on some BSDs.') 
  
def test_itimer_virtual(self):  
  
self.itimer = signal.ITIMER_VIRTUAL
signal.signal(signal.S

[issue45119] test_signal.test_itimer_virtual() failed on AMD64 Fedora Rawhide 3.x

2021-09-06 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +cstratak

___
Python tracker 

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



[issue25066] Better repr for multiprocessing.synchronize objects

2021-09-06 Thread Irit Katriel


Irit Katriel  added the comment:

The patch need to be converted to a GitHub PR.

--
keywords: +easy -patch
nosy: +iritkatriel
stage: patch review -> needs patch
versions: +Python 3.11 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-09-06 Thread miss-islington


miss-islington  added the comment:


New changeset 6b5aea2dc1bf7e117d40d6c9035d5c13124fd968 by Miss Islington (bot) 
in branch '3.10':
bpo-45052: Unskips a failing `test_shared_memory_basics` test (GH-28182)
https://github.com/python/cpython/commit/6b5aea2dc1bf7e117d40d6c9035d5c13124fd968


--
nosy: +miss-islington

___
Python tracker 

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



[issue29232] Quiet Install

2021-09-06 Thread Irit Katriel


Irit Katriel  added the comment:

Earl, is there still an open problem to look into here or can this be closed?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue41082] Error handling and documentation of Path.home()

2021-09-06 Thread Andrei Kulakov


Change by Andrei Kulakov :


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

___
Python tracker 

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



[issue41082] Error handling and documentation of Path.home()

2021-09-06 Thread Andrei Kulakov


Change by Andrei Kulakov :


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



[issue41082] Error handling and documentation of Path.home()

2021-09-06 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I looked a bit more into this, it's been fixed in 3.10, in this PR: 
https://github.com/python/cpython/pull/18841

It wasn't backported to 3.9. I'm not quite sure if it's best to backport to 3.9 
or fix via docs for 3.9. Just in case I've put up a small PR for such a docfix.

--

___
Python tracker 

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



[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

2021-09-06 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Note this change also fixes https://bugs.python.org/issue41082 . I'm guessing 
it's too much of an edge case to backport this fix to 3.9, so I've put up a 
possible fix via docs update on that issue.

--
nosy: +andrei.avk, kj

___
Python tracker 

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



[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

2021-09-06 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

To be more precise, this change fixes https://bugs.python.org/issue41082 by 
raising RuntimeError instead of KeyError and also by documenting it, which 
means matplotlib can fix it by either using os.path.expanduser or catching 
RuntimeError, whichever might work better in their case.

I will let them know once we sort this out.

--

___
Python tracker 

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



[issue34561] Replace list sorting merge_collapse()?

2021-09-06 Thread Tim Peters


Tim Peters  added the comment:


New changeset 5cb4c672d855033592f0e05162f887def236c00a by Tim Peters in branch 
'main':
bpo-34561: Switch to Munro & Wild "powersort" merge strategy. (#28108)
https://github.com/python/cpython/commit/5cb4c672d855033592f0e05162f887def236c00a


--

___
Python tracker 

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



[issue34561] Replace list sorting merge_collapse()?

2021-09-06 Thread Tim Peters


Change by Tim Peters :


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



[issue45119] test_signal.test_itimer_virtual() failed on AMD64 Fedora Rawhide 3.x

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

I rewrote the test in C, see attached setitimer.c.

On Fedora 34:
---
$ rpm -q glibc
glibc-2.33-20.fc34.x86_64
$ uname -r
5.13.8-200.fc34.x86_64

$ gcc setitimer.c -o setitimer && ./setitimer
setitimer(<0.5, 0.5>)
SIGVTALRM
SIGVTALRM
SIGVTALRM
SIGVTALRM
setitimer(<0, 0>) ok
SIGVTALRM is disarmed
wait 3 seconds
setitimer(<0, 0>) ok
exit
---

On Fedora Rawhide:
---
$ rpm -q glibc
glibc-2.34.9000-5.fc36.x86_64
$ uname -r
5.15.0-0.rc0.20210902git4ac6d90867a4.4.fc36.x86_64

$ gcc setitimer.c -o setitimer && ./setitimer
setitimer(<0.5, 0.5>)
SIGVTALRM
SIGVTALRM
SIGVTALRM
SIGVTALRM
setitimer(<0, 0>) ok
SIGVTALRM
FATAL ERROR: SIGVTALRM timer not disarmed!
Abandon (core dumped)
---

--
Added file: https://bugs.python.org/file50265/setitimer.c

___
Python tracker 

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



[issue45119] test_signal.test_itimer_virtual() failed on AMD64 Fedora Rawhide 3.x

2021-09-06 Thread STINNER Victor

STINNER Victor  added the comment:

It seems like the kernel was just upgrade from 5.14 to 5.15.rc0:

vstinner@python-builder-rawhide$ date
lun. 06 sept. 2021 14:05:43 EDT

vstinner@python-builder-rawhide$ grep kernel /var/log/dnf.log
2021-09-03T06:35:58-0400 DEBUG Installed: 
kernel-5.15.0-0.rc0.20210901git9e9fb7655ed5.2.fc36.x86_64
...
2021-09-04T06:31:34-0400 DEBUG Installed: 
kernel-5.15.0-0.rc0.20210902git4ac6d90867a4.4.fc36.x86_64
...

vstinner@python-builder-rawhide$ rpm -q kernel
kernel-5.14.0-0.rc5.20210813gitf8e6dfc64f61.46.fc36.x86_64
kernel-5.15.0-0.rc0.20210901git9e9fb7655ed5.2.fc36.x86_64
kernel-5.15.0-0.rc0.20210902git4ac6d90867a4.4.fc36.x86_64

vstinner@python-builder-rawhide$ uptime
 14:06:00 up  3:14,  1 user,  load average: 2,47, 2,58, 3,11

vstinner@python-builder-rawhide$ journalctl --list-boots
-1 04d2796c1f374367add41a55f48c7dad Sat 2021-08-28 14:55:16 EDT—Mon 2021-09-06 
10:50:57 EDT
 0 1a10ace470bd4016ad19fd25d248fc57 Mon 2021-09-06 10:51:11 EDT—Mon 2021-09-06 
14:12:36 EDT

--

___
Python tracker 

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



[issue30637] Syntax error reported on compile(...), but not on compile(..., ast.PyCF_ONLY_AST)

2021-09-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The doc section in question is
https://docs.python.org/3/library/ast.html#ast.parse

I confirmed that 'break', 'continue', 'yield', and 'return' still parse, with 
the results how having "type_ignores=[]" added.
  'Module(body=[Expr(value=Yield())], type_ignores=[])'
I do not understand Nick's comment about 'await' as 'await' is not a legal 
statement'

The current initial paragraph says:
  "Parse the source into an AST node. Equivalent to compile(source, filename, 
mode, ast.PyCF_ONLY_AST)."

I suggest following this with:
  "If the AST node is compiled to a code object, there are additional syntax 
checks that can raise errors.  "For example, 'return' parses to a node, but is 
not legal outside of a def statement."

Hrvoje's suggested adding something like
  "If source contains a null character ('\0'), ValueError is raised."

I don't think that this is needed as ast.parse is explicitly noted as 
equivalent to a compile call, and the compile doc says "This function raises 
SyntaxError if the compiled source is invalid, and ValueError if the source 
contains null bytes."  (Should not that be 'null characters' given that 
*source* is now unicode?) This statement need not be repeated here.

--
versions: +Python 3.11 -Python 2.7, Python 3.7

___
Python tracker 

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



[issue45111] whole website translation error

2021-09-06 Thread Ned Deily


Change by Ned Deily :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue45119] test_signal.test_itimer_virtual() failed on AMD64 Fedora Rawhide 3.x

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

It may be a Linux kernel 5.15 regression. I'm now trying to report this issue 
to the Linux kernel.

--

___
Python tracker 

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



[issue30637] Syntax error reported on compile(...), but not on compile(..., ast.PyCF_ONLY_AST)

2021-09-06 Thread Irit Katriel


Irit Katriel  added the comment:

Re null in source code, see issue20115.

--

___
Python tracker 

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



[issue29232] Quiet Install

2021-09-06 Thread Steve Dower


Steve Dower  added the comment:

The underlying issue is known and tracked by issue25166

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
superseder:  -> Windows All Users installation places uninstaller in user 
profile

___
Python tracker 

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



[issue45103] IDLE: make configdialog font page survive font failures

2021-09-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Thank you for finding what I could not.

Your previous message, referenced above, reporting a problem that remains in 
8.6.11 on linux, was ...

"For me, this is not limited to special characters. Trying to load anything in 
Tk using the 'JoyPixels' font crashes (sometimes it does load but all 
characters are very random - most are whitespace - and it crashes again after a 
call to `fc-cache`). IDLE crashes when trying to preview the font.

I believe this is what is being experienced on 
https://askubuntu.com/questions/1236488/x-error-of-failed-request-badlength-poly-request-too-large-or-internal-xlib-le
 because they are not using any special characters yet are reporting the same 
problem."

JoyPixels is an emoji font.  There are emoji in the BMP, but not in IDLE's 
initial font sample.  Did you add some, or did problems occur without 
displaying any emoji?
---

I presume that the Phaistos 'font' has glyphs for the unicode phaistos block in 
the first astral plane, U+101D0..101FD.
https://en.wikipedia.org/wiki/Phaistos_Disc_(Unicode_block)

If they include one of those characters in the font name displayed in the font 
list (ugh), then a problem is understandable, and the fix would be to filter 
astral chars (and possibly more) out of font names.  But I won't assume this.

Please try the experiments I outlined if you are so inclined.

--

___
Python tracker 

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



[issue45103] IDLE: make configdialog font page survive font failures

2021-09-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

If nothing else, I should amend the doc note about font problems to include 
Windows if we verify the report.

--

___
Python tracker 

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



[issue34561] Replace list sorting merge_collapse()?

2021-09-06 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

Thanks for your work Tim, just adapted the changes to PyPy's Timsort, using 
bits of runstack.py!

--
nosy: +Carl.Friedrich.Bolz

___
Python tracker 

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



[issue45103] IDLE: make configdialog font page survive font failures

2021-09-06 Thread E. Paine


E. Paine  added the comment:

> did problems occur without displaying any emoji

I was using an unmodified version of IDLE.

> If they include one of those characters in the font name displayed in the 
> font list

This is not the case. It is listed simply as "Phaistos", when calling 
`tkinter.font.families()`.

> if we verify the report

Report verified. Behaviour is exactly as described, hanging when trying to load 
the "Configure IDLE" window. I will look into exactly which line is the problem 
soon.

--

___
Python tracker 

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



[issue32750] lib2to3 log_error method behavior is inconsitent with documentation

2021-09-06 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue45103] IDLE: make configdialog font page survive font failures

2021-09-06 Thread E. Paine


E. Paine  added the comment:

IDLE is hanging on Lib/idlelib/configdialog.py:94 (`self.wait_window()`). 
Commenting this does not solve the problem: I think it's in the Tk event loop 
somewhere, since my debugger shows the Python callback completing successfully. 
This still doesn't explain the behaviour, however, so I'll need to spend a bit 
more time tracking it down.

--

___
Python tracker 

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



[issue45120] Windows cp encodings "UNDEFINED" entries update

2021-09-06 Thread Rafael Belo

New submission from Rafael Belo :

There is a mismatch in specification and behavior in some windows encodings.

Some older windows codepages specifications present "UNDEFINED" mapping, 
whereas in reality, they present another behavior which is updated in a section 
named "bestfit".

For example CP1252 has a corresponding bestfit1525: 
CP1252: 
https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT
bestfit1525: 
https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit1252.txt


>From which, in CP1252, bytes \x81 \x8d \x8f \x90 \x9d map to "UNDEFINED", 
>whereas in bestfit1252, they map to \u0081 \u008d \u008f \u0090 \u009d 
>respectively. 

In the Windows API, the function 'MultiByteToWideChar' exhibits the bestfit1252 
behavior.


This issue and PR proposes a correction for this behavior, updating the windows 
codepages where some code points where defined as "UNDEFINED" to the 
corresponding bestfit mapping. 


Related issue: https://bugs.python.org/issue28712

--
components: Demos and Tools, Library (Lib), Unicode, Windows
messages: 401181
nosy: ezio.melotti, lemburg, paul.moore, rafaelblsilva, steve.dower, 
tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: Windows cp encodings "UNDEFINED" entries update
type: behavior

___
Python tracker 

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



[issue45120] Windows cp encodings "UNDEFINED" entries update

2021-09-06 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 8.0 -> 9.0
pull_requests: +26615
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28189

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

Raymond:
> Perhaps these critical code sections should have been left as macros. It is 
> difficult to assuring system wide inlining across modules.

These functions were not converted recently to static inline function. For 
example, Py_INCREF() was already a static inline function in Python 3.9. I 
don't think that any decision should be taken before performances have been 
analyzed in depth.

I'm not convinced that there is really a performance regression. I'm not sure 
how benchmarks are run on Windows.

neonene:
> I measured overheads of (1)~(4) on my own build whose eval-loop uses macros 
> instead of them.

I don't understand how to read the table.

Usually, I expect a comparison between a reference build and a patch build, but 
here you seem to use 3.10a7 as the reference to compare results. I'm not sure 
that geometric means can be compared this way.

--

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

> Since PR25244 (28d28e053db6b69d91c2dfd579207cd8ccbc39e7),
_PyEval_EvalFrameDefault() in ceval.c has seemed to be unoptimized with PGO 
(msvc14.29.16.10).
> At least the functions below have become un-inlined there at all.

I'm not sure if PGO builds are reproducible, since there is a training step 
which requires to run a non-deterministic workload (the Python test suite which 
is somehow randomized by I/O timings and other stuffs).

The compiler is free to inline or not depending on the pressure on registers 
and stack memory. I'm not sure that inlining always make the code faster, since 
inlining have many side effects.

I don't know well MSC compiler.

--

___
Python tracker 

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



[issue45121] Regression in 3.9.7 with typing.Protocol

2021-09-06 Thread Shantanu


New submission from Shantanu :

Consider:
```
from typing import Protocol

class P(Protocol):
...

class C(P):
def __init__(self):
super().__init__()

C()
```
This code passes without error on 3.9.6.

With 3.9.7, we get:
```
Traceback (most recent call last):
  File "/Users/shantanu/dev/test.py", line 10, in 
C()
  File "/Users/shantanu/dev/test.py", line 8, in __init__
super().__init__()
  File "/Users/shantanu/.pyenv/versions/3.9.7/lib/python3.9/typing.py", line 
1083, in _no_init
raise TypeError('Protocols cannot be instantiated')
TypeError: Protocols cannot be instantiated
```

I bisected this to:

bpo-44806: Fix __init__ in subclasses of protocols (GH-27545) (GH-27559)

Note there is also an interaction with the later commit:

bpo-45081: Fix __init__ method generation when inheriting from Protocol 
(GH-28121) (GH-28132)

This later commit actually causes a RecursionError:
```
  File "/Users/shantanu/dev/cpython/Lib/typing.py", line 1103, in 
_no_init_or_replace_init
cls.__init__(self, *args, **kwargs)
  File "/Users/shantanu/dev/test.py", line 8, in __init__
super().__init__()
  File "/Users/shantanu/dev/cpython/Lib/typing.py", line 1103, in 
_no_init_or_replace_init
cls.__init__(self, *args, **kwargs)
  File "/Users/shantanu/dev/test.py", line 8, in __init__
super().__init__()
```

Originally reported by @tyralla on Gitter.

--
components: Library (Lib)
messages: 401184
nosy: hauntsaninja
priority: normal
severity: normal
status: open
title: Regression in 3.9.7 with typing.Protocol
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



[issue45121] Regression in 3.9.7 with typing.Protocol

2021-09-06 Thread Shantanu


Change by Shantanu :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44348] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds

2021-09-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +26617
pull_request: https://github.com/python/cpython/pull/28190

___
Python tracker 

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



[issue44348] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

test_recursion_in_except_handler() creates chained of exceptions. When an 
exception is deallocated, it calls the deallocator of another exception, etc.

* recurse_in_except() sub-test creates chains of 11 nested deallocator calls
* recurse_in_body_and_except() sub-test creates a chain of 8192 nested 
deallocator calls

I'm not sure how recurse_in_body_and_except() can creates a chain which is so 
long, knowing that the test sets the recursion limit to 44 frames (default 
Python limit is 1000).

--

___
Python tracker 

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



[issue44958] [sqlite3] only reset statements when needed

2021-09-06 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

In msg399939, item 2 lacks one more "reset path":

> 2. at cursor exit, if there's an active statement

Rewording this to:

2. when a statement is removed from a cursor; that is either at cursor dealloc, 
or when the current statement is replaced.

--

___
Python tracker 

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



[issue44828] Using tkinter.filedialog crashes on macOS Python 3.9.6

2021-09-06 Thread Fahim Faisal


Fahim Faisal  added the comment:

Can also confirm this issue, tested on M1 and Intel Mac and both has the same 
error when using Monterey 12.0 Beta 21A5506j. 

On the same computer, using Big Sur, saves the file successfully and no error 
present. Seems like a Monterey issue, not dependent on specific hardware. 
(Intel/M1)

Tested on fresh Python 3.9.6 (tk version 8.6) Installation on Big Sur and 
Monterey Beta (Build 21A5506j) on a M1 Macbook Pro and Early 2015 13" Macbook 
Pro.

--
nosy: +i3p9

___
Python tracker 

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



[issue45122] Remove PyCode_New and PyCode_NewWithPosOnlyArgs

2021-09-06 Thread Guido van Rossum


New submission from Guido van Rossum :

This is up for grabs.

For reference, the Steering Council approved getting rid of these two C APIs 
without honoring the customary two-release deprecation period required by PEP 
387.

For reference see https://github.com/python/steering-council/issues/75. This 
also has references to python-dev and python-committers discussions.

--
messages: 401188
nosy: gvanrossum
priority: normal
severity: normal
stage: needs patch
status: open
title: Remove PyCode_New and PyCode_NewWithPosOnlyArgs
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue45122] Remove PyCode_New and PyCode_NewWithPosOnlyArgs

2021-09-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

PS. It would be nice to also update Cython, which is the only thing that uses 
these C APIs.

--

___
Python tracker 

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



[issue45122] Remove PyCode_New and PyCode_NewWithPosOnlyArgs

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

If possible, I suggest to do in in this order:

* Fix Cython
* Publish a Cython release including the fix
* (Maybe wait a bit)
* Remove the two functions

Previously, we tried to first modified Python, and then update Cython: it went 
bad.

Otherwise, the following 136 popular PyPI packages will fail to build on Python 
3.11:
https://mail.python.org/archives/list/python-...@python.org/message/6RO2WFU5Q7UQDVL72IRMT4T6L4GEAKB6/

In Fedora, we start to integrate Python 3.11 since alpha 1. In the past, the 
broken Cython was really annoying: many important packages failed to build, and 
so everything was broken. Hopefully, we can now patch Cython, and we modified 
most recipes building Python packages to always regenerate Cython source, to 
avoid such problem.

--
nosy: +vstinner

___
Python tracker 

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



[issue45122] Remove PyCode_New and PyCode_NewWithPosOnlyArgs

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

I understood that these function calls shoud be replaced with:

* PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
* code.replace() method: 
https://docs.python.org/dev/library/types.html#types.CodeType.replace

--

___
Python tracker 

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



[issue45122] Remove PyCode_New and PyCode_NewWithPosOnlyArgs

2021-09-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

That sounds like a good plan (note that alpha 1 will go out around Oct 4).

I left an issue for Cython: https://github.com/cython/cython/issues/4365

--

___
Python tracker 

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



[issue20115] NUL bytes in commented lines

2021-09-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The compile() doc currently says ""This function raises SyntaxError if the 
compiled source is invalid, and ValueError if the source contains null bytes."  
And indeed, in repository 3.9, 3.10, 3.11,

>>> compile('\0','','exec')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: source code string cannot contain null bytes

Ditto when run same in a file from IDLE or command line.  The exception 
sometimes when the null is in a comment or string within the code.

>>> '\0'
'\x00'
>>> #\0
>>> compile('#\0','','single', 0x200)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: source code string cannot contain null bytes
>>> compile('"\0"','','single', 0x200)
ValueError: source code string cannot contain null bytes

I am puzzled because "\0" and #\0 in the IDLE shell are sent as strings 
containing the string or comment to compiled with the call above in codeop.  
There must be some difference in when \0 is interpreted.

--

___
Python tracker 

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



[issue44348] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

bench.py: pyperf benchmarks on BaseException_dealloc().

Benchmarks results on PR 28190 on Fedora 34 with LTO (I didn't use PGO nor CPU 
pinning). It says "faster" but it's likely noise in the build or in the 
benchmark (again, I didn't use CPU pinning, and I used my laptop while the 
benchmark was running. IMO it means that the trashcan overhead is not 
significant on this benchmark.

$ python3 -m pyperf compare_to ref.json trashcan.json --table
++-+---+
| Benchmark  | ref | trashcan  |
++=+===+
| list 10_000| 1.27 ms | 1.18 ms: 1.08x faster |
++-+---+
| chain 10_000   | 3.94 ms | 3.89 ms: 1.01x faster |
++-+---+
| Geometric mean | (ref)   | 1.01x faster  |
++-+---+

Benchmark hidden because not significant (6): list 10, list 100, list 1000, 
chain 10, chain 100, chain 1000

--
Added file: https://bugs.python.org/file50266/bench.py

___
Python tracker 

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



[issue44348] test_exceptions.ExceptionTests.test_recursion_in_except_handler stack overflow on Windows debug builds

2021-09-06 Thread STINNER Victor


STINNER Victor  added the comment:

Using trashcan, it's possible to create a long longer than 10 000 exceptions. 
But currently, Python does crash in this case, so I stopped the benchmark at 10 
000.

--

___
Python tracker 

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



[issue20115] NUL bytes in commented lines

2021-09-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

Which part puzzles you?

I see that you tried

>>> #\0

This does not contain a null byte, just three characters: a hash, a backslash, 
and a digit zero.

--

___
Python tracker 

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



[issue45121] Regression in 3.9.7 with typing.Protocol

2021-09-06 Thread Eric V. Smith


Eric V. Smith  added the comment:

Possibly related to issue 45081, which ended up not having anything to do with 
dataclasses (despite the title).

Can you check if that fix solves your problem?

--
nosy: +eric.smith

___
Python tracker 

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



[issue45104] Error in __new__ docs

2021-09-06 Thread Vedran Čačić

Vedran Čačić  added the comment:

The first variant seems best to me.

--
nosy: +veky

___
Python tracker 

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



  1   2   >