Commit graph

8032 commits

Author SHA1 Message Date
Mark Shannon
0902afbae2
[3.12] GH-106895: Raise a ValueError when attempting to disable events that cannot be disabled. (GH-107337) (GH-107351) 2023-07-28 10:53:33 +01:00
Mark Shannon
3b1a4c1842
[3.12] GH-106897: Add RERAISE event to sys.monitoring. (GH-107291) (GH-107346)
* Ensures that exception handling events are balanced. Each [re]raise event has a matching unwind/handled event.
2023-07-28 09:48:35 +01:00
Miss Islington (bot)
abaf89d908
[3.12] gh-104621: Check for Incompatible Extensions in import_find_extension() (gh-107184) (gh-107360)
gh-104621: Check for Incompatible Extensions in import_find_extension() (gh-107184)

This fixes a bug where incompatible modules could still be imported if attempted multiple times.
(cherry picked from commit 75c974f535)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2023-07-27 21:51:34 +00:00
Carl Meyer
5fd028b677
[3.12] gh-106917: fix super classmethod calls to non-classmethods (GH-106977). (#107204)
(cherry picked from commit e5d5522612)
2023-07-24 21:13:17 +00:00
Victor Stinner
0d4a76654f
[3.12] GH-103082: Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS (#107069) (#107075)
GH-103082: Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS (#107069)

Rename private C API constants:

* Rename PY_MONITORING_UNGROUPED_EVENTS to _PY_MONITORING_UNGROUPED_EVENTS
* Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS

(cherry picked from commit 0927a2b25c)
2023-07-22 22:20:38 +00:00
Serhiy Storchaka
a423ddbdea
[3.12] gh-86493: Fix possible leaks in some modules initialization (GH-106768) (GH-106855)
Fix _ssl, _stat, _testinternalcapi, _threadmodule, cmath, math, posix, time.
(cherry picked from commit 3e65baee72)
2023-07-18 15:14:10 +03:00
Miss Islington (bot)
e903c16a6c
[3.12] gh-101538: Add experimental wasi-threads build (GH-101537) (#106834)
(cherry picked from commit d8f87cdf94)

Co-authored-by: YAMAMOTO Takashi <yamamoto@midokura.com>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-07-18 00:31:17 +02:00
Miss Islington (bot)
bb17e6f5de
[3.12] gh-105340: include hidden fast-locals in locals() (GH-105715) (#106470)
gh-105340: include hidden fast-locals in locals() (GH-105715)

* gh-105340: include hidden fast-locals in locals()
(cherry picked from commit 104d7b760f)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-07-05 23:31:37 +00:00
Miss Islington (bot)
da672b2d24
[3.12] Document PYTHONSAFEPATH along side -P (GH-106122) (#106352)
Document PYTHONSAFEPATH along side -P (GH-106122)
(cherry picked from commit 0355625d94)

Co-authored-by: Jeremy Paige <ucodery@gmail.com>
2023-07-05 13:21:38 +02:00
Miss Islington (bot)
0616c83f57
[3.12] gh-106145: Make end_{lineno,col_offset} required on type_param nodes (GH-106224) (#106295)
gh-106145: Make `end_{lineno,col_offset}` required on `type_param` nodes (GH-106224)
(cherry picked from commit 46c1097868)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-07-01 00:15:18 +00:00
Miss Islington (bot)
c9b9555650
[3.12] gh-101006: Improve error handling when read marshal data (GH-101007) (GH-106226)
* EOFError no longer overrides other errors such as MemoryError or OSError at
  the start of the object.
* Raise more relevant error when the NULL object occurs as a code object
  component.
* Minimize an overhead of calling PyErr_Occurred().
(cherry picked from commit 8bf6904b22)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-06-29 13:46:51 +03:00
Miss Islington (bot)
78cedf2607
[3.12] gh-106118: Add O_CLOEXEC preprocessor guard (GH-106120) (#106199)
(cherry picked from commit 6c60684bf5)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-06-28 11:54:53 +00:00
Miss Islington (bot)
1bb2bf7cd6
[3.12] gh-106030: Miscellaneous fixes in Python/suggestions.c (GH-106031) (#106036)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-06-26 20:43:20 -07:00
Miss Islington (bot)
b786fe8a09
[3.12] gh-105979: Fix exception handling in unmarshal_frozen_code (Python/import.c) (GH-105980) (#106055)
gh-105979: Fix exception handling in `unmarshal_frozen_code` (`Python/import.c`) (GH-105980)
(cherry picked from commit cd5280367a)

Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
2023-06-26 14:01:01 +05:30
Serhiy Storchaka
9cd366462b
[3.12] gh-106033: Get rid of new occurrences of PyDict_GetItem and Py… (#106041)
[3.12] gh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr (GH-106034)

These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt.  They should not be
used in new code.
(cherry picked from commit 1d33d53780)
2023-06-24 16:36:34 -07:00
Miss Islington (bot)
cc18a8b78a
[3.12] gh-105908: fix barry_as_FLUFL future import (GH-105909) (#105930)
(cherry picked from commit 28187a9c4f)

Co-authored-by: Crowthebird <78076854+thatbirdguythatuknownot@users.noreply.github.com>
2023-06-20 03:05:20 +00:00
Miss Islington (bot)
560adb01f9
[3.12] GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105863)
GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847)
(cherry picked from commit 2beab5bdef)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2023-06-16 18:29:55 +00:00
Miss Islington (bot)
0add51672d
[3.12] GH-105588: Add missing error checks to some obj2ast_* converters (GH-105838)
GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589)
(cherry picked from commit a4056c8f9c)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2023-06-15 23:12:01 +00:00
Miss Islington (bot)
bc997b38b6
[3.12] gh-105699: Use a Thread-Local Variable for PKGCONTEXT (gh-105740) (gh-105765)
This fixes a race during import. The existing _PyRuntimeState.imports.pkgcontext is shared between interpreters, and occasionally this would cause a crash when multiple interpreters were importing extensions modules at the same time.  To solve this we add a thread-local variable for the value.  We also leave the existing state (and infrequent race) in place for platforms that do not support thread-local variables.
(cherry picked from commit b87d288275)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2023-06-14 01:34:26 +00:00
Eric Snow
33d3069c45
[3.12] gh-104812: Run Pending Calls in any Thread (gh-104813) (gh-105752)
For a while now, pending calls only run in the main thread (in the main interpreter).  This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run.
(cherry picked from commit 757b402)
2023-06-14 00:50:08 +00:00
Miss Islington (bot)
c3a2cbb54d
[3.12] gh-105603: Change the PyInterpreterConfig.own gil Field (gh-105620) (gh-105731)
We are changing it to be more flexible that a strict bool can be for possible future expanded used cases.
(cherry picked from commit b97e14a806)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2023-06-13 17:42:56 +00:00
Miss Islington (bot)
0b305e8d36
[3.12] gh-105673: Fix uninitialized warning in sysmodule.c (GH-105674) (#105675)
In sys_add_xoption(), 'value' may be uninitialized for some error paths.
(cherry picked from commit a8d69fe92c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-06-12 09:15:45 +00:00
Miss Islington (bot)
a1034b5fd3
[3.12] gh-105375: Improve error handling in the sys extension module (GH-105611) (#105665)
In _PySys_AddXOptionWithError() and sys_add_xoption(),
bail on first error to prevent exceptions from possibly being
overwritten.
(cherry picked from commit 41cddc2e93)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-11 21:12:17 +00:00
Miss Islington (bot)
db5022c16f
[3.12] gh-105375: Improve PyErr_WarnExplicit() error handling (GH-105610) (#105659)
Bail on first error to prevent exceptions from possibly being
overwritten.
(cherry picked from commit 567d6ae8e7)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-11 19:51:30 +00:00
Miss Islington (bot)
122a1a2629
[3.12] gh-105375: Improve error handling in the builtins extension module (GH-105585) (#105649)
(cherry picked from commit d4fa52934a)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-11 11:17:48 +00:00
Miss Islington (bot)
65404930bd
[3.12] gh-105375: Improve error handling in compiler_enter_scope() (GH-105494) (#105581)
(cherry picked from commit 6c832ddcf2)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-09 17:23:45 +00:00
Miss Islington (bot)
16b1cdc87c
[3.12] gh-105564: Don't include artificial newlines in the line attribute of tokens (GH-105565) (#105579)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2023-06-09 16:58:14 +00:00
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