[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2022-01-28 Thread pmp-p


Change by pmp-p :


--
pull_requests: +29187
pull_request: https://github.com/python/cpython/pull/31006

___
Python tracker 

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



[issue46329] Split up the CALL_NO_KW and CALL_KW instructions.

2022-01-28 Thread Ken Jin


Change by Ken Jin :


--
pull_requests: +29186
pull_request: https://github.com/python/cpython/pull/31005

___
Python tracker 

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



[issue26552] Failing ensure_future still creates a Task

2022-01-28 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset a5451c96a14ac0c3ee7cef7b5c52ab1d783ec613 by Kumar Aditya in 
branch '3.10':
bpo-26552: Fixed case where failing `asyncio.ensure_future` did not close the 
coroutine (#30288) (#31003)
https://github.com/python/cpython/commit/a5451c96a14ac0c3ee7cef7b5c52ab1d783ec613


--

___
Python tracker 

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



[issue46565] Delete module-level loop variables when no longer needed

2022-01-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am opposed at this time.  Leaving loop variables available is an intended 
feature of python.

After reading point 1, I was tempted to say that you are making a fetish of 
typing or making the tail wag the dog. I mention this because others might have 
similar reactions.  After reading points 2 and 3, I am much more favorable and 
would allow changes in idlelib if any were needed.  A cleaner dir and help 
listing affects everyone.

I changed the title to be more 'neutral'.  'Leak' is perjorative.  "we need to 
remove these names" is a bit misleading as it implies total removal, which is 
not the proposal.

As it is, the PR applies a style standard on the stdlib that is not in PEP 8.  
I recommend that you start by proposing an addition to PEP-8. 
 "Unless X, global loop variables should be explicitly deleted as soon as not 
needed.  Or use a comprehension."  (I checked and 'loop' does not currently 
appear in PEP-8, and none of the 5 examples I checked could use a 
comprehension.)

If you do, I recommend starting with dir and help, with typing third.

You might post the idea on pydev and ask how much and what sort of discussion 
is needed.

--
nosy: +terry.reedy
title: Multiple modules leak `for` loop variables into module's namespace -> 
Delete module-level loop variables when no longer needed

___
Python tracker 

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



[issue46564] Near zero-cost super().meth() calls via adaptive superinstructions

2022-01-28 Thread Ken Jin


Ken Jin  added the comment:

> Oh, I didn't see your PR and commented as it was not mentioned in this bpo.

No problem. In the future please check the "Pull Requests" section on the 
issue. People don't always say "I created a PR at xxx". Often times we just 
link the PR into the issue itself.

Keep your PR around in case mine gets rejected, then we can take just the good 
parts. If mine's accepted, we can close yours.

--

___
Python tracker 

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



[issue46524] test_peg_generator takes 8 minutes on Windows

2022-01-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Do all of the tests use all of the slowly built extensions, or could the test 
file be split into multiple files run separately, each faster?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue46521] codeop._maybe_compile passes code with error + triple quotes

2022-01-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Tushar, I am the principle IDLE maintainer and have dealt with similar 
interactive compile problems on and off for a few years. Code module uses 
codeop._maybe_compile, which in turn uses batch-mode compile().

To review: Code can be in 3 states: legal, illegal (there is an positive error 
that must be fixed), and incomplete (might become legal with more input).  
Batch mode compile has all the code it is going to get, so it raises an 
exception for both bad and incomplete code.

In command-line languages, '\n' definitely signals end-of-command. Even in 
interactive mode, incomplete commands get an error message. The user must 
retype or recall and add more.

Python is a multiline and compound statement language.  Newline may instead 
signal the end of a compound statement header or the end of a nested statement, 
or even just be present for visual formatting.  Being able to continue 
incomplete statements after newline is essential.

In interactive mode, the interpreter looks at code after each newline and 
differentiates between unrecoverable and merely incomplete errors.  In the 
latter case, it sends a prompt to enter more and then reads more.

codeop._maybe compile attempts to simulate interactive mode and make a trinary 
decision (returning None for 'incomplete') using batch-mode binary compile().  
A hack using repeated compiles, a warning filter, and a helper function 
classifies code that failed the initial compile.  I suspect that a) it has 
never been perfect and b) it cannot be (see experiment below).

The issue here is that _maybe_compile returns None instead of passing on the 
compile syntax error.  Some debug prints would reveal exactly why.

An alternate approach might be to compile just once and use the error message 
and marked error range to split.  But that would require different 
message-range pairs for the different cases.  Compile does not seem to give 
this to us.  For the current case, 3.11.a04 compile (and ast.parse) give the 
same response to both bad and incomplete lines.

>>> compile("a b '''", '', 'single')
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1
a b '''
^
SyntaxError: unterminated triple-quoted string literal (detected at line 1)
>>> compile("s='''", '', 'single')
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1
s='''
  ^
SyntaxError: unterminated triple-quoted string literal (detected at line  1

But the REPL somehow treats the two lines differently when directly entered.

>>> s = '''
...
... '''
>>> a b '''
  File "", line 1
