125294 Commits

Author SHA1 Message Date
Cody Maloney
3ebe3d7688
Revert "gh-129005: _pyio.BufferedIO remove copy on readall (#129454)" (#129500)
This reverts commit e1c4ba928852eac0b0e0bded1c314e3e36975286.
2025-01-31 09:40:44 +01:00
Kumar Aditya
c07ac3c86a
gh-128452: fix warning in socketmodule.c (#129478) 2025-01-31 13:41:11 +05:30
Cody Maloney
10ee2d9d3b
gh-129205: Update multiprocessing.forkserver to use os.readinto() (#129425) 2025-01-30 22:24:52 +00:00
donBarbos
510fefdc62
gh-127349: Add check for correct resizing in REPL (#127387) 2025-01-30 19:34:09 +00:00
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
Irit Katriel
5ab9604683
clearer error and suggestion when c-analyzer cannot read ignored.tsv (#129423) 2025-01-30 11:38:52 +00:00
Victor Stinner
a810cb89f1
gh-89188: Implement PyUnicode_KIND() as a function (#129412)
Implement PyUnicode_KIND() and PyUnicode_DATA() as function, in
addition to the macros with the same names. The macros rely on C bit
fields which have compiler-specific layout.
2025-01-30 11:27:27 +00:00
Cody Maloney
e1c4ba9288
gh-129005: _pyio.BufferedIO remove copy on readall (#129454)
Slicing buf and appending chunk would always result in a copy. Commonly
in a readall() there is no already read data in buf, and the amount of
data read may be large, so the copy is expensive.
2025-01-30 11:23:25 +00: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
Cody Maloney
f927204f64
gh-129005: Align FileIO.readall() allocation (#129458)
Both now use a pre-allocated buffer of length `bufsize`, fill it using
a readinto(), and have matching "expand buffer" logic.

On my machine this takes:

`./python -m test -M8g -uall test_largefile -m test_large_read -v`

from ~3.7 seconds to ~3.4 seconds.
2025-01-30 11:14:23 +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
Stan Ulbrych
652f66ac38
gh-129438: Update `--enable-experimental-jit` section with install requirements (#129450)
Add a note to the `JIT` docs that building CPython with `JIT` requires Python 3.11 or newer.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2025-01-30 12:16:05 +02: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
Gregory P. Smith
71aecc284e
remove type annotations from multiprocessing. (#129381)
* remove type annotations from multiprocessing.

One of them was technically invalid per typing specs... but since we're not
checking these in the stdlib today lets elide them.

https://discuss.python.org/t/static-type-annotations-in-cpython/65068/13

* use the actual comment style annotation format

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>

---------

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2025-01-30 00:31:54 -08:00
Stan Ulbrych
bcb25d60b1
gh-129403: Fix ValueError messages in asyncio.Barrier and threading.Barrier (#129419)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-30 11:11:12 +03:00
Filipe Laíns 🇵🇸
a4722449ca
tests: add test.support.venv.VirtualEnvironmentMixin (#129461) 2025-01-30 03:32:24 +00:00
Victor Stinner
a549f43938
gh-128779: Fix site venv() for system site-packages (#129184) 2025-01-30 00:02:31 +00:00
Matthew Hughes
99849ee0d3
gh-127432: Add CI job to cross build Python (#128380)
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-01-29 23:24:09 +00:00
Filipe Laíns 🇵🇸
c931d75831
GH-127178: improve compatibility in _sysconfig_vars_(...).json (#128558) 2025-01-29 22:47:20 +00: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
Tomas R.
a1a4e9f39a
gh-125522: Fix bare except in test_uuid (#129018) 2025-01-29 20:59:45 +00:00
Hod
fdcedfd3cf
gh-126400: Add TCP socket timeout to SysLogHandler to prevent blocking (GH-126716)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-01-29 19:37:43 +00:00
Brandt Bucher
002c4e2982
GH-129386: Use symbolic constants for specialization tests (GH-129415) 2025-01-29 10:49:58 -08:00
Taneli Hukkinen
99ed3025fe
gh-118761: Always lazy import warnings in threading (#129428) 2025-01-29 17:24:37 +00:00
Taneli Hukkinen
49f24650e4
gh-118761: Improve import time of subprocess (GH-129427)
* subprocess: lazy import signal and locale to improve module import time
2025-01-29 08:31:13 -08:00
Sam Gross
5ff2fbc026
gh-129236: Use stackpointer in free threaded GC (#129240)
The stack pointers in interpreter frames are nearly always valid now, so
use them when visiting each thread's frame. For now, don't collect
objects with deferred references in the rare case that we see a frame
with a NULL stack pointer.
2025-01-29 10:40:51 -05:00
Pieter Eendebak
a29221675e
gh-127119: Faster check for small ints in long_dealloc (GH-127620) 2025-01-29 15:22:18 +00:00
Zanie Blue
3a974e39d5
gh-129296: Fix pyatomic.h include paths (#129320)
Use relative includes in Include/cpython/pyatomic.h for
pyatomic_gcc.h, pyatomic_std.h and pyatomic_msc.h.

Do a similar change in Include/cpython/pythread.h for
pthread_stubs.h include.
2025-01-29 15:06:19 +00:00
Burkov Egor
25cf79a082
gh-129345: null check for indent syslogmodule (#129348) 2025-01-29 19:19:23 +05:30
Hugo van Kemenade
c67afb581e
CI: Change job name to 'build arm64' on Windows (#129434) 2025-01-29 13:18:19 +00:00
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
Irit Katriel
4815131910
gh-100239: specialize bitwise logical binary ops on ints (#128927) 2025-01-29 09:28:21 +00:00
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
03d9cdb729
Merge TSAN test matrices in CI (#123278) 2025-01-29 11:16:51 +02:00
Pieter Eendebak
1a80214f11
gh-126703: Add freelists for list and tuple iterators (GH-128592) 2025-01-29 09:15:24 +00:00
Brandt Bucher
41ad2bb248
GH-128563: Don't leave frame->lltrace uninitialized (GH-129417) 2025-01-28 16:26:46 -08:00
Brandt Bucher
828b27680f
GH-126599: Remove the PyOptimizer API (GH-129194) 2025-01-28 16:10:51 -08:00
T. Wouters
5c930a26fb
gh-115999: Enable free-threaded specialization of LOAD_CONST (#129365)
Enable free-threaded specialization of LOAD_CONST.
2025-01-29 01:07:56 +01:00
Hood Chatham
789390872b
gh-127146: Skip test_readinto_non_blocking on Emscripten (#129421)
Skips an additional test due to non_blocking not working reliably on Emscripten.
2025-01-29 07:30:42 +08:00
Pieter Eendebak
64c417dee5
gh-112075: Remove critical section in dict.get (gh-129336)
The `dict.get` implementation uses `_Py_dict_lookup_threadsafe`, which is
thread-safe, so we remove the critical section from the argument clinic.

Add a test for concurrent dict get and set operations.
2025-01-28 21:55:45 +00:00
Barney Gale
a4459c34ea
GH-127381: pathlib ABCs: remove JoinablePath.match() (#129147)
Unlike `ReadablePath.[r]glob()` and `JoinablePath.full_match()`, the
`JoinablePath.match()` method doesn't support the recursive wildcard `**`,
and matches from the right when a fully relative pattern is given. These
quirks means its probably unsuitable for inclusion in the pathlib ABCs,
especially given `full_match()` handles the same use case.
2025-01-28 20:22:55 +00: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
Samuel GIFFARD
7dd0a7e52e
gh-129408: http: Fix typo 'RFF' to RFC' in documentation (#129411) 2025-01-28 13:25:51 -05:00
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