Commit graph

7540 commits

Author SHA1 Message Date
Lysandros Nikolaou
a09d3901a5
[3.11] gh-96670: Raise SyntaxError when parsing NULL bytes (GH-97594) (#104195) 2023-05-07 11:12:04 +01:00
Miss Islington (bot)
15ffcf76e1
[3.11] gh-104018: remove unused format "z" handling in string formatfloat() (GH-104107) (#104260)
gh-104018: remove unused format "z" handling in string formatfloat() (GH-104107)

This is a cleanup overlooked in PR GH-104033.
(cherry picked from commit 69621d1b09)

Co-authored-by: John Belmonte <john@neggie.net>
2023-05-07 05:06:06 +00:00
Miss Islington (bot)
8f23cadc4c
[3.11] gh-103886: Improve builtins.__doc__ (GH-104179) (#104257)
gh-103886: Improve `builtins.__doc__` (GH-104179)
(cherry picked from commit b35711d17a)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-07 02:28:04 +00:00
Tian Gao
fee3c91a19
[3.11] GH-103971: Fix incorrect locations for code following case blocks 2023-04-28 20:08:25 +00:00
Irit Katriel
93a9535d54
[3.11] gh-101517: fix line number propagation in code generated for except* (#103550) (#103816)
Manual backport of https://github.com/python/cpython/pull/103550.



<!-- gh-issue-number: gh-101517 -->
* Issue: gh-101517
<!-- /gh-issue-number -->

---------

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-04-25 18:08:54 +01:00
Max Bachmann
b28f919007
[3.11] gh-102281: Fix potential nullptr dereference + use of uninitia… (#103040)
[3.11] gh-102281: Fix potential nullptr dereference + use of uninitialized memory (gh-102282)
(cherry picked from commit afa6092ee4)
2023-03-25 16:35:00 -07:00
Miss Islington (bot)
4c6b354699
gh-98608: Fix Failure-handling in new_interpreter() (gh-102658)
The error-handling code in new_interpreter() has been broken for a while.  We hadn't noticed because those code mostly doesn't fail.  (I noticed while working on gh-101660.)  The problem is that we try to clear/delete the newly-created thread/interpreter using itself, which just failed.  The solution is to switch back to the calling thread state first.

(cherry picked from commit d1b883b52a)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
https: //github.com/python/cpython/issues/98608
2023-03-21 12:13:31 -07:00
Mark Shannon
d149f15d63
[3.11] gh-101975: Fixed a potential SegFault on garbage collection (GH-102803) (GH-102807)
Authored-by: gaogaotiantian <gaogaotiantian@hotmail.com>
2023-03-20 14:42:15 +00:00
Miss Islington (bot)
63fd954100
gh-102356: Add thrashcan macros to filter object dealloc (GH-102426)
Add thrashcan macros to the deallocator of the filter objects to protect against deeply nested destruction of chains of nested filters.
(cherry picked from commit 66aa78cbe6)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2023-03-05 03:25:48 -08:00
Kumar Aditya
026faf20cc
[3.11] GH-102126: fix deadlock at shutdown when clearing thread state… (#102234)
[3.11] GH-102126: fix deadlock at shutdown when clearing thread states (GH-102222)

(cherry picked from commit 5f11478ce7)
2023-02-25 21:00:05 +05:30
Miss Islington (bot)
ddb65c47b1
[3.11] gh-97786: Fix compiler warnings in pytime.c (GH-101826) (#102062)
gh-97786: Fix compiler warnings in pytime.c (GH-101826)

Fixes compiler warnings in pytime.c.
(cherry picked from commit b1b375e267)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-02-22 19:11:59 +00:00
Miss Islington (bot)
1633aea0e4
[3.11] gh-101967: add a missing error check (GH-101968) (#102015)
gh-101967: add a missing error check (GH-101968)
(cherry picked from commit 89413bbccb)

Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-02-21 13:01:15 +00:00
Miss Islington (bot)
e8ce85de59
gh-101614: Don't treat python3_d.dll as a Python DLL when checking extension modules for incompatibility (GH-101615)
(cherry picked from commit 3a88de7a0a)

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2023-02-08 06:50:43 -08:00
Łukasz Langa
955ba2839b
[3.11] gh-101072: support default and kw default in PyEval_EvalCodeEx for 3.11+ (GH-101127) (#101636)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Matthieu Dartiailh <m.dartiailh@gmail.com>
2023-02-07 13:36:35 +00:00
Dong-hee Na
0c37ea9aba
[3.11] gh-101400: Fix incorrect lineno in exception message on contin… (gh-101447) 2023-01-31 23:53:14 +09:00
Miss Islington (bot)
07d1f99e8f
[3.11] Update copyright years to 2023. (gh-100848) (GH-100849)
(cherry picked from commit 11f99323c2)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2023-01-08 17:57:17 -08:00
Shantanu
be7c19723f
[3.11] gh-100776: Fix misleading default value in help(input) (GH-100788) (#100841)
(cherry picked from commit a2141882f2)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-01-08 01:23:12 -08:00
Miss Islington (bot)
b1e314ab9f
gh-95778: add doc missing in some places (GH-100627)
(cherry picked from commit 46521826cb)

Co-authored-by: Éric <earaujo@caravan.coop>
2022-12-30 13:51:06 -08:00
colorfulappl
a3dbd4c70e
[3.11] gh-64490: Fix bugs in argument clinic varargs processing (GH-32092) (#100368)
(cherry picked from commit 0da728387c)
2022-12-28 02:10:06 +01:00
Gregory P. Smith
a852c5f8ee
[3.11] Correct CVE-2020-10735 documentation (GH-100306). (#100476)
(cherry picked from commit 1cf3d78c92)

Co-authored-by: Jeremy Paige <ucodery@gmail.com>
2022-12-23 18:07:50 -08:00
colorfulappl
bed1d141a9
[3.11] gh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (GH-99890) (#100385)
(cherry picked from commit efbb1eb9f5)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-12-21 15:32:29 +05:30
Brandt Bucher
2182a71eed
[3.11] GH-99729: Unlink frames before clearing them (#100047) 2022-12-06 17:02:19 +00:00
Batuhan Taskaya
a3480ec795
[3.11] gh-99103: Normalize specialized traceback anchors against the current line (#99423)
[3.11] gh-99103: Normalize specialized traceback anchors against the current line (GH-99145)

Automerge-Triggered-By: GH:isidentical.
(cherry picked from commit 57be545959)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2022-11-21 22:16:12 +00:00
Miss Islington (bot)
9dda9020ab
gh-99578: Fix refleak in _imp.create_builtin() (GH-99642)
Fix a reference bug in _imp.create_builtin() after the creation of
the first sub-interpreter for modules "builtins" and "sys".
(cherry picked from commit cb2ef8b2ac)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-11-21 03:43:23 -08:00
Miss Islington (bot)
aa067868ec
[3.11] gh-99337: Fix compile errors with gcc 12 on macOS (GH-99470) (#99638)
gh-99337: Fix compile errors with gcc 12 on macOS (GH-99470)

Fix a number of compile errors with GCC-12 on macOS:

1. In pylifecycle.c the compile rejects _Pragma within a declaration
2. posixmodule.c was missing a number of ..._RUNTIME macros for non-clang on macOS
3. _ctypes assumed that __builtin_available is always present on macOS
(cherry picked from commit cdde29dde9)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2022-11-21 11:22:10 +01:00
Hood Chatham
a06fb519af
[3.11] GH-99460: Emscripten trampolines on optimized METH_O and METH_NOARGS code paths (gh-99461) (#99514)
Manual backport of GH-99461.
2022-11-16 08:09:34 -08:00
Miss Islington (bot)
f4cb8285ba
gh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module (GH-99373)
(cherry picked from commit 4e4b13e8f6)

Co-authored-by: Steve Dower <steve.dower@python.org>
2022-11-15 13:10:27 -08:00
Brandt Bucher
1119ee4f7e
[3.11] GH-99298: Don't perform jumps before error handling (GH-99343) 2022-11-11 11:30:21 +00:00
Miss Islington (bot)
f9a68be673
[3.11] GH-99257: Check the owner's type when specializing slots (GH-99324)
(cherry picked from commit 9d69284169)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-11-10 08:44:49 -08:00
Miss Islington (bot)
7c9c993945
GH-99205: Mark new interpreters and threads as non-static (GH-99268)
(cherry picked from commit 283ab0e1c0)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-11-09 14:19:15 -08:00
Miss Islington (bot)
41a9f49bc5
gh-98978: Fix Py_SetPythonHome(NULL) (GH-99066)
Fix use-after-free in Py_SetPythonHome(NULL), Py_SetProgramName(NULL)
and _Py_SetProgramFullPath(NULL) function calls.

Issue reported by Benedikt Reinartz.
(cherry picked from commit b07f546ea3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-11-03 11:09:15 -07:00
Miss Islington (bot)
39e0627b77
[3.11] gh-98925: Lower marshal recursion depth for WASI (GH-98938) (GH-98979)
* gh-98925: Lower marshal recursion depth for WASI (GH-98938)

For wasmtime 2.0, the stack depth cost is 6% higher. This causes the default max `marshal` recursion depth to blow the stack.

As the default marshal depth is 2000 and Windows is set to 1000, split the difference and choose 1500 for WASI to be safe.
(cherry picked from commit 9711265182)

Co-authored-by: Brett Cannon <brett@python.org>
2022-11-01 16:18:55 -07:00
Miss Islington (bot)
57dd11038f
[3.11] gh-96853: Restore test coverage for Py_Initialize(Ex) (GH-98874)
* As most of `test_embed` now uses `Py_InitializeFromConfig`, add
  a specific test case to cover `Py_Initialize` (and `Py_InitializeEx`)
* Rename `_testembed` init helper to clarify the API used
* Add a `PyConfig_Clear` call in `Py_InitializeEx` to make
  the code more obviously correct (it already didn't leak as
  none of the dynamically allocated config fields were being
  populated, but it's clearer if the wrappers follow the
  documented API usage guidelines)
(cherry picked from commit 05e48865be)

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
2022-10-31 09:15:12 +10:00
Brandt Bucher
0a67f82eb1
[3.11] GH-93354: Fix PRECALL's adaptive backoff (GH-98011) 2022-10-12 16:04:47 -07:00
Miss Islington (bot)
0a84b7aa4d
Add a warning message about PyOS_snprintf (GH-95993)
(cherry picked from commit c7b2204996)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
2022-10-07 13:26:46 -07:00
Miss Islington (bot)
89e9474327
[3.11] GH-97002: Prevent _PyInterpreterFrames from backing more than one PyFrameObject (GH-98002)
(cherry picked from commit 21a2d9ff55)
2022-10-06 17:36:39 -07:00
Christian Heimes
eecbeec083
[3.11] gh-96017: Fix some compiler warnings (GH-96018) (#96106)
- only define recreate_gil with ifdef HAVE_FORK.
(cherry picked from commit d9c1b746b5)

Co-authored-by: Christian Heimes <christian@python.org>
2022-10-05 15:05:27 -07:00
Miss Islington (bot)
015b49ac05
[3.11] GH-97779: Ensure that *all* frame objects are backed by "complete" frames (GH-97886)
(cherry picked from commit 0ff8fd6583)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-10-04 22:46:34 -07:00
Miss Islington (bot)
4591dae421
[3.11] GH-97752: Clear the previous member of newly-created generator/coroutine frames (GH-97812)
(cherry picked from commit 93fcc1f413)
2022-10-03 21:03:26 -07:00
Benjamin Peterson
4d4b1e6c0b
[3.11] Fix typos in bltinmodule.c. (GH-97789)
(cherry picked from commit 873a2f2527)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-03 13:10:14 -07:00
Miss Islington (bot)
a4ff0eaaf0
gh-96848: Fix -X int_max_str_digits option parsing (GH-96988)
Fix command line parsing: reject "-X int_max_str_digits" option with
no value (invalid) when the PYTHONINTMAXSTRDIGITS environment
variable is set to a valid limit.
(cherry picked from commit 41351662bc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-09-26 08:43:26 -07:00
Miss Islington (bot)
6a646dd1ff
GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97018)
(cherry picked from commit 8fd2c3b75b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-09-22 10:17:53 -07:00
Brandt Bucher
fb87aaafba
Remove a stray DISPATCH() (GH-97004) 2022-09-22 09:18:37 -07:00
Brandt Bucher
0e61d2b557
[3.11] GH-95921: Fix positions for some chained comparisons (GH-96968) (GH-96973)
(cherry picked from commit dfc73b5724)

Automerge-Triggered-By: GH:brandtbucher
2022-09-20 14:56:38 -07:00
Miss Islington (bot)
32d80decbf
GH-96864: Check for error between line and opcode events (GH-96880)
(cherry picked from commit c10e33ac11)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
2022-09-20 10:49:01 -07:00
Victor Stinner
6ff54716f1
gh-96387: take_gil() resets drop request before exit (#96869) (#96941)
At Python exit, sometimes a thread holding the GIL can wait forever
for a thread (usually a daemon thread) which requested to drop the
GIL, whereas the thread already exited. To fix the race condition,
the thread which requested the GIL drop now resets its request before
exiting.

take_gil() now calls RESET_GIL_DROP_REQUEST() before
PyThread_exit_thread() if it called SET_GIL_DROP_REQUEST to fix a
race condition with drop_gil().

Issue discovered and analyzed by Mingliang ZHAO.

(cherry picked from commit 04f4977f50)
2022-09-20 02:12:09 +02:00
Miss Islington (bot)
c4cf745c72
GH-96754: Check whether the interpreter frame is complete before creating frame object. (GH-96776) (#96787)
(cherry picked from commit 12c5f328d2)

Co-authored-by: Mark Shannon <mark@hotpy.org>

Co-authored-by: Mark Shannon <mark@hotpy.org>
2022-09-13 11:56:27 +01:00
Christian Heimes
4958820032
[3.11] gh-95853: Add script to automate WASM build (GH-95828, GH-95985, GH-96045, GH-96389, GH-96744) (GH-96749)
Automate WASM build with a new Python script. The script provides
several build profiles with configure flags for Emscripten flavors
and WASI. The script can detect and use Emscripten SDK and WASI SDK from
default locations or env vars.

``configure`` now detects Node arguments and creates HOSTRUNNER
arguments for Node 16. It also sets correct arguments for
``wasm64-emscripten``.
2022-09-13 12:06:39 +02:00
Miss Islington (bot)
7033dc8adc
GH-96678: Fix undefined behavior in ceval.c (GH-96708)
(cherry picked from commit 50a70a083d)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2022-09-10 06:58:45 -07:00
Miss Islington (bot)
c563b89261
Fix possible NULL pointer dereference in _PyThread_CurrentFrames (GH-96584)
(cherry picked from commit 88a7f661ca)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-09-10 04:12:46 -07:00