Commit graph

12392 commits

Author SHA1 Message Date
Miss Islington (bot)
3325029741
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:58 -08:00
Miss Islington (bot)
b134978467
[3.10] [3.11] gh-99952: fix refcount issues in ctypes.Structure from_param() result (GH-101339) (#101340)
[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)

(cherry picked from commit fa7c37af49)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Yukihiro Nakadaira <yukihiro.nakadaira@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-02-04 12:09:29 -08:00
Miss Islington (bot)
8126628107
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:27:41 -08:00
Miss Islington (bot)
940763140f
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:53:45 -08:00
Kumar Aditya
a3b65770a0
[3.10] GH-100892: Fix race in clearing threading.local (GH-100922). (#100938)
(cherry picked from commit 762745a124)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-11 21:02:02 +05:30
Miss Islington (bot)
b374481616
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 07:54:00 -08:00
Miss Islington (bot)
0e00bce561
[3.10] gh-100689: Revert "bpo-41798: pyexpat: Allocate the expat_CAPI on the heap memory (GH-24061)" (GH-100745) (#100847)
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>

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-01-08 19:05:40 +05:30
Miss Islington (bot)
95c55a69b3
[3.10] gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576) (#100451)
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:55:55 +00:00
colorfulappl
591365cd49
[3.10] gh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (GH-99890) (#100386)
(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:33:21 +05:30
colorfulappl
53063b7ffa
[3.10] gh-99240: Fix double-free bug in Argument Clinic str_converter generated code (GH-99241) (#100353)
(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:50:42 +05:30
colorfulappl
3144aca3da
[3.10] gh-96002: Add functional test for Argument Clinic (GH-96178) (#100232)
(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:06:06 +05:30
Łukasz Langa
300d812fd1
[3.10] gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created (#100059)
It no longer emits a deprecation warning if the current event loop was set.

(cherry picked from commit 3fae04b10e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-12-06 18:40:30 +01:00
Łukasz Langa
b914eee222
[3.10] gh-60203: Revert changes in cycle.__setstate__ (GH-99982) (#100017)
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:30 +01:00
Luke Garland
b027dd78bb
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-02 10:13:33 +00:00
Kumar Aditya
a851797863
[3.10] bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and s… (#99842)
[3.10] bpo-31718: Fix io.IncrementalNewlineDecoder SystemErrors and segfaults (GH-18640)

Co-authored-by: Oren Milman <orenmn@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>.
(cherry picked from commit 53eef27133)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2022-11-28 16:57:37 +05:30
Miss Islington (bot)
610b7798af
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 02:13:30 -08:00
Miss Islington (bot)
c42681546a
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:18:41 -08:00
Ronald Oussoren
1c5e860292
[3.10] GH-97001: Release GIL in termios extension (GH-99503) (#99680)
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 12:33:32 +01:00
Kamil Turek
bc2cdfc815
[3.10] gh-92119: ctypes: Print exception class name instead of its representation (GH-98302) (#99452)
gh-92119: ctypes: Print exception class name instead of its representation (#98302)

(cherry picked from commit b9dedfe61d)
2022-11-13 15:55:58 -08:00
Miss Islington (bot)
14c13955c5
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:40:18 -08:00
Miss Islington (bot)
1b5a62b88a
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 22:05:20 -08:00
Miss Islington (bot)
380b12e435
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:44:28 -08:00
Miss Islington (bot)
70006d6a5f
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:38:26 -08:00
Miss Islington (bot)
8d44f36a4a
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-03 07:58:44 -07:00
Serhiy Storchaka
22bbb0c4c7
[3.10] gh-98740: Fix validation of conditional expressions in RE (GH-98764) (GH-99046)
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 12:18:50 +02:00
Miss Islington (bot)
078ce6891c
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:47:29 -07:00
Charlie Zhao
d3d1738acd
[3.10] gh-98793: Fix typecheck in overlapped.c (GH-98835) (#98890)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 3ac8c0ab6e)
2022-10-31 11:22:02 -07:00
samypr100
af204e4c47
[3.10] GH-98671: bpo-46670: Fix #ifdef in sha3module.c (GH-90828) (#98677) 2022-10-28 12:13:44 +02:00
Miss Islington (bot)
586bb1fd8b
[3.10] bpo-2716: add license for audioop module (GH-19972) (#98532)
bpo-2716: add license for audioop module (GH-19972)
(cherry picked from commit 4c1145bb37)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2022-10-28 12:11:26 +02:00
Miss Islington (bot)
e77af82110
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:22:18 -07:00
Miss Islington (bot)
5074c35c2a
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:28:40 -07:00
Miss Islington (bot)
fd9bdde769
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:53:36 -07:00
Theo Buehler
0e4e058602
[3.10] gh-98517: Fix buffer overflows in _sha3 module (#98519)
This is a port of the applicable part of XKCP's fix [1] for
CVE-2022-37454 and avoids the segmentation fault and the infinite
loop in the test cases published in [2].

[1]: fdc6fef075
[2]: https://mouha.be/sha-3-buffer-overflow/

Regression test added by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2022-10-21 12:26:01 -07:00
Miss Islington (bot)
c7662420d6
gh-98178: syslog() is not thread-safe on macOS (GH-98213)
On macOS, fix a crash in syslog.syslog() in multi-threaded
applications. On macOS, the libc syslog() function is not
thread-safe, so syslog.syslog() no longer releases the GIL to call
it.
(cherry picked from commit d4b9166385)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-13 05:05:18 -07:00
Serhiy Storchaka
4d7d91f941
[3.10] Add more syslog tests (GH-97953). (GH-98101)
(cherry picked from commit cae7d1d7a7)
2022-10-09 14:21:10 +03:00
Jelle Zijlstra
2090eeb46d
[3.10] gh-96288: Add a sentence to os.mkdir's docstring. (GH-96271). (#98066)
(cherry picked from commit 1523c9e9d4)

Co-authored-by: Hagai Helman Tov <hagai.helman@gmail.com>
2022-10-07 20:59:48 -07:00
Miss Islington (bot)
e73cb54a06
gh-65496: Correct wording on csv's skipinitialspace argument (GH-96170)
(cherry picked from commit 676d8ef380)

Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2022-10-07 12:30:39 -07:00
Miss Islington (bot)
11945f2cf6
fixes gh-96078: os.sched_yield release the GIL while calling sched_yield(2). (gh-97965)
(cherry picked from commit b9d2e81716)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2022-10-06 21:50:44 -07:00
Miss Islington (bot)
3d89ac2f4c
[3.10] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK (GH-97944) (#97967)
The macOS 13 SDK includes support for the `mkfifoat` and `mknodat` system calls.
 Using the `dir_fd` option with either `os.mkfifo` or `os.mknod` could result in a
 segfault if cpython is built with the macOS 13 SDK but run on an earlier
 version of macOS. Prevent this by adding runtime support for detection of
 these system calls ("weaklinking") as is done for other newer syscalls on
 macOS.
(cherry picked from commit 6d0a0191a4)

Co-authored-by: Ned Deily <nad@python.org>
2022-10-06 12:14:16 -07:00
Serhiy Storchaka
769b9dccd2
[3.10] gh-97728: Argument Clinic: Fix uninitialized variable in the Py_UNICODE converter (GH-97729) (GH-97760)
It affects function os.system() on Windows and Windows-specific modules
winreg, _winapi, _overlapped, and _msi.
(cherry picked from commit 0ee9619a4c)
2022-10-03 16:59:21 +03:00
Miss Islington (bot)
54bbb5e336
GH-97592: Fix crash in C remove_done_callback due to evil code (GH-97660)
Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called.
(cherry picked from commit 63780f4599)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-09-30 13:28:27 -07:00
Miss Islington (bot)
c9670495bb
gh-97005: Update libexpat from 2.4.7 to 2.4.9 (gh-97006)
Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
(cherry picked from commit 10e3d398c3)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
2022-09-22 06:01:08 -07:00
Miss Islington (bot)
88a3f1873e
gh-96821: Fix undefined behaviour in _testcapimodule.c (GH-96915) (GH-96926)
* gh-96821: Assert for demonstrating undefined behaviour

* Fix UB

(cherry picked from commit cbdeda8ce7)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Matthias Görgens <matthias.goergens@gmail.com>
2022-09-19 18:20:23 +08:00
Miss Islington (bot)
3ae2be69cc
gh-96652: Fix faulthandler chained signal without sigaction() (GH-96666)
Fix the faulthandler implementation of faulthandler.register(signal,
chain=True) if the sigaction() function is not available: don't call
the previous signal handler if it's NULL.
(cherry picked from commit c580a81af9)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-09-08 03:43:24 -07:00
Miss Islington (bot)
eecbb54b62
gh-96641: Do not expose KeyWrapper in _functoolsmodule.c (gh-96642)
(cherry picked from commit 2fd7246e97)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-09-07 04:50:15 -07:00
Miss Islington (bot)
5d82cefdc4
fixes gh-96292: Fix Trivial Typo in cpython/Modules/atexitmodule.c (GH-96327)
(cherry picked from commit 0ace820bec)

Co-authored-by: Ansab Gillani <56605828+ansabgillani@users.noreply.github.com>
2022-08-26 22:53:47 -07:00
Miss Islington (bot)
9c04e25308
gh-95878: Fix format char in datetime CAPI tests (GH-95879)
(cherry picked from commit 8b34e914bb)

Co-authored-by: Christian Heimes <christian@python.org>
2022-08-11 11:06:48 -07:00
Miss Islington (bot)
be30a6dc4d
gh-91838: Resolve HTTP links which redirect to HTTPS (GH-95642)
It updates links which redirect to HTTPS with different authority or
path.
(cherry picked from commit d0d0154443)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-08-04 06:15:01 -07:00
Thomas Klausner
ae24962457
[3.10] bpo-46053: Fix OSS audio support on NetBSD (GH-30065). (GH-95477)
(cherry picked from commit 2e7e3c4c10)

Co-authored-by: Thomas Klausner <tk@giga.or.at>
2022-07-31 11:19:09 +03:00
Kumar Aditya
4ad222991f
[3.10] GH-93899: fix checks for eventfd flags (GH-95170). (#95345)
(cherry picked from commit 4dd099baff)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-28 12:24:47 +02:00