Commit graph

125635 commits

Author SHA1 Message Date
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
Sergey B Kirpichev
3d8fc8b9ae
gh-127937: Convert decimal to use PEP 757 import API (#127925)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-24 11:05:52 +00:00
Victor Stinner
6e63c4736b
gh-119182: Use public PyUnicodeWriter in _json.c (#129249)
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.
2025-01-24 11:38:13 +01:00
Victor Stinner
c005ea4951
gh-129185: Use PyMutex in tracemalloc (#129246) 2025-01-24 11:25:24 +01:00
Bénédikt Tran
36bb229933
gh-129173: Use _PyUnicodeError_GetParams in PyCodec_IgnoreErrors (#129174)
We also cleanup `PyCodec_StrictErrors` and the error message rendered
when an object of incorrect type is passed to codec error handlers.
2025-01-24 11:25:03 +01:00
Victor Stinner
732670d93b
gh-119182: Use public PyUnicodeWriter in stringio.c (#129243)
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API.
2025-01-23 23:31:49 +00:00
Jeong, YunWon
bab8918f9a
gh-109975: Add list of 3.13 removed library replacements (#127816)
Add list of 3.13 removed library replacements
2025-01-23 22:20:40 +01:00
Łukasz Langa
fc3d400165
gh-91048: Also clear and set ts->asyncio_running_task with eager tasks (#129197)
This was missing from gh-124640. It's already covered by the new
test_asyncio/test_free_threading.py in combination with the runtime
assertion in set_ts_asyncio_running_task.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-23 19:26:36 +01:00
Terry Jan Reedy
dbb25ce037
gh-71339: Use new assertion methods in test_idle (#129213)
Revise 10 tests in 7 files, with 1 test split into 2.
2025-01-23 13:25:14 -05:00
sobolevn
c05a851ac5
gh-91048: Improve example in asyncio-graph.rst doc (#129224) 2025-01-23 23:38:51 +05:30
Andy Fiddaman
0b15d9c0d2
gh-128330: Terminal control characters should be restored on repl exit (#128331) 2025-01-23 17:30:08 +00:00
Thomas Grainger
ec91e1c276
gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (#128475)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-23 16:53:53 +01:00
Bénédikt Tran
cf0b2da1e6
gh-126004: Remove redundant safeguards for codecs handlers tests (#127680)
We remove the safeguards that were added in `Lib/test/test_capi/test_codecs.py`
since they are now redundant (see 32e07fd377
for additional context).

Indeed, the codecs handlers now correctly handle the `start` and `end` positions
of `UnicodeError` objects and thus should not crash.
2025-01-23 16:06:16 +01:00
Victor Stinner
b23b27bc55
gh-128690: Update test_embed for getpath.py exec_prefix change (#129137) 2025-01-23 15:50:04 +01:00
Bénédikt Tran
a95dca7b98
gh-118761: Improve import time for pstats and zipfile (#128981)
Importing `pstats` or `zipfile` is now roughly 20% faster.

This is achieved by removing type annotations depending on `typing`.
2025-01-23 14:49:36 +00:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
ab353b31bb
gh-129149: Add fast path in PYLONG_FROM_UINT macro for compact integers (#129168)
Add fast path in PyLong_From*() functions for compact integers.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-23 14:36:52 +00:00
Sergey B Kirpichev
75f59bb629
gh-101410: support custom messages for domain errors in the math module (#124299)
This adds basic support to override default messages for domain errors
in the math_1() helper.  The sqrt(), atanh(), log2(), log10() and log()
functions were modified as examples.  New macro supports gradual
changing of error messages in other 1-arg functions.

Co-authored-by: CharlieZhao <zhaoyu_hit@qq.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-23 13:55:25 +00:00