Commit graph

8005 commits

Author SHA1 Message Date
Miss Islington (bot)
77c03a3b72
[3.12] gh-100227: Lock Around Modification of the Global Allocators State (gh-105516) (gh-105532)
The risk of a race with this state is relatively low, but we play it safe anyway. We do avoid using the lock in performance-sensitive cases where the risk of a race is very, very low.
(cherry picked from commit 68dfa49627)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2023-06-08 22:35:53 +00:00
Eric Snow
b08ea9a561
[3.12] gh-100227: Lock Around Adding Global Audit Hooks (gh-105515) (gh-105525)
The risk of a race with this state is relatively low, but we play it safe anyway.
(cherry picked from commit e822a676f1)
2023-06-08 21:05:47 +00:00
Miss Islington (bot)
2ad2bd8b14
[3.12] gh-100227: Lock Around Use of the Global "atexit" State (gh-105514) (gh-105517)
The risk of a race with this state is relatively low, but we play it safe anyway.
(cherry picked from commit 7799c8e678)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2023-06-08 19:27:44 +00:00
Miss Islington (bot)
3d4a786b9b
[3.12] gh-105390: Add explicit type cast (GH-105466) (#105472) 2023-06-07 23:46:24 +01:00
Miss Islington (bot)
117c153d9f
[3.12] gh-105435: Fix spurious NEWLINE token if file ends with comment without a newline (GH-105442) (#105444) 2023-06-07 14:07:57 +01:00
Miss Islington (bot)
c84d4d165d
[3.12] gh-105390: Correctly raise TokenError instead of SyntaxError for tokenize errors (GH-105399) (#105439) 2023-06-07 12:38:36 +01:00
Miss Islington (bot)
67b288f8be
[3.12] gh-105259: Ensure we don't show newline characters for trailing NEWLINE tokens (GH-105364) (#105367) 2023-06-06 14:47:45 +02:00
Miss Islington (bot)
6d0354167f
[3.12] gh-105164: Detect annotations inside match blocks (GH-105177) (#105313)
(cherry picked from commit 69d1245685)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-06-05 13:42:31 +00:00
Miss Islington (bot)
46cc4f0f76
[3.12] gh-105184: document that marshal functions can fail and need to be checked with PyErr_Occurred (GH-105185) (#105218)
gh-105184: document that marshal functions can fail and need to be checked with PyErr_Occurred (GH-105185)
(cherry picked from commit ee26ca13a1)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-06-02 08:24:25 +00:00
Miss Islington (bot)
e6d5e63614
[3.12] gh-104799: Default missing lists in AST to the empty list (GH-104834) (#105213)
(cherry picked from commit 77d2579586)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-02 02:06:07 +00:00
Miss Islington (bot)
d2be5c73ed
[3.12] gh-104341: Call _PyEval_ReleaseLock() with NULL When Finalizing the Current Thread (gh-105109) (gh-105209)
This avoids the problematic race in drop_gil() by skipping the FORCE_SWITCHING code there for finalizing threads.

(The idea for this approach came out of discussions with @markshannon.)
(cherry picked from commit 3698fda)

Co-authored-by: Eric Snow ericsnowcurrently@gmail.com
2023-06-01 22:50:28 +00:00
Miss Islington (bot)
c687946f68
[3.12] gh-105069: Add a readline-like callable to the tokenizer to consume input iteratively (GH-105070) (#105119)
gh-105069: Add a readline-like callable to the tokenizer to consume input iteratively (GH-105070)
(cherry picked from commit 9216e69a87)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2023-05-31 11:11:53 +01:00
Miss Islington (bot)
2f8c22f1d6
[3.12] gh-105042: Disable unmatched parens syntax error in python tokenize (GH-105061) (#105120)
gh-105042: Disable unmatched parens syntax error in python tokenize (GH-105061)
(cherry picked from commit 70f315c2d6)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2023-05-31 11:11:39 +01:00
Miss Islington (bot)
5fff491bd5
[3.12] gh-105035: fix super() calls on unusual types (e.g. meta-types) (GH-105094) (#105117)
gh-105035: fix super() calls on unusual types (e.g. meta-types) (GH-105094)
(cherry picked from commit 68c75c3153)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-05-30 21:10:46 +00:00
Miss Islington (bot)
7899fac3c5
[3.12] gh-104799: Move location of type_params AST fields (GH-104828) (#104974)
gh-104799: Move location of type_params AST fields (GH-104828)
(cherry picked from commit ba73473f4c)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-30 14:33:01 +00:00
Miss Islington (bot)
68bf3fe0e4
gh-104820: Fixes os.stat on Windows to better handle file systems that do not support FileIdInformation (GH-104892)
(cherry picked from commit 6031727a37)

Co-authored-by: Steve Dower <steve.dower@python.org>
2023-05-29 17:57:04 +01:00
Miss Islington (bot)
3f8d5d9ed6
[3.12] gh-105017: Include CRLF lines in strings and column numbers (GH-105030) (#105041)
gh-105017: Include CRLF lines in strings and column numbers (GH-105030)
(cherry picked from commit 96fff35325)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2023-05-28 15:16:43 +01:00
Miss Islington (bot)
2c02c68867
[3.12] gh-104976: Ensure trailing dedent tokens are emitted as the previous tokenizer (GH-104980) (#105000) 2023-05-26 23:14:45 +01:00
Miss Islington (bot)
8ca29573a8
[3.12] gh-104972: Ensure that line attributes in tokens in the tokenize module are correct (GH-104975) (#104982)
gh-104972: Ensure that line attributes in tokens in the tokenize module are correct (GH-104975)
(cherry picked from commit 3fdb55c482)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2023-05-26 11:25:46 -04:00
Pablo Galindo Salgado
3d2ed8991f
[3.12] gh-104825: Remove implicit newline in the line attribute in tokens emitted in the tokenize module (GH-104846). (#104850)
(cherry picked from commit c8cf9b42eb)
2023-05-24 10:40:51 +00:00
Marta Gómez Macías
729b252241
gh-104741: Add line number attribute to indentation error exception (#104743) 2023-05-22 11:30:18 +00:00
Jelle Zijlstra
a5f244d627
gh-104656: Rename typeparams AST node to type_params (#104657) 2023-05-21 21:25:09 -07:00
Marta Gómez Macías
8817886ae5
gh-102856: Tokenize performance improvement (#104731) 2023-05-22 00:29:04 +00:00
Jelle Zijlstra
cd9748409a
gh-104686: Fix tracing for decorated classes (#104708) 2023-05-21 16:20:19 -07:00
gsallam
be0c106789
gh-103295: expose API for writing perf map files (#103546)
Co-authored-by: Aniket Panse <aniketpanse@fb.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-05-21 11:12:24 +01:00
Marta Gómez Macías
6715f91edc
gh-102856: Python tokenizer implementation for PEP 701 (#104323)
This commit replaces the Python implementation of the tokenize module with an implementation
that reuses the real C tokenizer via a private extension module. The tokenize module now implements
a compatibility layer that transforms tokens from the C tokenizer into Python tokenize tokens for backward
compatibility.

As the C tokenizer does not emit some tokens that the Python tokenizer provides (such as comments and non-semantic newlines), a new special mode has been added to the C tokenizer mode that currently is only used via
the extension module that exposes it to the Python layer. This new mode forces the C tokenizer to emit these new extra tokens and add the appropriate metadata that is needed to match the old Python implementation.

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2023-05-21 01:03:02 +01:00
Jelle Zijlstra
8a8853af24
gh-104640: Disallow walrus in comprehension within type scopes (#104641) 2023-05-19 07:31:09 -07:00
Mark Shannon
c26d03d5d6
GH-102818: Do not call PyTraceBack_Here in sys.settrace trampoline. (GH-104579) 2023-05-19 12:40:48 +01:00
Carl Meyer
70c7796477
gh-104619: never leak comprehension locals to outer locals() (#104637) 2023-05-18 18:50:24 -07:00
Carl Meyer
86e6f16ccb
gh-104602: ensure all cellvars are known up front (#104603)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-19 00:07:35 +00:00
Carl Meyer
0589c6a4d3
gh-104615: don't make unsafe swaps in apply_static_swaps (#104620) 2023-05-18 21:22:03 +00:00
Mark Shannon
cfa517d5a6
GH-96803: Document and test new unstable internal frame API functions (GH-104211)
Weaken contract of PyUnstable_InterpreterFrame_GetCode to return PyObject*.
2023-05-18 10:10:15 +01:00
Mark Shannon
68b5f08b72
GH-104580: Don't cache eval breaker in interpreter (GH-104581)
Move eval-breaker to the front of the interpreter state.
2023-05-18 10:08:33 +01:00
Jelle Zijlstra
662aede68b
gh-104374: Remove access to class scopes for inlined comprehensions (#104528)
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-05-18 05:22:17 +00:00
Mark Shannon
f7df173949
GH-101520: Move tracemalloc functionality into core, leaving interface in Modules. (#104508) 2023-05-17 14:17:16 +01:00
Jelle Zijlstra
97db2f3e07
gh-104572: Improve error messages for invalid constructs in PEP 695 contexts (#104573) 2023-05-17 06:05:42 -07:00
Brandt Bucher
b4a9747923
GH-103906: Remove immortal refcounting in the interpreter (GH-103909) 2023-05-16 14:36:02 -07:00
Carl Meyer
f40890b124
gh-103865: add monitoring support to LOAD_SUPER_ATTR (#103866) 2023-05-16 10:29:00 -06:00
Jelle Zijlstra
24d8b88420
gh-103763: Implement PEP 695 (#103764)
This implements PEP 695, Type Parameter Syntax. It adds support for:

- Generic functions (def func[T](): ...)
- Generic classes (class X[T](): ...)
- Type aliases (type X = ...)
- New scoping when the new syntax is used within a class body
- Compiler and interpreter changes to support the new syntax and scoping rules 

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Eric Traut <eric@traut.com>
Co-authored-by: Larry Hastings <larry@hastings.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-15 20:36:23 -07:00
Irit Katriel
8a3702f0c7
gh-104482: Fix error handling bugs in ast.c (#104483) 2023-05-15 21:53:55 +01:00
Eric Snow
26baa747c2
gh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (gh-104437)
With the move to a per-interpreter GIL, this check slipped through the cracks.
2023-05-15 13:59:26 -06:00
Erlend E. Aasland
186bf39f5c
gh-101819: Isolate _io (#101948)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-05-15 09:26:27 +00:00
Dong-hee Na
178153c9a6
gh-87092: avoid gcc warning on uninitialized struct field in assemble.c (#104460) 2023-05-14 12:03:30 +01:00
Carl Meyer
563c7dcba0
gh-104404: fix crasher with nested comprehensions plus lambdas (#104442) 2023-05-12 17:42:04 -07:00
Brandt Bucher
1eb950ca55
GH-104405: Add missing PEP 523 checks (GH-104406) 2023-05-12 22:23:13 +00:00
Mark Shannon
45f5aa8fc7
GH-103082: Filter LINE events in VM, to simplify tool implementation. (GH-104387)
When monitoring LINE events, instrument all instructions that can have a predecessor on a different line.
Then check that the a new line has been hit in the instrumentation code.
This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
2023-05-12 12:21:20 +01:00
Jelle Zijlstra
718b132772
gh-104413: Fix refleak when super attribute throws AttributeError (#104414) 2023-05-12 13:00:14 +05:30
Carl Meyer
ac66cc17f2
gh-104377: fix cell in comprehension that is free in outer scope (#104394) 2023-05-11 16:48:21 -07:00
Carl Meyer
77262458fe
gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270) 2023-05-11 08:08:13 -06:00
Carl Meyer
1670729383
gh-87849: fix SEND specialization family definition (GH-104268) 2023-05-11 12:52:06 +01:00