Kumar Aditya
e7bc0cd182
gh-91048: fix _asyncio.future_discard_from_awaited_by
( #129731 )
...
fix discard
2025-02-06 16:35:33 +00:00
Kumar Aditya
75c551974f
gh-91048: fix thread safety for asyncio stack introspection APIs ( #129399 )
2025-02-06 21:33:52 +05:30
Victor Stinner
dc804ffb2f
gh-128911: Use PyImport_ImportModuleAttr() function ( #129657 )
...
* Replace PyImport_ImportModule() + PyObject_GetAttr() with
PyImport_ImportModuleAttr().
* Replace PyImport_ImportModule() + PyObject_GetAttrString() with
PyImport_ImportModuleAttrString().
2025-02-05 11:03:58 +01:00
Victor Stinner
14489c1bb4
gh-129354: Use PyErr_FormatUnraisable() function ( #129656 )
...
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-02-04 16:21:10 +01:00
Victor Stinner
218f205f20
gh-129354: Use PyErr_FormatUnraisable() function ( #129524 )
...
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
Update test_sqlite3 tests.
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2025-02-03 12:10:18 +00:00
Victor Stinner
df4a2f5bd7
gh-129539: Reorganize posixmodule.c header ( #129558 )
...
Add sections: Python includes, system includes, etc.
Add a comment explaining why an include is needed.
2025-02-02 09:16:48 +00:00
Victor Stinner
71ae93374d
gh-93649: Move _testcapi tests to specific files ( #129544 )
...
Move many functions from _testcapimodule.c into more specific files
in Modules/_testcapi/.
In moved code:
* Replace get_testerror() with PyExc_AssertionError.
* Replace raiseTestError() with
PyErr_Format(PyExc_AssertionError, ...).
2025-02-01 13:39:16 +01:00
Victor Stinner
60a85415ae
gh-93649: Add Modules/_testcapi/function.c file ( #129521 )
...
* Move PyFunction C API tests to a new file.
* Add Lib/test/test_capi/test_function.py.
* Move tests from test_capi.test_misc to test_capi.test_function.
2025-01-31 16:02:50 +01:00
Pablo Galindo Salgado
7eaef74561
gh-129430: Make walking vm regions more efficient in MacOS ( #129494 )
2025-01-31 14:08:48 +00:00
Victor Stinner
79f85a0bc1
gh-129354: Use PyErr_FormatUnraisable() function ( #129518 )
...
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-01-31 15:06:14 +01:00
Victor Stinner
5424e3b034
gh-93649: Add Modules/_testcapi/type.c file ( #129516 )
...
Move PyType C API tests to a new file.
Move following tests from test_capi.test_misc to test_capi.test_type:
* BuiltinStaticTypesTests
* test_get_type_name()
* test_get_base_by_token()
2025-01-31 15:03:54 +01:00
Bénédikt Tran
881984b41a
gh-111178: fix UBSan failures in Modules/_sqlite
(GH-129087)
...
* fix UBSan failures for `pysqlite_Blob`
* fix UBSan failures for `pysqlite_Connection`
* fix UBSan failures for `pysqlite_Cursor`
* fix UBSan failures for `pysqlite_PrepareProtocol`
* fix UBSan failures for `pysqlite_Row`
* fix UBSan failures for `pysqlite_Statement`
* suppress unused return values
2025-01-31 14:33:30 +01:00
Serhiy Storchaka
9d63ae5fe5
gh-129502: Fix handling errors in ctypes callbacks (GH-129504)
...
Unlikely errors in preparing arguments for ctypes callback are now
handled in the same way as errors raised in the callback of in converting
the result of the callback -- using sys.unraisablehook() instead of
sys.excepthook() and not setting sys.last_exc and other variables.
2025-01-31 15:30:19 +02:00
Victor Stinner
3447f4a56a
gh-129354: Use PyErr_FormatUnraisable() function ( #129514 )
...
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-01-31 14:20:35 +01:00
Victor Stinner
8b70ff5872
gh-93649: Move PyFrame C API tests to test_capi ( #129512 )
...
* Add Lib/test/test_capi/test_frame.py file.
* Move C API tests from test_frame to test_capi.test_frame.
* Add Modules/_testcapi/frame.c file.
* Move C API tests from _testcapimodule.c to frame.c
2025-01-31 13:51:58 +01:00
Victor Stinner
0373926260
gh-129354: Use PyErr_FormatUnraisable() function ( #129511 )
...
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-01-31 13:16:08 +01:00
Petr Viktorin
31c82c28f9
GH-128469: Revert "warn when libpython was loaded from outside the build directory ( #128645 )" ( #129506 )
2025-01-31 11:17:37 +00:00
Victor Stinner
95504f429e
gh-129354: Fix grammar in PyErr_FormatUnraisable() ( #129475 )
...
Replace "on verb+ing" with "while verb+ing".
2025-01-31 09:45:35 +01:00
Kumar Aditya
c07ac3c86a
gh-128452: fix warning in socketmodule.c ( #129478 )
2025-01-31 13:41:11 +05:30
Victor Stinner
4ca9fc08f8
gh-111495: Add PyFile tests ( #129449 )
...
Add tests for the following functions in test_capi.test_file:
* PyFile_FromFd()
* PyFile_GetLine()
* PyFile_NewStdPrinter()
* PyFile_WriteObject()
* PyFile_WriteString()
* PyObject_AsFileDescriptor()
Add Modules/_testlimitedcapi/file.c file.
Remove test_embed.StdPrinterTests which became redundant.
2025-01-30 18:05:32 +01:00
Victor Stinner
4e47e05045
gh-129354: Use PyErr_FormatUnraisable() function ( #129435 )
...
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-01-30 16:09:38 +01:00
Victor Stinner
3bebe46d34
gh-128911: Add PyImport_ImportModuleAttr() function ( #128912 )
...
Add PyImport_ImportModuleAttr() and
PyImport_ImportModuleAttrString() functions.
* Add unit tests.
* Replace _PyImport_GetModuleAttr()
with PyImport_ImportModuleAttr().
* Replace _PyImport_GetModuleAttrString()
with PyImport_ImportModuleAttrString().
* Remove "pycore_import.h" includes, no longer needed.
2025-01-30 11:17:29 +00:00
Sergey B Kirpichev
6c63afc3be
gh-129467: Fix compiler warning in mpdecimal word_to_string() ( #116346 )
...
Turn off false-positive -Wstringop-overflow in word_to_string().
2025-01-30 11:57:55 +01:00
Bénédikt Tran
9bc8c5fc0c
gh-111178: fix UBSan failures in Modules/_ssl/cert.c
(GH-129088)
...
fix UBSan failures for `PySSLCertificate`
2025-01-30 11:11:37 +01:00
Filipe Laíns 🇵🇸
29b3ce8355
GH-128469: warn when libpython was loaded from outside the build directory ( #128645 )
...
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-29 22:35:55 +00:00
Brandt Bucher
002c4e2982
GH-129386: Use symbolic constants for specialization tests (GH-129415)
2025-01-29 10:49:58 -08:00
Pieter Eendebak
a29221675e
gh-127119: Faster check for small ints in long_dealloc (GH-127620)
2025-01-29 15:22:18 +00:00
Burkov Egor
25cf79a082
gh-129345: null check for indent syslogmodule ( #129348 )
2025-01-29 19:19:23 +05:30
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
97b0ef05d9
gh-129409: Fix Integer overflow - SEGV while writing data more than 2GB in CSV file ( #129413 )
2025-01-29 11:15:47 +00:00
Brandt Bucher
828b27680f
GH-126599: Remove the PyOptimizer API (GH-129194)
2025-01-28 16:10:51 -08:00
Sam Gross
d23f5701ad
gh-128844: Make _Py_TryIncref
public as an unstable API. ( #128926 )
...
This exposes `_Py_TryIncref` as `PyUnstable_TryIncref()` and the helper
function `_PyObject_SetMaybeWeakref` as `PyUnstable_EnableTryIncRef`.
These are helpers for dealing with unowned references in a safe way,
particularly in the free threading build.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-01-28 19:32:27 +00:00
Erlend E. Aasland
379ab856f5
gh-129346: Handle allocation errors for SQLite aggregate context ( #129347 )
2025-01-27 18:16:19 +01: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
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
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
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
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
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
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
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
8e0b36006c
gh-128002: use _PyObject_SetMaybeWeakref
when creating tasks in asyncio ( #128885 )
2025-01-24 21:12:56 +05:30
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
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
Ł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
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
Victor Stinner
46c7e13c05
gh-129185: Fix PyTraceMalloc_Untrack() at Python exit ( #129191 )
...
Support calling PyTraceMalloc_Track() and PyTraceMalloc_Untrack()
during late Python finalization.
* Call _PyTraceMalloc_Fini() later in Python finalization.
* Test also PyTraceMalloc_Untrack() without the GIL
* PyTraceMalloc_Untrack() now gets the GIL.
* Test also PyTraceMalloc_Untrack() in test_tracemalloc_track_race().
2025-01-23 12:07:34 +01:00
Victor Stinner
1d485db953
gh-128863: Deprecate _PyLong_Sign() function ( #129176 )
...
Replace _PyLong_Sign() with PyLong_GetSign().
2025-01-23 03:11:53 +01:00