a b '''
^
SyntaxError: unterminated triple-quoted string literal (detected at line 1)

Pablo, is there any possibility that the internal REPL parser could be wrapped, 
exposed to Python, and called with fake stdin/out/err objects?

Or if one executes 'python -i -c "start code"', what is required of the 
standard streams for '-i' to be effective and actually shift into interactive 
mode, reading from and writing to those streams?  Just claim to be a tty?  It 
is any different than for reading responses to "input('prompt')"?

--
nosy: +terry.reedy
title: compile_command not raising syntax error when command ends with triple 
quotes -> codeop._maybe_compile passes code with error + triple quotes
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



[issue46564] Near zero-cost super().meth() calls via adaptive superinstructions

2022-01-28 Thread Kumar Aditya


Kumar Aditya  added the comment:

Oh, I didn't see your PR and commented as it was not mentioned in this bpo. 
Would you like to split the PR or continue with yours, either way is fine?

--

___
Python tracker 

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



[issue46564] Near zero-cost super().meth() calls via adaptive superinstructions

2022-01-28 Thread Ken Jin


Ken Jin  added the comment:

@Kumar, my PR already has your changes.

--

___
Python tracker 

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



[issue26552] Failing ensure_future still creates a Task

2022-01-28 Thread Kumar Aditya


Change by Kumar Aditya :


--
pull_requests: +29185
pull_request: https://github.com/python/cpython/pull/31003

___
Python tracker 

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



[issue46564] Near zero-cost super().meth() calls via adaptive superinstructions

2022-01-28 Thread Kumar Aditya


Change by Kumar Aditya :


--
pull_requests: +29184
pull_request: https://github.com/python/cpython/pull/31002

___
Python tracker 

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



[issue46564] Near zero-cost super().meth() calls via adaptive superinstructions

2022-01-28 Thread Kumar Aditya


Kumar Aditya  added the comment:

I was reading typeobject.c and noticed that creating a super object currently 
requires creating a frame object which is created lazily and is slow and it 
would work with the InterpreterFrame as well so I created a PR for this 
optimization and now it does not requires creating frame objects.

--
nosy: +kumaraditya303

___
Python tracker 

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



[issue46555] Unicode-mangled names refer inconsistently to constants

2022-01-28 Thread James Gerity


Change by James Gerity :


--
nosy: +SnoopJeDi

___
Python tracker 

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



[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Hi Max,

My apologies -- my first message was probably too dismissive.

Is there any way to make the existing code crash with pure Python, and can we 
then add such a test case? If not with pure Python, then perhaps with some 
minimal reproducible example using the C API?

Also, does the change have any effect on microbenchmarks involving the modified 
functions?

--

___
Python tracker 

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



[issue46503] assertion failure in Parser/string_parser.c

2022-01-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

In case anyone cares: in a non-debug build, this error had no real effect. It 
just caused the "find the literal part of an fstring" routine to terminate 
early, but since the part that it had already identified was still in error, a 
syntax error was still raised.

For "\Nxy" it would terminate at "\Nx", instead of consuming the whole string. 
But since "\Nx" isn't a valid string (bad unicode name escape), it would raise 
the same syntax error as "\Nxy".

--

___
Python tracker 

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



[issue36346] Prepare for removing the legacy Unicode C API

2022-01-28 Thread Inada Naoki


Change by Inada Naoki :


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



[issue41255] Argparse.parse_args exits on unrecognized option with exit_on_error=False

2022-01-28 Thread Jacob Walls


Change by Jacob Walls :


--
nosy: +jacobtylerwalls
nosy_count: 6.0 -> 7.0
pull_requests: +29183
pull_request: https://github.com/python/cpython/pull/30832

___
Python tracker 

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



[issue36346] Prepare for removing the legacy Unicode C API

2022-01-28 Thread Inada Naoki


Inada Naoki  added the comment:

No. I just waiting Python 3.11 become Bata.

--

___
Python tracker 

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



[issue45953] Statically allocate interpreter states as much as possible.

2022-01-28 Thread Brandt Bucher


Brandt Bucher  added the comment:

Any chance we could revert the recent renaming of tstate.exc_state and 
tstate.root_cframe in https://github.com/python/cpython/pull/30590? It broke 
Greenlet again:

https://github.com/python-greenlet/greenlet/issues/288

If it's only a name change (and the members themselves are the same), I think 
reverting it is preferable to burying Greenlet in more compatibility macros and 
bugging them to put out another new release.

--
nosy: +brandtbucher

___
Python tracker 

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



[issue46520] ast.unparse produces bad code for identifiers that become keywords

2022-01-28 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

'Reserved words' include all double underscore words, like __reserved__.  Using 
such is allowed, but we reserve the right to break such code by adding a use 
for the word.  'def' is a keyword.  Using identifier normalization to smuggle 
keywords into compiled code is a clever hack.  But I am not sure that there is 
an actionable bug anywhere.  

The Unicode normalization rules are not defined by us.  Changing how we use 
them or creating a custom normalization form is not to be done lightly.

Should ast.parse raise?  The effect is the same as "globals()['핕핖핗']=1" (which 
is the same as passing 'def' or anything else that normalizes to it) and that 
in turn allows ">>> 핕핖핗", which returns 1.  Should such identifiers be outlawed?

https://docs.python.org/3/reference/lexical_analysis.html#identifiers says "All 
identifiers are converted into the normal form NFKC while parsing; comparison 
of identifiers is based on NFKC."  This does not say when an identifier is 
compared to the keyword set, before or after normalization.  Currently is it 
before.  Changing this to after could be considered a backwards-incompatible 
feature change that would require a deprecation period with syntax warnings.  
(Do other implementations also compare before normalization?)

Batuhan already quoted https://docs.python.org/3/library/ast.html#ast.unparse 
and I mostly agree with his comments.  The "would produce" part is contingent 
upon the result having no syntax errors, and that cannot be guaranteed.  What 
could be done is to check every identifier against keywords and change the 
first character to a chosen NFKD equivalent.  Although 'fixing' the ast this 
way would make unparse seem to work better succeed in this case, there are 
other fixes that might also be suggested for the same reason. 

Until this is done in CPython, anyone who cares could write an AST visitor to 
make the same change before calling unparse.  Example code could be attached to 
this issue.

--
nosy: +terry.reedy
title: `ast.unparse` produces syntactically illegal code for identifiers that 
look like reserved words -> ast.unparse produces bad code for identifiers that 
become keywords

___
Python tracker 

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



[issue43112] SOABI on Linux does not distinguish between GNU libc and musl libc

2022-01-28 Thread Éric Araujo

Change by Éric Araujo :


--
pull_requests: +29182
pull_request: https://github.com/python/cpython/pull/31001

___
Python tracker 

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



[issue46285] protocol_version in http.server.test can be ignored

2022-01-28 Thread Géry

Change by Géry :


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

___
Python tracker 

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



[issue29688] Add support for Path.absolute()

2022-01-28 Thread Brett Cannon


Brett Cannon  added the comment:


New changeset 18cb2ef46c9998480f7182048435bc58265c88f2 by Barney Gale in branch 
'main':
bpo-29688: document and test `pathlib.Path.absolute()` (GH-26153)
https://github.com/python/cpython/commit/18cb2ef46c9998480f7182048435bc58265c88f2


--

___
Python tracker 

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



[issue45628] TimedRotatingFileHandler backupCount not working

2022-01-28 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy:  -brandtbucher

___
Python tracker 

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



[issue45628] TimedRotatingFileHandler backupCount not working

2022-01-28 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests:  -29179

___
Python tracker 

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



[issue46528] Simplify the VM's stack manipulations

2022-01-28 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29180
pull_request: https://github.com/python/cpython/pull/30998

___
Python tracker 

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



[issue46512] filecmp.cmpfiles w/ absolute path names

2022-01-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

https://docs.python.org/3/library/filecmp.html#filecmp.cmpfiles
I consider not working for absolute path names to be a bug.  Did your example 
work with relative paths?

--
nosy: +terry.reedy
title: Explicit or correct behavior of filecmp.cmpfiles w/ absolute path names 
-> filecmp.cmpfiles w/ absolute path names

___
Python tracker 

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



[issue43112] SOABI on Linux does not distinguish between GNU libc and musl libc

2022-01-28 Thread miss-islington


miss-islington  added the comment:


New changeset 1f036ede59e2c4befc07714cf76603c591d5c972 by Natanael Copa in 
branch 'main':
bpo-43112: detect musl as a separate SOABI (GH-24502)
https://github.com/python/cpython/commit/1f036ede59e2c4befc07714cf76603c591d5c972


--
nosy: +miss-islington

___
Python tracker 

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



[issue46501] Windows 10, turtle left right not working

2022-01-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

When posting code for a bug report, here or anywhere else, please use the 
minimal code needed to demonstrate the issue.  That includes using default arg 
values.  And do not use non-essential files that responders will not have.

Anyway, with default background, turtle, and color, on my Win 10 3.10.2 64 bit 
install, your code works fine.  Up and down arrows move turtle forward and 
back; right and left turn the turtle.  The difference from the web site, likely 
running on *nix, is that I have to press keys multiple times instead of holding 
them down.  

I have no idea what the difference might be from your Win 10 system.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue24398] Update test_capi to use test.support.script_helper

2022-01-28 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
nosy: +iritkatriel

___
Python tracker 

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



[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-28 Thread Maxwell Bernstein


Maxwell Bernstein  added the comment:

Ah, and another piece of the puzzle: this can happen in runtimes like Cinder 
that provide their own native code entrypoints to functions like a __get__.

--

___
Python tracker 

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



[issue26552] Failing ensure_future still creates a Task

2022-01-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks Kumar for the fix!

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



[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-28 Thread Maxwell Bernstein


Change by Maxwell Bernstein :


--
components: +C API

___
Python tracker 

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



[issue26552] Failing ensure_future still creates a Task

2022-01-28 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 24cc6411adbfeecd8901f1ea50caa414c908 by Kumar Aditya in 
branch 'main':
bpo-26552: Fixed case where failing `asyncio.ensure_future` did not close the 
coroutine (#30288)
https://github.com/python/cpython/commit/24cc6411adbfeecd8901f1ea50caa414c908


--

___
Python tracker 

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



[issue46497] IDLE macOS shortcut ctrl+S doesn’t work for show completions

2022-01-28 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I believe that this is a subset of #18444.  There are other shortcut that 
'flash' a menu entry but do nothing.  But I would consider a fix for this short 
of fixing everything.  

How do you disable the default for ^space?  In mac settings or tkinter (tk) 
settings?

--
components: +macOS
nosy: +ned.deily, ronaldoussoren
versions: +Python 3.11 -Python 3.10, Python 3.9

___
Python tracker 

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



[issue26552] Failing ensure_future still creates a Task

2022-01-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

So I just realized that the OP's description is slightly misleading. (Their 
code is spot on though!)

The code does not create an unwaited-for *task*, assuming that "task" refers to 
the asyncio.Task class.

What is created is a *coroutine* object that's never awaited (as the quoted 
RuntimeWarning message says: "coroutine 'foo' was never awaited").

So the thing that needs to be closed in the bowels of _ensure_future() is 
indeed the argument (coro_or_future), in case it is a coroutine object.

--

___
Python tracker 

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



[issue45628] TimedRotatingFileHandler backupCount not working

2022-01-28 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 3.0 -> 4.0
pull_requests: +29179
pull_request: https://github.com/python/cpython/pull/30998

___
Python tracker 

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



[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-28 Thread Maxwell Bernstein


Maxwell Bernstein  added the comment:

Hi Dennis,

Sorry, let me be more clear. CPython in general ensures that objects passed in 
as arguments to a function will live for the duration of the function call if 
they are otherwise untouched. As it is now, this invariant is not maintained 
when calling the __get__ descriptor. Right now, it is not only borrowed by the 
callee but also not owned by the caller (!).

Max

--

___
Python tracker 

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



[issue46329] Split up the CALL_NO_KW and CALL_KW instructions.

2022-01-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Seems that this PR is causing some segfaults. See 
https://github.com/python/cpython/pull/30855#issuecomment-1024658459

--
nosy: +pablogsal

___
Python tracker 

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



[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-28 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

I had a few style, approach, and testing preference questions, but I decided 
they're probably best addressed in a code review so I went ahead and posted the 
PR.

--

___
Python tracker 

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



[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-28 Thread Gregory Beauregard


Change by Gregory Beauregard :


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

___
Python tracker 

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



[issue6682] Default traceback does not handle PEP302 loaded modules

2022-01-28 Thread Irit Katriel


Irit Katriel  added the comment:

This was reported for 2.6, not clear why 3.1 and 3.2 were added later. 

Anyway, I'm not seeing the issue on 3.11 (with a script updated for python-3 
prints). 

Also, imp is deprecated now.

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



[issue46563] Add tests regarding context of exception in a finally block

2022-01-28 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46458] Optimise try-except code generation for the happy path

2022-01-28 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 36f538c8092eeb3d5b8bc9df0ae7cc348f08a865 by Irit Katriel in 
branch 'main':
bpo-46458: Add tests for context of exception in finally block (GH-30986)
https://github.com/python/cpython/commit/36f538c8092eeb3d5b8bc9df0ae7cc348f08a865


--

___
Python tracker 

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



[issue46528] Simplify the VM's stack manipulations

2022-01-28 Thread Brandt Bucher


Brandt Bucher  added the comment:

Hm, yeah. Bummer that this needs error handling now.

I'll have a fix up soon.

--

___
Python tracker 

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



[issue39486] Confusing error messages for %-formatting, related to escaped %-characters

2022-01-28 Thread Irit Katriel


Irit Katriel  added the comment:

On 3.11:

>>> "%+%abc% %" % ()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: not enough arguments for format string

>>> "%+%abc% %" % {}
Traceback (most recent call last):
  File "", line 1, in 
ValueError: unsupported format character '%' (0x25) at index 2

--
nosy: +iritkatriel
title: bug in %-formatting in Python, related to escaped %-characters -> 
Confusing error messages for %-formatting, related to escaped %-characters
versions: +Python 3.11 -Python 3.7

___
Python tracker 

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



[issue45555] Object stays alive for weak reference if an exception happens in constructor

2022-01-28 Thread Irit Katriel


Irit Katriel  added the comment:

I don't think there's any suitable place in the documentation to describe this. 
Like Pablo says, it is one of the many ways in which you can create a reference 
to an object.

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



[issue37588] Py_DEPRECATED and unavoidable warnings

2022-01-28 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue23291] Documentation about Py_Finalize(): Freeing objects

2022-01-28 Thread Irit Katriel


Change by Irit Katriel :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, iritkatriel, vstinner
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7

___
Python tracker 

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



[issue34284] Nonsensical exception message when calling `__new__` on non-instaniable objects

2022-01-28 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.11 -Python 3.8

___
Python tracker 

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



[issue40746] test_gdb failing on 32-bit armv7l when built with GCC -Og: Cannot access memory at address 0xfffffedc

2022-01-28 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I manually tested this on 3.11 main and it appears to be working.

--
resolution:  -> works for me
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue34888] Python3.8 optimizes away a "while" line

2022-01-28 Thread Irit Katriel


Irit Katriel  added the comment:

Does PEP626 help with this problem?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue36346] Prepare for removing the legacy Unicode C API

2022-01-28 Thread Irit Katriel


Irit Katriel  added the comment:

Is there anything left to do here?

--
nosy: +iritkatriel

___
Python tracker 

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



[issue46528] Simplify the VM's stack manipulations

2022-01-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Minor nit: I think swaptimize() should check the for PyMem_Malloc returning 
NULL here.

// Create an array with elements {0, 1, 2, ..., depth - 1}:
int *stack = PyMem_Malloc(depth * sizeof(int));
for (int i = 0; i < depth; i++) {
stack[i] = i;
}

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue46563] Add tests regarding context of exception in a finally block

2022-01-28 Thread Irit Katriel


Change by Irit Katriel :


--
title: Add tests and documentation regarding context of exception in a finally 
block -> Add tests regarding context of exception in a finally block

___
Python tracker 

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



[issue46560] ParamSpec: Typo in doc string

2022-01-28 Thread Ken Jin


Ken Jin  added the comment:

Thanks for the fix Zackery.

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



[issue46560] ParamSpec: Typo in doc string

2022-01-28 Thread miss-islington


miss-islington  added the comment:


New changeset 315a60acd14dd730b2081574c09ccc29e92ee687 by Miss Islington (bot) 
in branch '3.10':
bpo-46560: Fix a typo in `typing.ParamSpec's` doc string (GH-30995)
https://github.com/python/cpython/commit/315a60acd14dd730b2081574c09ccc29e92ee687


--

___
Python tracker 

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



[issue46563] Add tests and documentation regarding context of exception in a finally block

2022-01-28 Thread Irit Katriel


Irit Katriel  added the comment:

The documentation is fine: 
https://docs.python.org/3/library/exceptions.html#exception-context

--

___
Python tracker 

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



[issue46560] ParamSpec: Typo in doc string

2022-01-28 Thread Ken Jin


Ken Jin  added the comment:


New changeset ffa505b580464d9d90c29e69bd4db8c52275280a by Zackery Spytz in 
branch 'main':
bpo-46560: Fix a typo in `typing.ParamSpec's` doc string (GH-30995)
https://github.com/python/cpython/commit/ffa505b580464d9d90c29e69bd4db8c52275280a


--
nosy: +kj

___
Python tracker 

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



[issue46560] ParamSpec: Typo in doc string

2022-01-28 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45925] Upgrade macOS and Windows installers to use SQLite 3.37.2

2022-01-28 Thread miss-islington


miss-islington  added the comment:


New changeset ad9cf2fdd39968b07e04136c8b50f65a4596c087 by Miss Islington (bot) 
in branch '3.9':
bpo-45925: Update Windows installer to SQLite 3.37.2 (GH-30485)
https://github.com/python/cpython/commit/ad9cf2fdd39968b07e04136c8b50f65a4596c087


--

___
Python tracker 

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



[issue46560] ParamSpec: Typo in doc string

2022-01-28 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +29176
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30995

___
Python tracker 

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



[issue45925] Upgrade macOS and Windows installers to use SQLite 3.37.2

2022-01-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +29175
pull_request: https://github.com/python/cpython/pull/30994

___
Python tracker 

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



[issue45925] Upgrade macOS and Windows installers to use SQLite 3.37.2

2022-01-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset 4d191fcde426ca0643d961aa18e787103f05fce2 by Steve Dower in branch 
'3.10':
bpo-45925: Update Windows installer to SQLite 3.37.2 (GH-30485)
https://github.com/python/cpython/commit/4d191fcde426ca0643d961aa18e787103f05fce2


--

___
Python tracker 

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



[issue46565] Multiple modules leak `for` loop variables into module's namespace

2022-01-28 Thread Alex Waygood


Alex Waygood  added the comment:

+1 for the proposed PR. Loop variables leaking into the global namespace 
creates an extra burden for typeshed when we have to wade through a long list 
of objects that our tests report are present at runtime but not in the typeshed 
stubs. It's not the end of the world, but it takes time, and is annoying.

As Nikita explains, these leaky variables also make the output of `help()` much 
less useful.

The fix isn't hard, and shouldn't, in my opinion, be particularly controversial.

--

___
Python tracker 

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



[issue46524] test_peg_generator takes 8 minutes on Windows

2022-01-28 Thread Eric Snow


Eric Snow  added the comment:

On Tue, Jan 25, 2022 at 4:14 PM STINNER Victor  wrote:
> Currently, most CI run "make buildbottest" which uses -r option of 
> libregrtest: randomize tests order.

How hard would it be to first randomize the list and then move the
slow tests up to a random position in the first half (for example) of
the list?

--
nosy: +eric.snow

___
Python tracker 

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



[issue46542] test_json and test_lib2to3 crash on s390x Fedora Clang 3.x buildbot

2022-01-28 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
nosy: +sobolevn
nosy_count: 3.0 -> 4.0
pull_requests: +29174
pull_request: https://github.com/python/cpython/pull/30913

___
Python tracker 

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



[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-28 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 5445e173e76ec792358082caf660fbdc846c64b2 by Gregory Beauregard in 
branch 'main':
bpo-46553: allow bare typing.ClassVar annotations (#30983)
https://github.com/python/cpython/commit/5445e173e76ec792358082caf660fbdc846c64b2


--

___
Python tracker 

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



[issue46530] `'thread_time'` is missing from `test_get_clock_info`

2022-01-28 Thread miss-islington


miss-islington  added the comment:


New changeset 95b70e2ccfb295c77c3696bcb20c1513310efd1f by Miss Islington (bot) 
in branch '3.10':
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (GH-30913)
https://github.com/python/cpython/commit/95b70e2ccfb295c77c3696bcb20c1513310efd1f


--

___
Python tracker 

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



[issue46530] `'thread_time'` is missing from `test_get_clock_info`

2022-01-28 Thread miss-islington


miss-islington  added the comment:


New changeset ce5c637f5ae06f2a6a6e966524af9d0cc816bd3f by Miss Islington (bot) 
in branch '3.9':
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (GH-30913)
https://github.com/python/cpython/commit/ce5c637f5ae06f2a6a6e966524af9d0cc816bd3f


--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2022-01-28 Thread Steve Dower


Steve Dower  added the comment:

Tcl/Tk tracking issue is issue46567

--

___
Python tracker 

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



[issue46567] Add Tcl/Tk builds for ARM64

2022-01-28 Thread Steve Dower


New submission from Steve Dower :

Currently our ARM64 installs omit Tcl/Tk (and implicitly tkinter and IDLE) 
because there appears to be no upstream support for building Tcl/Tk for ARM64.

Once the upstream support exists, or we have a good enough patch to apply to 
our own copy of the sources, we need to add these back.

--
components: Tkinter, Windows
messages: 412011
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Add Tcl/Tk builds for ARM64
type: enhancement
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



[issue33125] Windows 10 ARM64 platform support

2022-01-28 Thread Steve Dower


Steve Dower  added the comment:

The ARM64 installer will be part of the next 3.11 release, minus the py.exe 
launcher (which needs a chunk of work in issue46566) and Tcl/Tk (which needs 
upstream support for the platform) and hence IDLE.

I'm hesitant to make a final release without these components. At the same 
time, I'm concerned about other release blocking issues that may arise that are 
unrelated, so I do want to get releases out even without them so that we have a 
chance to discover them.

--

___
Python tracker 

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



[issue46565] Multiple modules leak `for` loop variables into module's namespace

2022-01-28 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +zach.ware

___
Python tracker 

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



[issue46550] __slots__ updates despite being read-only

2022-01-28 Thread Eryk Sun


Eryk Sun  added the comment:

If the target object of an augmented assignment doesn't support the in-place 
binary operation, the normal binary operation is used instead. Thus an 
augmented assignment is implemented to always assign the result back to the 
target. For an attribute, that's similar to `x.a += 1` -> `x.a = x.a + 1`. For 
example:

>>> dis.dis('x.a += 1')
  0 RESUME   0

  1   2 LOAD_NAME0 (x)
  4 DUP_TOP
  6 LOAD_ATTR1 (a)
  8 LOAD_CONST   0 (1)
 10 BINARY_OP   13 (+=)
 12 ROT_TWO
 14 STORE_ATTR   1 (a)
 16 LOAD_CONST   1 (None)
 18 RETURN_VALUE

Note the STORE_ATTR instruction in the above bytecode.

As to __slots__, I think that class construction should store it as a tuple, 
unless maybe I'm overlooking some use case.

--

___
Python tracker 

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



[issue46566] Support -3.11-arm64 in py.exe launcher

2022-01-28 Thread Steve Dower


New submission from Steve Dower :

We now have a traditional installer that runs on Windows ARM64 devices, but it 
omits the py.exe launcher. This is because sys.winver is "3.11-arm64" and hence 
the registry tag (see PEP 514) is not detected by the launcher.

Currently, the launcher is not included in the installer and appears as 
disabled with an explanatory note.

We need to add support for it eventually, and possibly block the final/RC/beta 
releases if we don't have it. (We don't ship the launcher with Nuget or Store 
packages, so nobody will miss it there, but they probably will here.)

32-bit apps can still run on ARM64, so it isn't essential to make it a native 
process. It just has to be able to detect the registry keys.

It should still support 32-bit and 64-bit installs, because those can also be 
run on ARM64 devices (though there are numerous things that don't work as well 
as a native build).

Possibly we want to just do the work to directly follow PEP 514 now? Depends on 
who volunteers to work on this, I guess.

--
components: Windows
messages: 412008
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Support -3.11-arm64 in py.exe launcher
type: enhancement
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



[issue46565] Multiple modules leak `for` loop variables into module's namespace

2022-01-28 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46565] Multiple modules leak `for` loop variables into module's namespace

2022-01-28 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
nosy: +AlexWaygood

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2022-01-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset 45faf151c693b6f13f78926761caea6df7242024 by Steve Dower in branch 
'main':
bpo-33125: Enables building traditional installer for Windows ARM64 (GH-30885)
https://github.com/python/cpython/commit/45faf151c693b6f13f78926761caea6df7242024


--

___
Python tracker 

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



[issue46564] Near zero-cost super().meth() calls via adaptive superinstructions

2022-01-28 Thread Ken Jin


Change by Ken Jin :


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

___
Python tracker 

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



[issue46565] Multiple modules leak `for` loop variables into module's namespace

2022-01-28 Thread Nikita Sobolev


New submission from Nikita Sobolev :

Some variables created as `for X in ...` leak into module's namespace, where 
the loop is defined.

I wrote a simple `flake8` plugin to find names that are used in `ast.Module` in 
`ast.For`, but not under `if __name__ == '__main__'` and are not used in `del` 
afterwards.

Here's what I got:

- Lib/inspect.py:157
- Lib/locale.py:746
- Lib/sysconfig.py:186
- Lib/tokenize.py:141 - 151
- Lib/multiprocessing/process.py:427
- Lib/multiprocessing/managers.py:55 
- Lib/json/encoder.py:30
- Lib/http/cookiejar.py:93 
- Lib/email/contentmanager.py:73
- Lib/email/contentmanager.py:79
- Lib/email/contentmanager.py:247
- Lib/email/quoprimime.py:60
- Lib/email/quoprimime.py:149
- Lib/_compat_pickle
- Lib/lib2to3/pgen2/grammar.py

I think, that we need to remove these names. Why?
1. They complicate typeshed typing, we have to annotate them in typeshed, or 
write custom ignore rules for our test suite. Ref: 
https://github.com/python/typeshed/blob/56aa2088aada530400b6fdddf0f1d17ca3aaa86f/tests/stubtest_allowlists/py3_common.txt#L448

2. They are in `dir()`, example:

```
>>> import inspect
>>> 'k' in dir(inspect)
True
```

3. They are listed in `help()`, let's use `json.encoder` as an example:

```
DATA
ESCAPE = re.compile('[\\x00-\\x1f"\\b\\f\\n\\r\\t]')
ESCAPE_ASCII = re.compile('(["]|[^\\ -~])')
ESCAPE_DCT = {'\x00': r'\u', '\x01': r'\u0001', '\x02': r'\u0002',...
HAS_UTF8 = re.compile(b'[\x80-\xff]')
INFINITY = inf
i = 31
```

4. We also have to exclude them sometimes in tests, like 
https://github.com/python/cpython/blob/db77bcd6092f3c174ae855522411ab83854d65a8/Lib/test/test_inspect.py#L111


I think that adding `del X` somewhere in these modules is a good thing:
1. Not hard to backport
2. Fixes multiple issues above
3. Does not store useless objects in memory
4. Does not confuse people
5. Some modules already delete unused intermediate vars, so it is not something 
new to CPython, for example: `multiprocessing.process` 
https://github.com/python/cpython/blob/db77bcd6092f3c174ae855522411ab83854d65a8/Lib/multiprocessing/process.py#L419

PR is on its way!

--
components: Library (Lib)
messages: 412006
nosy: sobolevn
priority: normal
severity: normal
status: open
title: Multiple modules leak `for` loop variables into module's namespace
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46564] Near zero-cost super().meth() calls via adaptive superinstructions

2022-01-28 Thread Ken Jin


New submission from Ken Jin :

`super().meth()` is expensive. I propose to optimize 3 parts of this:

1. Avoid creating a temporary super() proxy object.
2. Avoid creating a bound method.
3. Avoid method lookup in super MRO using the inline cache.

Credit for 1. and 2. doesn't belong to me. Those were inspired by the excellent 
work done in issue43563.

I'll do this by combining the adjacent CALL (super) and LOAD_METHOD 
instructions into CALL_NO_KW_SUPER__LOAD_METHOD. Using the specializer means:

- We don't touch any compiler code.
- This custom instruction isn't revealed to the user
- I can make use of the 5 cache entries shared by both CALL_ADAPTIVE and 
LOAD_METHOD_ADAPTIVE.

The final 2-argument super(type, obj).meth() form will have almost no overhead 
over a corresponding self.meth() call in the current implementation.

Please see https://github.com/faster-cpython/ideas/issues/242 and 
https://github.com/faster-cpython/ideas/discussions/239 for more info.

--
assignee: kj
components: Interpreter Core
messages: 412005
nosy: Mark.Shannon, kj
priority: normal
severity: normal
status: open
title: Near zero-cost super().meth() calls via adaptive superinstructions
type: performance
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



[issue45925] Upgrade macOS and Windows installers to use SQLite 3.37.2

2022-01-28 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29171
pull_request: https://github.com/python/cpython/pull/30991

___
Python tracker 

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



[issue45925] Upgrade macOS and Windows installers to use SQLite 3.37.2

2022-01-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset db77bcd6092f3c174ae855522411ab83854d65a8 by Kumar Aditya in 
branch 'main':
bpo-45925: Update Windows installer to SQLite 3.37.2 (GH-30485)
https://github.com/python/cpython/commit/db77bcd6092f3c174ae855522411ab83854d65a8


--

___
Python tracker 

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



[issue46557] Logging captured warnings with a format string unnecessarily groups warnings together

2022-01-28 Thread Vinay Sajip


Change by Vinay Sajip :


--
type: behavior -> enhancement
versions:  -Python 3.10, 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



[issue46458] Optimise try-except code generation for the happy path

2022-01-28 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests:  -29165

___
Python tracker 

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



[issue46563] Add tests and documentation regarding context of exception in a finally block

2022-01-28 Thread Irit Katriel


Change by Irit Katriel :


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

___
Python tracker 

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



[issue46563] Add tests and documentation regarding context of exception in a finally block

2022-01-28 Thread Irit Katriel


New submission from Irit Katriel :

This behavior (that the OSError has the ValueError as context) should be tested 
and documented: 


>>> try:
...   raise TypeError(1)
... except:
...   raise ValueError(2)
... finally:
...   raise OSError(3)
... 
Traceback (most recent call last):
  File "", line 2, in 
TypeError: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 4, in 
ValueError: 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 6, in 
OSError: 3

--
components: Interpreter Core
messages: 412003
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Add tests and documentation regarding context of exception in a finally 
block
type: enhancement
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



[issue46072] Unify handling of stats in the CPython VM

2022-01-28 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 90ab138bbdc63763ad825ed6d4821367c09c4015 by Mark Shannon in 
branch 'main':
bpo-46072: Add simple stats for Python calls. (GH-30989)
https://github.com/python/cpython/commit/90ab138bbdc63763ad825ed6d4821367c09c4015


--

___
Python tracker 

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



[issue46533] Specialize for staticmethods and classmethods

2022-01-28 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue46550] __slots__ updates despite being read-only

2022-01-28 Thread Ian Lee


Ian Lee  added the comment:

@ronaldoussoren - right, I agree that I think that raising the AttributeErrors 
is the right thing. The part that feels like a bug to me is that the exception 
is saying it is read only and yet it is not being treated it that way (even 
though as you point out, the end result doesn't "work").

Maybe this is something about the augmented assignment that I'm just not 
grokking... I read the blurb @eryksun posted several times, but not seeming to 
see what is going on.

--

___
Python tracker 

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



[issue46562] Add typeof or enum behavior in the typing module

2022-01-28 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for your report!

I think you're looking for the Literal type.

Also, new typing behaviors are better discussed first on 
https://github.com/python/typing or the typing-sig mailing list.

--
nosy: +Jelle Zijlstra
resolution:  -> later
stage:  -> resolved
status: open -> closed
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



[issue46072] Unify handling of stats in the CPython VM

2022-01-28 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +29168
pull_request: https://github.com/python/cpython/pull/30989

___
Python tracker 

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



[issue40170] [C API] Prepare PyTypeObject structure for a stable ABI: avoid accessing members in the public API

2022-01-28 Thread STINNER Victor


STINNER Victor  added the comment:

I close the issue. While this issue is not fully fixed, it's a milestone of my 
"stable ABI" goal. I prefer to address remaining issues in new separted issues.

This issues is not fully fixed, there are are still a 4 macros which access 
directly PyTypeObject members:

* PySequence_ITEM()
* _PyObject_SIZE()
* _PyObject_VAR_SIZE()
* PyType_HasFeature() (if Py_LIMITED_API is not defined)

PySequence_ITEM() and PyType_HasFeature() are important for performance, I 
prefer to have a PEP before changing these two functions.

_PyObject_SIZE() and _PyObject_VAR_SIZE() should be made public with a better 
name like PyObject_SizeOf() and PyVarObject_SizeOf(). But I prefer to do that 
in a separated issue.

IMO it would be interesting to merge the PyHeapTypeObject structure into the 
PyTypeObject structure:
https://bugs.python.org/issue46433#msg411167

And make the PyTypeObject opaque: deprecate static types and promote the usage 
of heap types in C extensions. That's a big project which may be splitted into 
multiple issues and the final change may need its own PEP.

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



[issue40170] [C API] Prepare PyTypeObject structure for a stable ABI: avoid accessing members in the public API

2022-01-28 Thread Michael Felt


Change by Michael Felt :


--
nosy:  -Michael.Felt

___
Python tracker 

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



[issue40170] [C API] Prepare PyTypeObject structure for a stable ABI: avoid accessing members in the public API

2022-01-28 Thread STINNER Victor


Change by STINNER Victor :


--
title: [C API] Make PyTypeObject structure an opaque structure in the public C 
API -> [C API] Prepare PyTypeObject structure for a stable ABI: avoid accessing 
members in the public API

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2022-01-28 Thread STINNER Victor


STINNER Victor  added the comment:

Changes already done:

* Macros converted to regular functions:
 
  * PyObject_GET_WEAKREFS_LISTPTR(); add internal inline 
_PyObject_GET_WEAKREFS_LISTPTR()
  * PyType_SUPPORTS_WEAKREFS(); add internal inline _PyType_SUPPORTS_WEAKREFS()
  * PyObject_CheckBuffer(); no fast internal API
  * PyObject_IS_GC(); no fast internal API
  * PyDescr_IsData(); no fast internal API

* Always implemented as a function, remove macro optimization in the 
non-limited API:

  * PyIter_Check(); no fast internal API
  * PyIndex_Check(); add internal inline _PyIndex_Check()
  * PyExceptionClass_Name(); no fast internal API

* Py_TRASHCAN_BEGIN() macro now calls _PyTrash_cond() function: no longer read 
directly tp_dealloc member
* PyObject_NEW() macro becomes an alias to PyObject_New()
* Remove PyHeapType_GET_MEMBERS() (move it to the internal C API)

PyType_HasFeature() is left unchanged since the change caused performance issue 
on macOS, whereas Python is not built with LTO.

--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2022-01-28 Thread STINNER Victor


STINNER Victor  added the comment:

The negative refcount issue has been fixed ;-)

At commit 9a241271139a317597aca71d5971346b2cfe7dbd, Python now leaks exactly 0 
reference count and 0 memory block at exit:

$ ./python -I -X showrefcount -c pass
[0 refs, 0 blocks]

--

___
Python tracker 

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



[issue39511] [subinterpreters] Per-interpreter singletons (None, True, False, etc.)

2022-01-28 Thread STINNER Victor


STINNER Victor  added the comment:

> On such platforms, the `PyGet_Foo` API can be on equal footing with the 
> legacy `Py_Foo` statics, i.e. both would do the same thing. That's how I've 
> done it in my experiment. The obvious problem is that on platforms without 
> compiler support for TLS, `Py_Foo` would be unavailable, and that's probably 
> a no-go for an API that wouldn't be deprecated.

My GH-18301 PR uses "#define Py_None Py_GetNone()" which is backward compatible 
in terms of API.

Py_GetNone() can have various implementations, it doesn't matter at the API 
level.

--

___
Python tracker 

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



[issue46562] Add typeof or enum behavior in the typing module

2022-01-28 Thread Pedro Torres


Change by Pedro Torres :


--
title: Add typeof or enum behavior for in the Typing module -> Add typeof or 
enum behavior in the typing module

___
Python tracker 

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



  1   2   >