Commit graph

12872 commits

Author SHA1 Message Date
Miss Islington (bot)
d003bcc91a
gh-101543: Ensure Windows registry path is only used when stdlib can't be found (GH-101544)
(cherry picked from commit 7a253103d4)

Co-authored-by: Steve Dower <steve.dower@python.org>
2023-02-06 09:34:05 -08:00
Miss Islington (bot)
9bd000c7b8
gh-101372: Fix unicodedata.is_normalized to properly handle the UCD 3… (gh-101388)
(cherry picked from commit 9ef7e75434)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2023-02-06 02:32:30 -08:00
Gregory P. Smith
fa7c37af49
[3.11] gh-99952: fix refcount issues in ctypes.Structure from_param() result (#101339)
[3.11] gh-99952: [ctypes] fix refcount issues in from_param() result. (GH-100169)

Fixes a reference counting issue with `ctypes.Structure` when a `from_param()` method call is used and the structure size is larger than a C pointer `sizeof(void*)`.

This problem existed for a very long time, but became more apparent in 3.8+ by change likely due to garbage collection cleanup timing changes..
(cherry picked from commit dfad678d70)

Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
2023-01-26 01:02:37 -08:00
Shantanu
cd0fe5ba09
[3.11] gh-101326: Fix regression when passing None to FutureIter.throw (GH-101327) (#101328)
(cherry picked from commit a178ba82bf)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-01-25 13:01:13 -08:00
Miss Islington (bot)
5964b12829
gh-100795: Don't call freeaddrinfo on failure. (GH-101252)
When getaddrinfo returns an error, the output pointer is in an unknown state
Don't call freeaddrinfo on it.  See the issue for discussion and details with
links to reasoning.  _Most_ libc getaddrinfo implementations never modify the
output pointer unless they are returning success.

(cherry picked from commit b724ac2fe7)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Sergey G. Brester <github@sebres.de>
Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2023-01-23 15:30:19 -08:00
Miss Islington (bot)
3ef9f6b508
gh-82052: Don't send partial UTF-8 sequences to the Windows API (GH-101103)
Don't send partial UTF-8 sequences to the Windows API
(cherry picked from commit f34176b77f)

Co-authored-by: Paul Moore <p.f.moore@gmail.com>
2023-01-17 11:52:50 -08:00
Steve Dower
87ade7ebda
gh-100320: Fix path calculations on Windows when python.exe is moved outside of the normal location (GH-100947) 2023-01-16 17:00:34 +00:00
Kumar Aditya
e707671684
[3.11] GH-100892: Fix race in clearing threading.local (GH-100922). (#100937)
(cherry picked from commit 762745a124)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-11 21:01:48 +05:30
Miss Islington (bot)
2d1128e9eb
GH-81061: Fix refcount issue when returning None from a ctypes.py_object callback (GH-13364)
(cherry picked from commit 837ba05267)

Co-authored-by: dgelessus <dgelessus@users.noreply.github.com>
2023-01-09 08:06:17 -08:00
Miss Islington (bot)
6c7e32f6a8
gh-100689: Revert "bpo-41798: pyexpat: Allocate the expat_CAPI on the heap memory (GH-24061)" (GH-100745)
* gh-100689: Revert "bpo-41798: pyexpat: Allocate the expat_CAPI on the heap memory (GH-24061)"

This reverts commit 7c83eaa536.
(cherry picked from commit b034fd3e59)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-01-08 05:19:37 -08:00
Miss Islington (bot)
d0a9bc5a89
gh-100649: Update native_thread_id after fork (gh-100650)
Update native_thread_id after fork
(cherry picked from commit d52d4942cf)

Co-authored-by: Gabriele N. Tornetta <P403n1x87@users.noreply.github.com>
2023-01-01 06:50:56 -08:00
Kumar Aditya
ebe428824d
[3.11] GH-100342: check for allocation failure in AC *args parsing (GH-100343). (#100568)
(cherry picked from commit 7cf164ad5e)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-12-28 10:11:27 +05:30
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
Bill Fisher
57e727af3f
[3.11] gh-99110: Initialize frame->previous in init_frame to fix segmentation fault (GH-100182) (#100478)
(cherry picked from commit 88d565f32a)

Co-authored-by: Bill Fisher <william.w.fisher@gmail.com>
2022-12-24 11:17:10 +05:30
Miss Islington (bot)
f6fe4bb75c
[3.11] gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576) (GH-100452)
gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576)

The itemsize returned in a memoryview of a ctypes array is now computed from the item type, instead of dividing the total size by the length and assuming that the length is not zero.
(cherry picked from commit 84bc6a4f25)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
2022-12-23 08:56:20 +00:00
Miss Islington (bot)
3e715e0cc8
gh-78878: Fix crash when creating an instance of _ctypes.CField (GH-14837)
(cherry picked from commit d713c54ac8)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
2022-12-21 10:02:05 -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
colorfulappl
ba8e30c56b
[3.11] gh-99240: Fix double-free bug in Argument Clinic str_converter generated code (GH-99241) (#100352)
(cherry picked from commit 8dbe08eb7c)

Fix double-free bug mentioned at GH-99240, by moving memory clean up out of "exit" label.
2022-12-20 15:49:53 +05:30
colorfulappl
c42a4ad587
[3.11] gh-64490: Fix refcount error when arguments are packed to tuple in argument clinic (GH-99233) (#100338)
(cherry picked from commit 69f6cc77d0)
2022-12-19 15:18:49 +05:30
colorfulappl
dd323afea8
[3.11] gh-96002: Add functional test for Argument Clinic (GH-96178) (#100230)
(cherry picked from commit c450c8c9ed)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-12-17 12:04:54 +05:30
Serhiy Storchaka
3fae04b10e
[3.11] gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created (#99949)
It no longer emits a deprecation warning if the current event loop was set.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-12-06 16:15:44 +01:00
Łukasz Langa
32a2193f67
[3.11] gh-60203: Revert changes in cycle.__setstate__ (GH-99982) (#100016)
In case if only True/False be supported as boolean arguments in future,
we should continue to support 1/0 here.
(cherry picked from commit 922a6cf6c2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-12-05 17:58:40 +01:00
Luke Garland
374b0a2ace
[3.11] bpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684) (#99973)
bpo-40882: Fix a memory leak in SharedMemory on Windows (GH-20684)

In multiprocessing.shared_memory.SharedMemory(), the temporary view
returned by MapViewOfFile() should be unmapped when it is no longer
needed.

(cherry picked from commit 85c128e34d)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-12-05 13:38:25 +01:00
Kumar Aditya
6f658dd60d
[3.11] bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and segfaults (GH-18640) (#99841)
Co-authored-by: Oren Milman <orenmn@gmail.com>
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

(cherry picked from commit 53eef27133)
2022-11-28 16:47:33 +05:30
Miss Islington (bot)
3e3980b49e
GH-95896: posixmodule.c: fix osdefs.h inclusion to not depend on compiler (GH-95897)
(cherry picked from commit ec2b76aa8b)

Co-authored-by: TheShermanTanker <32636402+TheShermanTanker@users.noreply.github.com>
Co-authored-by: Steve Dower <steve.dower@python.org>
2022-11-26 01:57:49 -08:00
Miss Islington (bot)
c06f74f1d6
bpo-38031: Fix a possible assertion failure in _io.FileIO() (GH-GH-5688)
(cherry picked from commit d386115039)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-11-25 05:20:00 -08:00
Miss Islington (bot)
f38eebb88b
GH-97001: Release GIL in termios extension (GH-99503)
Without releasing the GIL calls to termios APIs might block the entire interpreter.
(cherry picked from commit 959ba45d75)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2022-11-22 03:28:06 -08:00
Victor Stinner
0c6b3a2d8e
[3.11] Revert "[3.11] gh-98724: Fix Py_CLEAR() macro side effects (#99100)" (#99573)
Revert "gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#99288)"

This reverts commit 1082890857.
2022-11-21 18:01:10 +01: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
Miss Islington (bot)
5971a65d07
gh-99370: Calculate zip path from prefix when in a venv (GH-99371)
Before python3.11, when in a venv the zip path is calculated
from prefix on POSIX platforms. In python3.11 the behavior is
accidentally changed to calculating from default prefix. This
change will break venv created from a non-installed python
with a stdlib zip file. This commit restores the behavior back
to before python3.11.
(cherry picked from commit e3d4fed074)

Co-authored-by: Kai Zhang <kylerzhang11@gmail.com>
2022-11-14 07:31:46 -08:00
Gregory P. Smith
51c68cf466
[3.11] gh-98930: improve the docstring of signal.strsignal (GH-99290) (#99449)
Improves the docstring on signal.strsignal to make it explain when it returns a message, None, or when it raises ValueError.

Closes GH-98930

Co-authored-by: Gregory P. Smith <greg@krypto.org>.
(cherry picked from commit 88385b8564)

Co-authored-by: ram vikram singh <ramvikrams243@gmail.com>
2022-11-13 12:21:19 -08:00
Miss Islington (bot)
bf76d9bd4d
gh-99275: Fix SystemError in ctypes during __initsubclass__ (GH-99283)
(cherry picked from commit 343eb0f94b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-13 11:51:26 -08:00
Miss Islington (bot)
c9f2177d13
gh-99204: Calculate base_executable by alternate names in POSIX venvs (GH-99206)
Check to see if `base_executable` exists. If it does not, attempt
to use known alternative names of the python binary to find an
executable in the path specified by `home`.

If no alternative is found, previous behavior is preserved.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>

(cherry picked from commit c41b13d39c)

Co-authored-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
2022-11-10 08:53:51 -08:00
Victor Stinner
1082890857
gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#99288)
The Py_CLEAR(), Py_SETREF() and Py_XSETREF() macros now only evaluate
their argument once. If an argument has side effects, these side
effects are no longer duplicated.

Add test_py_clear() and test_py_setref() unit tests to _testcapi.

(cherry picked from commit c03e05c2e7)
2022-11-09 16:29:23 +01:00
Miss Islington (bot)
2d00190591
gh-92119: ctypes: Print exception class name instead of its representation (GH-98302)
(cherry picked from commit b9dedfe61d)

Co-authored-by: Kamil Turek <kamil.turek@hotmail.com>
2022-11-07 21:20:06 -08:00
Miss Islington (bot)
58c8c1dee7
gh-96055: Update faulthandler to emit proper unexpect signal number (gh-99162)
(cherry picked from commit f626b7b504)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2022-11-06 18:45:54 -08:00
Miss Islington (bot)
57077928ec
gh-83004: Clean up refleak in _pickle initialisation (GH-98841)
(cherry picked from commit d3b82b4463)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-11-06 06:41:24 -08:00
Miss Islington (bot)
4b1e45e78b
gh-83004: Clean up refleak in _zoneinfo initialisation (GH-98842)
(cherry picked from commit 31f2f6568d)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-11-06 06:30:41 -08:00
Miss Islington (bot)
29c3dc050a
gh-83004: Clean up refleak in _io initialisation (GH-98840)
(cherry picked from commit 1208037246)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-11-06 06:03:52 -08:00
Miss Islington (bot)
d8c11b75e2
gh-94808: add tests covering PySequence_{Set,Del}Slice (GH-99123)
(cherry picked from commit c5c40773cb)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-05 10:32:46 -07:00
Miss Islington (bot)
46a493e2db
gh-94808: add tests covering PyEval_GetFuncDesc function (GH-98300)
(cherry picked from commit b5f711185b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-11-05 06:32:46 -07:00
Miss Islington (bot)
eb023a84d9
gh-98740: Fix validation of conditional expressions in RE (GH-98764)
In very rare circumstances the JUMP opcode could be confused with the
argument of the opcode in the "then" part which doesn't end with the
JUMP opcode. This led to incorrect detection of the final JUMP opcode
and incorrect calculation of the size of the subexpression.

NOTE: Changed return value of functions _validate_inner() and
_validate_charset() in Modules/_sre/sre.c.  Now they return 0 on success,
-1 on failure, and 1 if the last op is JUMP (which usually is a failure).
Previously they returned 1 on success and 0 on failure.
(cherry picked from commit e9ac890c02)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-11-03 00:47:39 -07:00
Steve Dower
3ff659aea2
gh-98790: When DLLs directory is missing on Windows, assume executable_dir contains PYD files instead (GH-98936) 2022-11-02 20:04:06 +00:00
Miss Islington (bot)
8495af8963
GH-98897: fix memory leak if math.dist raises exception (GH-98898)
(cherry picked from commit ab57505070)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-31 19:40:30 -07:00
Charlie Zhao
2b0cbb90c3
[3.11] gh-98793: Fix typecheck in overlapped.c (GH-98835) (#98889)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 3ac8c0ab6e)
2022-10-31 11:21:01 -07:00
Miss Islington (bot)
c5f3f296f4
gh-98739: Update libexpat from 2.4.9 to 2.5.0 (GH-98742)
* Update libexpat from 2.4.9 to 2.5.0 to address CVE-2022-43680.

Co-authored-by: Shaun Walbridge <shaun.walbridge@gmail.com>
(cherry picked from commit 3e07f827b3)

Co-authored-by: Shaun Walbridge <46331011+scdub@users.noreply.github.com>
2022-10-27 14:21:35 -07:00
Miss Islington (bot)
75990a56b7
Fix readline.c compiler warning. (GH-98738)
```
Modules/readline.c:1260:37: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    completer_word_break_characters =
                                    ^
```
(cherry picked from commit 29b391b137)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2022-10-26 16:16:09 -07:00
Miss Islington (bot)
db14a9d594
gh-94808: cover PyMapping_HasKeyString and PyMapping_HasKey (GH-98486)
(cherry picked from commit 5d30544485)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-25 21:57:49 -07:00
Miss Islington (bot)
68f25e261e
bpo-2716: add license for audioop module (GH-19972)
(cherry picked from commit 4c1145bb37)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2022-10-21 16:07:30 -07:00
Jelle Zijlstra
39eaca884f
[3.11] gh-94808: Cover PyFunction_GetCode, PyFunction_GetGlobals,… (#98317)
[3.11] gh-94808: Cover `PyFunction_GetCode`, `PyFunction_GetGlobals`, `PyFunction_GetModule` (GH-98158).
(cherry picked from commit 7b48d02933)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-10-18 17:37:16 -07:00