Commit Graph

14003 Commits

Author SHA1 Message Date
Kirill Podoprigora 225cd55fe6
gh-115417: Remove accidentally left debugging print (#115418)
gh-115417: Remove debugging print
2024-02-13 18:45:37 +01:00
Steve Dower ea25f32d5f
gh-89240: Enable multiprocessing on Windows to use large process pools (GH-107873)
We add _winapi.BatchedWaitForMultipleObjects to wait for larger numbers of handles.
This is an internal module, hence undocumented, and should be used with caution.
Check the docstring for info before using BatchedWaitForMultipleObjects.
2024-02-13 00:28:35 +00:00
Steve Dower 7861dfd26a
gh-111140: Adds PyLong_AsNativeBytes and PyLong_FromNative[Unsigned]Bytes functions (GH-114886) 2024-02-12 20:13:13 +00:00
mpage de7d67b19b
gh-114271: Make `PyInterpreterState.threads.count` thread-safe in free-threaded builds (gh-115093)
Use atomics to mutate PyInterpreterState.threads.count.
2024-02-12 10:44:00 -07:00
Petr Viktorin 879f4546bf
gh-110850: Add PyTime_t C API (GH-115215)
* gh-110850: Add PyTime_t C API

Add PyTime_t API:

* PyTime_t type.
* PyTime_MIN and PyTime_MAX constants.
* PyTime_AsSecondsDouble(), PyTime_Monotonic(),
  PyTime_PerfCounter() and PyTime_GetSystemClock() functions.

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-02-12 18:13:10 +01:00
Nikita Sobolev 91bf01d4b1
gh-87804: Fix the refleak in error handling of `_pystatvfs_fromstructstatfs` (#115335)
It was the macro expansion! Sorry!
2024-02-12 19:27:27 +03:00
Kirill Podoprigora 93ac78ac3e
gh-115058: Add ``reset_rare_event_counters`` function in `_testinternalcapi` (GH-115128) 2024-02-12 16:05:30 +00:00
Eugene Toder 46190d9ea8
gh-89039: Call subclass constructors in datetime.*.replace (GH-114780)
When replace() method is called on a subclass of datetime, date or time,
properly call derived constructor. Previously, only the base class's
constructor was called.

Also, make sure to pass non-zero fold values when creating subclasses in
various methods. Previously, fold was silently ignored.
2024-02-12 14:44:56 +02:00
John Belmonte 72340d15cd
gh-114563: C decimal falls back to pydecimal for unsupported format strings (GH-114879)
Immediate merits:
* eliminate complex workarounds for 'z' format support
  (NOTE: mpdecimal recently added 'z' support, so this becomes
  efficient in the long term.)
* fix 'z' format memory leak
* fix 'z' format applied to 'F'
* fix missing '#' format support

Suggested and prototyped by Stefan Krah.

Fixes gh-114563, gh-91060

Co-authored-by: Stefan Krah <skrah@bytereef.org>
2024-02-12 13:17:51 +02:00
Nikita Sobolev 54bde5dcc3
gh-87804: Fix error handling and style in `_pystatvfs_fromstructstatfs` (#115236) 2024-02-12 10:27:12 +03:00
Serhiy Storchaka b104360788
gh-49766: Make date-datetime comparison more symmetric and flexible (GH-114760)
Now the special comparison methods like `__eq__` and `__lt__` return
NotImplemented if one of comparands is date and other is datetime
instead of ignoring the time part and the time zone or forcefully
return "not equal" or raise TypeError.

It makes comparison of date and datetime subclasses more symmetric
and allows to change the default behavior by overriding
the special comparison methods in subclasses.

It is now the same as if date and datetime was independent classes.
2024-02-11 13:06:43 +02:00
Soumendra Ganguly bf75f1b147
gh-85984: Add _POSIX_VDISABLE from unistd.h to termios module. (#114985)
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-02-11 10:29:44 +00:00
Nikita Sobolev 3a5b38e3b4
gh-114670: Fix `_testbuffer` module initialization (#114672) 2024-02-11 00:48:28 +03:00
Mike Zimin 9d1a353230
gh-114894: add array.array.clear() method (#114919)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-02-10 07:59:46 -08:00
Ronald Oussoren 6e222a55b1
GH-87804: Fix counter overflow in statvfs on macOS (#99570)
On macOS the statvfs interface returns block counts as
32-bit integers, and that results in bad reporting for
larger disks.

Therefore reimplement statvfs in terms of statfs, which
does use 64-bit integers for block counts.

Tested using a sparse filesystem image of 100TB.
2024-02-10 11:16:45 +01:00
Sam Gross a3af3cb4f4
gh-110481: Implement inter-thread queue for biased reference counting (#114824)
Biased reference counting maintains two refcount fields in each object:
`ob_ref_local` and `ob_ref_shared`. The true refcount is the sum of these two
fields. In some cases, when refcounting operations are split across threads,
the ob_ref_shared field can be negative (although the total refcount must be
at least zero). In this case, the thread that decremented the refcount
requests that the owning thread give up ownership and merge the refcount
fields.
2024-02-09 17:08:32 -05:00
Serhiy Storchaka 846fd721d5
gh-115059: Flush the underlying write buffer in io.BufferedRandom.read1() (GH-115163) 2024-02-09 12:36:12 +02:00
Artem Chernyshev 9e90313320
gh-115136: Fix possible NULL deref in getpath_joinpath() (GH-115137)
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
2024-02-08 08:40:38 +00:00
Alex Gaynor 38b970dfcc
When the Py_CompileStringExFlags fuzzer encounters a SystemError, abort (#115147)
This allows us to catch bugs beyond memory corruption and assertions.
2024-02-07 17:21:33 -05:00
Sam Gross ef3ceab09d
gh-112066: Use `PyDict_SetDefaultRef` in place of `PyDict_SetDefault`. (#112211)
This changes a number of internal usages of `PyDict_SetDefault` to use `PyDict_SetDefaultRef`.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-02-07 13:43:18 -05:00
Mark Shannon 8a3c499ffe
GH-108362: Revert "GH-108362: Incremental GC implementation (GH-108038)" (#115132)
Revert "GH-108362: Incremental GC implementation (GH-108038)"

This reverts commit 36518e69d7.
2024-02-07 12:38:34 +00:00
Dino Viehland 92abb01240
gh-112075: Add critical sections for most dict APIs (#114508)
Starts adding thread safety to dict objects.


Use @critical_section for APIs which are exposed via argument clinic and don't directly correlate with a public C API which needs to acquire the lock
Use a _lock_held suffix for keeping changes to complicated functions simple and just wrapping them with a critical section
Acquire and release the lock in an existing function where it won't be overly disruptive to the existing logic
2024-02-06 14:03:43 -08:00
Sam Gross b6228b521b
gh-115035: Mark ThreadHandles as non-joinable earlier after forking (#115042)
This marks dead ThreadHandles as non-joinable earlier in
`PyOS_AfterFork_Child()` before we execute any Python code. The handles
are stored in a global linked list in `_PyRuntimeState` because `fork()`
affects the entire process.
2024-02-06 14:45:04 -05:00
Sam Gross 7fdd4235d7
gh-112529: Stop the world around gc.get_referents (#114823)
We do not want to add locking in `tp_traverse` slot implementations.
Instead, stop the world when calling `gc.get_referents`. Note that the the
stop the world call is a no-op in the default build.

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-02-06 11:45:42 -05:00
Sam Gross de61d4bd4d
gh-112066: Add `PyDict_SetDefaultRef` function. (#112123)
The `PyDict_SetDefaultRef` function is similar to `PyDict_SetDefault`,
but returns a strong reference through the optional `**result` pointer
instead of a borrowed reference.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-02-06 11:36:23 -05:00
Mariusz Felisiak 1a10437a14
gh-91602: Add iterdump() support for filtering database objects (#114501)
Add optional 'filter' parameter to iterdump() that allows a "LIKE"
pattern for filtering database objects to dump.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-02-06 12:34:56 +01:00
Serhiy Storchaka 652fbf88c4
gh-82626: Emit a warning when bool is used as a file descriptor (GH-111275) 2024-02-05 22:51:11 +02:00
Erlend E. Aasland 09096a1647
gh-115015: Argument Clinic: fix generated code for METH_METHOD methods without params (#115016) 2024-02-05 21:49:17 +01:00
Mark Shannon 36518e69d7
GH-108362: Incremental GC implementation (GH-108038) 2024-02-05 18:28:51 +00:00
Nikita Sobolev 87cd20a567
gh-115026: Argument Clinic: handle PyBuffer_FillInfo errors in generated code (#115027) 2024-02-05 11:45:09 +01:00
Nikita Sobolev 929d44e15a
gh-114685: PyBuffer_FillInfo() now raises on PyBUF_{READ,WRITE} (GH-114802) 2024-02-04 19:16:43 +00:00
Jason Zhang efc489021c
gh-111417: Remove unused code block in math.trunc() and round() (GH-111454)
_PyObject_LookupSpecial() now ensures that the type is ready.
2024-02-03 17:11:10 +02:00
Sam Gross d0f1307580
gh-114329: Add `PyList_GetItemRef` function (GH-114504)
The new `PyList_GetItemRef` is similar to `PyList_GetItem`, but returns
a strong reference instead of a borrowed reference. Additionally, if the
passed "list" object is not a list, the function sets a `TypeError`
instead of calling `PyErr_BadInternalCall()`.
2024-02-02 14:03:15 +01:00
Mark Shannon 0e71a295e9
GH-113710: Add a "globals to constants" pass (GH-114592)
Converts specializations of `LOAD_GLOBAL` into constants during tier 2 optimization.
2024-02-02 12:14:34 +00:00
Sam Gross 587d480203
gh-112529: Remove PyGC_Head from object pre-header in free-threaded build (#114564)
* gh-112529: Remove PyGC_Head from object pre-header in free-threaded build

This avoids allocating space for PyGC_Head in the free-threaded build.
The GC implementation for free-threaded CPython does not use the
PyGC_Head structure.

 * The trashcan mechanism uses the `ob_tid` field instead of `_gc_prev`
   in the free-threaded build.
 * The GDB libpython.py file now determines the offset of the managed
   dict field based on whether the running process is a free-threaded
   build. Those are identified by the `ob_ref_local` field in PyObject.
 * Fixes `_PySys_GetSizeOf()` which incorrectly incorrectly included the
   size of `PyGC_Head` in the size of static `PyTypeObject`.
2024-02-01 12:29:19 -08:00
Serhiy Storchaka b7688ef71e
gh-114685: Check flags in PyObject_GetBuffer() (GH-114707)
PyObject_GetBuffer() now raises a SystemError if called with
PyBUF_READ or PyBUF_WRITE as flags. These flags should
only be used with the PyMemoryView_* C API.
2024-01-31 13:11:35 +02:00
Diego Russo a06b606462
gh-110190: Fix ctypes structs with array on Windows ARM64 (GH-114753) 2024-01-30 23:53:04 +00:00
Eugene Toder 1f515e8a10
gh-112919: Speed-up datetime, date and time.replace() (GH-112921)
Use argument clinic and call new_* functions directly. This speeds up
these functions 6x to 7.5x when calling with keyword arguments.
2024-01-30 15:19:46 +00:00
Serhiy Storchaka ea30a28c3e
gh-113732: Fix support of QUOTE_NOTNULL and QUOTE_STRINGS in csv.reader (GH-113738) 2024-01-30 14:21:12 +02:00
Serhiy Storchaka aa3402ad45
gh-114678: Fix incorrect deprecation warning for 'N' specifier in Decimal format (GH-114683)
Co-authored-by: Stefan Krah <skrah@bytereef.org>
2024-01-29 19:58:31 +02:00
Soumendra Ganguly e351ca3c20
gh-85984: Add POSIX pseudo-terminal functions. (GH-102413)
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-01-29 16:10:28 +00:00
Petr Viktorin 15fe8cea17
gh-91325: Skip Stable ABI checks with Py_TRACE_REFS special build (GH-92046)
Skip Stable ABI checks with Py_TRACE_REFS special build

This build is not compatible with Py_LIMITED_API nor with
the stable ABI.
2024-01-29 16:45:31 +01:00
mpage c87233fd3f
gh-112050: Adapt collections.deque to Argument Clinic (#113963) 2024-01-29 15:08:23 +00:00
Steve Dower 102569d150
Use Unicode unconditionally for _winapi.CreateFile (GH-114611)
Currently it switches based on build settings, but argument clinic does not handle it correctly.
2024-01-26 17:27:29 +00:00
Erlend E. Aasland dcd28b5c35
gh-114569: Use PyMem_* APIs for most non-PyObject uses (#114574)
Fix usage in Modules, Objects, and Parser subdirectories.
2024-01-26 10:11:35 +00:00
Michael Droettboom d0f7f5c41d
gh-114312: Fix rare event counter tests on aarch64 (GH-114554) 2024-01-26 10:10:03 +00:00
Nikita Sobolev d96358ff9d
gh-114315: Make `threading.Lock` a real class, not a factory function (#114479)
`threading.Lock` is now the underlying class and is constructable rather than the old
factory function. This allows for type annotations to refer to it which had no non-ugly
way to be expressed prior to this.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-01-25 19:46:32 +00:00
Michael Droettboom ea3cd0498c
gh-114312: Collect stats for unlikely events (GH-114493) 2024-01-25 11:10:51 +00:00
Serhiy Storchaka d22c066b80
gh-114492: Initialize struct termios before calling tcgetattr() (GH-114495)
On Alpine Linux it could leave some field non-initialized.
2024-01-23 23:27:04 +02:00
mpage 925907ea36
gh-113884: Make queue.SimpleQueue thread-safe when the GIL is disabled (#114161)
* use the ParkingLot API to manage waiting threads
* use Argument Clinic's critical section directive to protect queue methods
* remove unnecessary overflow check

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-01-23 20:25:41 +01:00
Serhiy Storchaka 1b719b39b9
gh-114321: Expose more constants in the fcntl module (GH-114322) 2024-01-22 18:09:22 +02:00
neonene 9f7176d360
gh-103092: Ensure `_ctypes.c` static types are accessed via global state (#113857) 2024-01-22 14:40:36 +01:00
Serhiy Storchaka c8351a617b
gh-113796: Add more validation checks in the csv.Dialect constructor (GH-113797)
ValueError is now raised if the same character is used in different roles.
2024-01-22 15:34:16 +02:00
Nikita Sobolev d1b031cc58
gh-114414: Assert PyType_GetModuleByDef result in _threadmodule (#114415) 2024-01-22 10:19:25 +01:00
mpage 28eacf27ef
gh-113884: Refactor `queue.SimpleQueue` to use a ring buffer to store items (#114259)
Use a ring buffer instead of a Python list in order to simplify the
process of making queue.SimpleQueue thread-safe in free-threaded
builds. The ring buffer implementation has no places where critical
sections may be released.
2024-01-19 12:17:51 +00:00
Nikita Sobolev 05e47202a3
gh-114286: Fix `maybe-uninitialized` warning in `Modules/_io/fileio.c` (GH-114287) 2024-01-19 10:25:05 +00:00
Skip Montanaro 72abb8c5d4
gh-114123: Migrate docstring from _csv to csv (#114124)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
2024-01-18 22:18:42 +00:00
AN Long 8e31cdc945
gh-103092: Convert some `_ctypes` metatypes to heap types (GH-113620)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-01-18 16:30:27 +01:00
Serhiy Storchaka e2c097ebde
gh-104522: Fix OSError raised when run a subprocess (#114195)
Only set filename to cwd if it was caused by failed chdir(cwd).

_fork_exec() now returns "noexec:chdir" for failed chdir(cwd).

Co-authored-by: Robert O'Shea <PurityLake@users.noreply.github.com>
2024-01-17 16:52:42 -08:00
Radislav Chugunov 0154405350
gh-104282: Fix null pointer dereference in `lzma._decode_filter_properties` (GH-104283) 2024-01-17 13:15:44 +00:00
Steve Dower de4ced54eb
gh-114096: Restore privileges in _winapi.CreateJunction after creating the junction (GH-114089)
This avoids impact on later parts of the application which may be able to do things they otherwise shouldn't.
2024-01-16 16:40:02 +00:00
Jonathon Reinhart e454f9383c
Fix an incorrect comment in iobase_is_closed (GH-102952)
This comment appears to have been mistakenly copied from what is now
called iobase_check_closed() in commit 4d9aec0220.

Also unite the iobase_check_closed() code with the relevant comment.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-16 18:27:17 +02:00
AN Long 6c502ba809
gh-114101: Correct PyErr_Format arguments in _testcapi module (#114102)
- use PyErr_SetString() iso. PyErr_Format() in parse_tuple_and_keywords()
- fix misspelled format specifier in CHECK_SIGNNESS() macro
2024-01-16 09:32:39 +01:00
Zackery Spytz 8fd287b18f
gh-78502: Add a trackfd parameter to mmap.mmap() (GH-25425)
If *trackfd* is False, the file descriptor specified by *fileno*
will not be duplicated.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-16 08:51:46 +01:00
Ronald Oussoren 2010d45327
gh-113666: Adding missing UF_ and SF_ flags to module 'stat' (#113667)
Add some constants to module 'stat' that are used on macOS.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-15 12:22:43 +01:00
Ronald Oussoren 79970792fd
gh-113868: Add a number of MAP_* flags from macOS to module mmap (#113869)
The new flags were extracted from the macOS 14.2 SDK.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-12 16:56:18 +01:00
Steve Dower ed066481c7
gh-111877: Fixes stat() handling for inaccessible files on Windows (GH-113716) 2024-01-12 15:27:56 +00:00
Zackery Spytz b4d4aa9e8d
gh-81489: Use Unicode APIs for mmap tagname on Windows (GH-14133)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-01-11 22:39:47 +00:00
Peter Lazorchak f653caa5a8
gh-89811: Check for valid tp_version_tag in specializer (GH-113558) 2024-01-11 13:33:05 +08:00
Victor Stinner 1d75fa43a2
gh-77046: os.pipe() sets _O_NOINHERIT flag on fds (#113817)
On Windows, set _O_NOINHERIT flag on file descriptors
created by os.pipe() and io.WindowsConsoleIO.

Add test_pipe_spawnl() to test_os.

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2024-01-10 23:02:17 +01:00
Victor Stinner 93930eaf0a
gh-111139: Optimize math.gcd(int, int) (#113887)
Add a fast-path for the common case.

Benchmark:

    python -m pyperf timeit \
        -s 'import math; gcd=math.gcd; x=2*3; y=3*5' \
        'gcd(x,y)'

Result: 1.07x faster (-3.4 ns)

    Mean +- std dev: 52.6 ns +- 4.0 ns -> 49.2 ns +- 0.4 ns: 1.07x faster
2024-01-10 16:38:56 +01:00
Serhiy Storchaka 183b97bb9d
gh-111789: Use PyDict_GetItemRef() in Modules/_zoneinfo.c (GH-112078) 2024-01-10 15:35:10 +02:00
Serhiy Storchaka 89cee94b31
gh-89850: Add default C implementations of persistent_id() and persistent_load() (GH-113579)
Previously the C implementation of pickle.Pickler and pickle.Unpickler
classes did not have such methods and they could only be used if
they were overloaded in subclasses or set as instance attributes.

Fixed calling super().persistent_id() and super().persistent_load() in
subclasses of the C implementation of pickle.Pickler and pickle.Unpickler
classes. It no longer causes an infinite recursion.
2024-01-10 15:30:37 +02:00
Serhiy Storchaka 568d220993
gh-70835: Clarify error message for CSV file opened with wrong newline (GH-113786)
Based on patch by SilentGhost.
2024-01-10 14:52:29 +02:00
Jamie Phan 4826d52338
gh-112182: Replace StopIteration with RuntimeError for future (#113220)
When an `StopIteration` raises into `asyncio.Future`, this will cause
a thread to hang. This commit address this by not raising an exception
and silently transforming the `StopIteration` with a `RuntimeError`,
which the caller can reconstruct from `fut.exception().__cause__`
2024-01-09 21:21:00 -08:00
AN Long 623b338adf
gh-66060: Use actual class name in _io type's __repr__ (#30824)
Use the object's actual class name in the following _io type's __repr__:
- FileIO
- TextIOWrapper
- _WindowsConsoleIO
2024-01-09 21:39:36 +01:00
Serhiy Storchaka 5273655bea
gh-113848: Use PyErr_GivenExceptionMatches() for check for CancelledError (GH-113849) 2024-01-09 21:41:02 +02:00
AN Long c31be58da8
gh-87868: Sort and remove duplicates in getenvironment() (GH-102731)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-01-09 15:58:26 +00:00
Ronald Oussoren c6ca562138
gh-113791: Expose CLOCK_MONOTONIC_RAW_APPROX and CLOCK_UPTIME_RAW_APROX on macOS in the time module (#113792) 2024-01-08 20:44:00 +01:00
Erlend E. Aasland 35fa13d48b
gh-113755: Fully adapt gcmodule.c to Argument Clinic (#113756)
Adapt the following functions to Argument Clinic:

- gc.set_threshold
- gc.get_referrers
- gc.get_referents
2024-01-08 18:32:34 +01:00
neonene ace4d7ff9a
gh-113787: Fix refleaks in test_capi (gh-113816)
Fix refleaks and a typo.
2024-01-08 08:34:51 -08:00
Pablo Galindo Salgado a03ec20bcd
gh-110721: Remove unused code from suggestions.c after moving PyErr_Display to use the traceback module (#113712) 2024-01-08 15:10:45 +00:00
Zackery Spytz 73c9326563
gh-80109: Fix io.TextIOWrapper dropping the internal buffer during write() (GH-22535)
io.TextIOWrapper was dropping the internal decoding buffer
during read() and write() calls.
2024-01-08 12:33:34 +02:00
Rami 84d1f76092
gh-89532: Remove LibreSSL workarounds (#28728)
Remove LibreSSL specific workaround ifdefs from `_ssl.c` and delete the non-version-specific `_ssl_data.h` file (relevant for OpenSSL < 1.1.1, which we no longer support per PEP 644).

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-01-06 23:25:58 +00:00
Sam Gross d0f0308a37
gh-113750: Fix object resurrection in free-threaded builds (gh-113751)
gh-113750: Fix object resurrection on free-threaded builds

This avoids the undesired re-initializing of fields like `ob_gc_bits`,
`ob_mutex`, and `ob_tid` when an object is resurrected due to its
finalizer being called.

This change has no effect on the default (with GIL) build.
2024-01-06 12:12:26 +09:00
Sam Gross 99854ce170
gh-113688: Split up gcmodule.c (gh-113715)
This splits part of Modules/gcmodule.c of into Python/gc.c, which
now contains the core garbage collection implementation. The Python
module remain in the Modules/gcmodule.c file.
2024-01-05 12:17:16 -08:00
Christopher Chavez f637b44dd2
gh-111178: Avoid calling functions from incompatible pointer types in _tkinter.c (GH-112893)
Fix undefined behavior warnings (UBSan  -fsanitize=function).
2024-01-02 15:51:32 +01:00
Neil Schemenauer b2566d89ce
GH-113633: Use module state structure for _testcapi. (GH-113634)
Use module state structure for _testcapi.
2024-01-01 23:04:09 +00:00
Ronald Oussoren d0b0e3d2ef
gh-113536: Expose `os.waitid` on macOS (#113542)
* gh-113536: Expose `os.waitid` on macOS

This API has been available on macOS for a long time, but was
explicitly excluded due to unspecified problems with the API
in ancient versions of macOS.

* Document that the API is available on macOS starting in Python 3.13
2024-01-01 19:38:29 +01:00
Jeffrey Kintscher 5f3cc90a12
gh-62260: Fix ctypes.Structure subclassing with multiple layers (GH-13374)
The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-01 18:24:24 +02:00
Kirill Podoprigora cf34b7704b
gh-103092: Make ``pyexpat`` module importable in sub-interpreters (#113555) 2023-12-29 18:43:46 +05:30
Zackery Spytz f108468970
bpo-11102: Make configure enable major(), makedev(), and minor() on HP-UX (GH-19856)
Always include <sys/types.h> before <sys/sysmacros.h>.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-28 12:47:44 +02:00
Kirill Podoprigora f1676867b5
gh-103092: Make `_elementtree` module importable in sub-interpreters (#113434)
Enable imports of _elementtree module in sub-interpreters
2023-12-28 14:42:21 +05:30
David Benjamin af2b8f6845
gh-113332: Simplify calls to SSL_(CTX_)set_verify in _ssl.c (#113333)
_ssl.c currently tries to preserve the verification callback, but at no
point does it ever set one. Just pass in NULL.
2023-12-26 16:35:41 -05:00
Serhiy Storchaka 1f06baeabd
gh-113191: Add support of os.fchmod() on Windows (GH-113192)
Also support a file descriptor in os.chmod().
2023-12-24 10:57:11 +00:00
Kirill Podoprigora 894f0e573d
gh-111784: Fix two segfaults in the elementtree module (GH-113405)
First fix resolve situation when pyexpat module (which contains expat_CAPI
capsule) deallocates before _elementtree, so we need to hold a strong
reference to pyexpat module to.

Second fix resolve situation when module state is deallocated before
deallocation of XMLParser instances, which uses module state to clear
some stuff.
2023-12-24 10:57:41 +02:00
Donghee Na 57b7e52790
gh-112205: Support docstring for `@getter` (#113160)
---------

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-12-20 21:52:12 +09:00
Gregory P. Smith c895403de0
gh-113119: Fix the macOS framework installer build (#113268)
`--enable-framework` builds were failing.  we apparently do not have good CI & buildbot coverage here.
2023-12-18 21:18:30 -08:00
Itamar Oren 2feec0fc7f
gh-113039: Avoid using leading dots in the include path for frozen getpath.py (GH-113022) 2023-12-18 17:04:40 +00:00
Jakub Kulík 2b93f52242
gh-113117: Support posix_spawn in subprocess.Popen with close_fds=True (#113118)
Add support for `os.POSIX_SPAWN_CLOSEFROM` and
`posix_spawn_file_actions_addclosefrom_np` and have the `subprocess` module use
them when available.  This means `posix_spawn` can now be used in the default
`close_fds=True` situation on many platforms.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-12-17 21:34:57 +00:00