Commit graph

126301 commits

Author SHA1 Message Date
Cody Maloney
180ee43bde
gh-129005: Avoid copy in _pyio.FileIO.readinto() (#129324)
`os.read()` allocated and filled a buffer by calling `read(2)`, than that
data was copied into the user provied buffer. Read directly into the
caller's buffer instead by using `os.readinto()`.

`os.readinto()` uses `PyObject_GetBuffer()` to make sure the passed
in buffer is writeable and bytes-like, drop the manual check.
2025-01-28 12:40:44 +01:00
Yury Manushkin
4d0d24f6e3
gh-112064: Fix incorrect handling of negative read sizes in HTTPResponse.read() (#128270)
The parameter `amt` of `HTTPResponse.read()`, which could be a negative integer,
has not been handled before and led to waiting for the connection to close
for `keep-alive connections`. Now, this has been fixed, and passing negative values
to `HTTPResponse().read()` works the same as passing `None` value.
2025-01-28 11:37:32 +00:00
Hood Chatham
8e57877e3f
gh-127146: Update test skips for Emscripten 4.0.1 (#129375)
Updates the Emscripten test skips to reflect recent changes in Emscripten capabilities.
2025-01-28 01:05:21 +00:00
RUANG (James Roy)
1c3bb200da
gh-85046: Document errno constants (#126420) 2025-01-28 01:12:45 +01:00
Erlend E. Aasland
379ab856f5
gh-129346: Handle allocation errors for SQLite aggregate context (#129347) 2025-01-27 18:16:19 +01:00
Sam Gross
a6a8c6f86e
gh-128954: Reorder _PyInterpreterFrame fields for reduced memory usage (#128958)
This reduces the size of _PyInterpreterFrame by 8 bytes on 64-bit
platforms using the free threading build due to alignment requirements.

This allows for slightly more recursive calls into the interpreter (from
C), but `test_call.test_super_deep` still crashes.
2025-01-27 17:14:51 +00:00
Victor Stinner
8a5a18a36e
gh-129205: Modernize test_eintr (#129316)
* Use f-string.
* Fix grammar: replace 'datas' with 'data' (and replace 'data' with
  'item').
* Remove unused variables: 'pid' and 'old_mask'.
* Factorize test_read() and test_readinto() code.

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-01-27 18:04:45 +01:00
Mark Shannon
75b4962157
GH-128914: Remove all but one conditional stack effects (GH-129226)
* Remove all 'if (0)' and 'if (1)' conditional stack effects

* Use array instead of conditional for BUILD_SLICE args

* Refactor LOAD_GLOBAL to use a common conditional uop

* Remove conditional stack effects from LOAD_ATTR specializations

* Replace conditional stack effects in LOAD_ATTR with a 0 or 1 sized array.

* Remove conditional stack effects from CALL_FUNCTION_EX
2025-01-27 16:24:48 +00:00
Nick Pope
8ec76d9034
gh-128427: Add uuid.NIL and uuid.MAX (#128429) 2025-01-27 18:17:17 +02:00
Victor Stinner
d8e16ef703
Cleanup What's New in Python 3.14 (C API changes) (#129341)
* Document PyDictObject.ma_version_tag removal.
* Add "Limited C API Changes" section.
* Move entries from New Features to Porting to Python 3.14.
* Include Pending removal documents at the right place.
2025-01-27 16:06:07 +01:00
Sergey Miryanov
a5075cd5bd
gh-119786: Fix small typo in AST to CFG to bytecode section in compiler.md (#129322) 2025-01-27 16:36:09 +02:00
Hugo van Kemenade
9546fe2ef2
gh-129061: Fix FORCE_COLOR and NO_COLOR when empty strings (#129140) 2025-01-27 16:24:10 +02:00
Bénédikt Tran
d6f010dead
gh-111178: fix UBSan failures in Modules/_decimal (GH-129074)
* Introduce & use cast macros
* fix UBSan failures for `PyDecContextObject`
* fix UBSan failures for `PyDecContextManagerObject`
* remove redundant casts for `PyDecObject`
2025-01-27 15:15:42 +01:00
Bénédikt Tran
ced296d2c0
gh-111178: fix UBSan failures in Python/traceback.c (GH-128259) 2025-01-27 15:07:39 +01:00
Bénédikt Tran
6bb03c7490
gh-111178: fix UBSan failures in Modules/socketmodule.c (GH-128249) 2025-01-27 15:06:10 +01:00
Bénédikt Tran
922cfecbce
gh-111178: fix UBSan failures in Modules/{blake2,md5,sha1,sha2,sha3}module.c (GH-128248)
- fix UBSan failures in `blake2module.c`
- fix UBSan failures in `md5module.c`
- fix UBSan failures in `sha1module.c`
- fix UBSan failures in `sha2module.c`
- fix UBSan failures in `sha3module.c`

Cosmetics:

- suppress unused return values
- remove redundant casts in constructors
- suppress unused parameters in `{md5,sha*,blake2}module.c`
2025-01-27 14:50:58 +01:00
Serhiy Storchaka
735f25c5e3
gh-119511: Fix a potential denial of service in imaplib (#119514)
The IMAP4 client could consume an arbitrary amount of memory when trying
to connect to a malicious server, because it read a "literal" data with a
single read(size) call, and BufferedReader.read() allocates the bytes
object of the specified size before reading. Now the IMAP4 client reads data
by chunks, therefore the amount of used memory is limited by the
amount of the data actually been sent by the server.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-01-27 14:44:00 +01:00
Peter Bierma
3fb5f6eb9b
gh-128509: Add PyUnstable_IsImmortal for finding immortal objects (GH-129182)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-01-27 14:36:33 +01:00
Victor Stinner
7ec17429d4
gh-102471: Change PyLongWriter_Discard(NULL) to do nothing (#129339)
It's convenient to be able to call PyLongWriter_Discard(NULL) in
error handling code.
2025-01-27 10:51:16 +00:00
Victor Stinner
11148e91e3
gh-102471: Credit Sergey B Kirpichev for PEP 757 (#129338) 2025-01-27 11:44:13 +01:00
Ken Jin
87fb8b198c
gh-128563: Move labels in ceval.c to bytecodes.c (GH-129112) 2025-01-27 18:30:20 +08:00
Tian Gao
7d275611f6
gh-124703: Do not raise an exception when quitting pdb (#124704) 2025-01-26 22:29:16 -05:00
Zanie Blue
a49225cc66
gh-129156: Fix variable quoting in android-env.sh script (#129321)
Adds quoting to `android-env.sh` to protect against spaces in paths.
2025-01-27 10:53:24 +08:00
Alex Willmer
a8dc6d6d44
gh-115911: Ignore PermissionError during import from cwd (#116131)
Ignore PermissionError when checking cwd during import

On macOS `getcwd(3)` can return EACCES if a path component isn't readable,
resulting in PermissionError. `PathFinder.find_spec()` now catches these and
ignores them - the same treatment as a missing/deleted cwd.

Introduces `test.support.os_helper.save_mode(path, ...)`, a context manager
that restores the mode of a path on exit.

This is allows finer control of exception handling and robust environment
restoration across platforms in `FinderTests.test_permission_error_cwd()`.

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Brett Cannon <brett@python.org>
2025-01-26 19:00:28 +00:00
Andrey Efremov
914c232e93
gh-127096: Do not recreate unnamed section on every read in ConfigParser (#127228)
* Do not recreate unnamed section on every read in ConfigParser

* Remove duplicate section creation code
2025-01-26 13:33:07 -05:00
donBarbos
5d9b62005a
gh-126107: Remove copyright block from Modules/config.c.in (#126982)
chore: remove copyright block from config.c.in
2025-01-26 16:57:32 +00:00
Jason R. Coombs
b543b32eff
gh-123987: Fix NotADirectoryError in NamespaceReader when sentinel present (#124018) 2025-01-26 16:23:54 +00:00
Thomas Grainger
fccbfc40b5
gh-129195: use future_add_to_awaited_by/future_discard_from_awaited_by in asyncio.staggered.staggered_race (#129253)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-26 21:14:16 +05:30
partev
a156b19424
gh-126022: Remove zope.org from the permitted linkcheck redirects (#129308) 2025-01-26 16:46:00 +02:00
Cody Maloney
1ed4487968
gh-129205: Add os.readinto() API for reading data into a caller provided buffer (#129211)
Add a new OS API which will read data directly into a caller provided
writeable buffer protocol object.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-26 14:21:03 +01:00
Adam Turner
0ef8d470b7
GH-121970: Remove pyspecific `PyDecoratorMixin` patches (#129306) 2025-01-26 03:43:23 +00:00
Kumar Aditya
3f2cfd0462
gh-128421: make exception group methods thread safe (#129298) 2025-01-25 23:50:09 +05:30
Victor Stinner
be98fda7c6
gh-129223: Raise KeyError in search_map_for_section() if not found (#129262) 2025-01-25 18:19:48 +01:00
Pablo Galindo Salgado
7a54a653b7
gh-129271: Fix reference leak with unicode writer in fast path in the json module (#129272) 2025-01-25 17:54:20 +01:00
Hugo van Kemenade
e119526edf
gh-126022: make license.rst consistent with LICENSE: fix underline (#129292) 2025-01-25 15:36:58 +02:00
Irit Katriel
c39ae8922b
gh-128799: Add frame of except* to traceback when wrapping a naked exception (#128971) 2025-01-25 13:00:23 +00:00
Michael Droettboom
9e52e553f4
gh-129244: Remove workaround for MSVC compiler crash (#129263)
* Remove compiler workaround

* Remote _Py_USING_PGO
2025-01-25 07:56:13 -05:00
partev
9682a88683
gh-126022: make license.rst consistent with LICENSE (#128516) 2025-01-25 13:41:32 +02:00
Chris Eibl
8fecb9fa0b
Remove unused DPRINTF in ceval.c (GH-129282)
remove unused DPRINTF in ceval.c
2025-01-25 18:33:26 +08:00
sobolevn
cc4f0a2770
Replace strict_concatenate = True with extra_checks = True (#126391) 2025-01-25 12:44:23 +03:00
Russell Keith-Magee
a58083811a
gh-129248: Filter out the iOS log prefix from testbed runner output. (#129252)
Filter out the iOS log prefix from testbed runner output.
2025-01-25 16:49:39 +08:00
Adam Turner
d40692db06
GH-125722: Remove Sphinx patches (#129277) 2025-01-25 03:47:55 +00:00
Bénédikt Tran
f10b7b29cb
gh-111178: fix UBSan failures in Modules/cjkcodecs/multibytecodec.c (gh-129090) 2025-01-25 10:04:31 +09:00
Giles Copp
9abbb58e3f
gh-112713 : Add support for 'partitioned' attribute in http.cookies (GH-112714)
* Add support for 'partitioned' attribute in http.cookies

Co-authored-by: Giles Copp <gilesc@dropbox.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2025-01-24 22:31:52 +00:00
Pablo Galindo Salgado
3a3a6b86f4
gh-129223: Do not allow the compiler to optimise away symbols for debug sections (#129225)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-01-24 21:36:32 +01:00
Kumar Aditya
e635bf2e49
gh-128002: fix test_all_tasks_different_thread in asyncio (#129267) 2025-01-24 23:10:24 +05:30
Serhiy Storchaka
7907203bc0
Improve tests for _colorize.can_colorize() (#129234)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-01-24 18:33:40 +02:00
Kumar Aditya
8e0b36006c
gh-128002: use _PyObject_SetMaybeWeakref when creating tasks in asyncio (#128885) 2025-01-24 21:12:56 +05:30
Victor Stinner
fc6bc1e4e3
gh-129185: Simplify PyTraceMalloc_Track() (#129256)
Since tracemalloc uses PyMutex, it becomes safe to use TABLES_LOCK()
even after _PyTraceMalloc_Fini(): remove the "pre-check" in
PyTraceMalloc_Track() and PyTraceMalloc_Untrack().

PyTraceMalloc_Untrack() no longer needs to acquire the GIL.

_PyTraceMalloc_Fini() can be called earlier during Python
finalization.
2025-01-24 14:29:36 +01:00
Sergey B Kirpichev
233fd00f0a
gh-128863: Deprecate _PyLong_FromDigits() function (#127939) 2025-01-24 13:17:10 +01:00