Commit Graph

121000 Commits

Author SHA1 Message Date
Victor Stinner e4c34f04a1
gh-110850: Cleanup PyTime API: PyTime_t are nanoseconds (#115753)
PyTime_t no longer uses an arbitrary unit, it's always a number of
nanoseconds (64-bit signed integer).

* Rename _PyTime_FromNanosecondsObject() to _PyTime_FromLong().
* Rename _PyTime_AsNanosecondsObject() to _PyTime_AsLong().
* Remove pytime_from_nanoseconds().
* Remove pytime_as_nanoseconds().
* Remove _PyTime_FromNanoseconds().
2024-02-21 11:46:00 +01:00
Frank Hoffmann 69ab93082d
gh-112364: Correct unparsing of backslashes and quotes in ast.unparse (#115696) 2024-02-21 10:24:08 +00:00
Russell Keith-Magee 074bbec9c4
gh-115737: Correct libpython install name for macOS shared library builds. (gh-115750) 2024-02-21 04:11:04 -05:00
Bogdan Romanyuk 10fc4675fd
gh-115653: Document PyCode_GetFirstFree() (#115654)
Correct the return type of the PyCode_GetNumFree() documentation.
2024-02-21 10:01:36 +01:00
Victor Stinner 77430b6a32
gh-110850: Replace private _PyTime_MAX with public PyTime_MAX (#115751)
Remove references to the old names _PyTime_MIN
and _PyTime_MAX, now that PyTime_MIN and
PyTime_MAX are public.

Replace also _PyTime_MIN with PyTime_MIN.
2024-02-21 08:11:40 +00:00
Benjamin Peterson 1235e84276
Delete unused sym_clear_flag function. (#115744) 2024-02-20 17:40:48 -08:00
Donghee Na 259730bbb5
gh-112087: Make list_{concat, repeat, inplace_repeat, ass_item) to be thread-safe (gh-115605) 2024-02-21 01:38:09 +00:00
Dino Viehland 54071460d7
gh-112075: Accessing a single element should optimistically avoid locking (#115109)
Makes accessing a single element thread safe and typically lock free
2024-02-20 17:08:14 -08:00
Dino Viehland 176df09adb
gh-112075: Make PyDictKeysObject thread-safe (#114741)
Adds locking for shared PyDictKeysObject's for dictionaries
2024-02-20 16:40:37 -08:00
Victor Stinner 145bc2d638
gh-110850: Use public PyTime functions (#115746)
Replace private _PyTime functions with public PyTime functions.

random_seed_time_pid() now reports errors to its caller.
2024-02-20 23:31:30 +00:00
Victor Stinner 52d1477566
gh-110850: Rename internal PyTime C API functions (#115734)
Rename functions:

* _PyTime_GetSystemClock() => _PyTime_TimeUnchecked()
* _PyTime_GetPerfCounter() => _PyTime_PerfCounterUnchecked()
* _PyTime_GetMonotonicClock() => _PyTime_MonotonicUnchecked()
* _PyTime_GetSystemClockWithInfo() => _PyTime_TimeWithInfo()
* _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo()
* _PyTime_GetMonotonicClockWithInfo() => _PyTime_MonotonicWithInfo()

Changes:

* Remove "typedef PyTime_t PyTime_t;" which was
  "typedef PyTime_t _PyTime_t;" before a previous rename.
* Update comments of "Unchecked" functions.
* Remove invalid PyTime_Time() comment.
2024-02-20 22:16:37 +00:00
Victor Westerhuis e1fdc3c323
gh-104061: Add socket.SO_BINDTOIFINDEX constant (GH-104062)
Add socket.SO_BINDTOIFINDEX constant

This socket option avoids a race condition between SO_BINDTODEVICE and network interface renaming.
2024-02-20 23:08:15 +02:00
Guido van Rossum 142502ea8d
Tier 2 cleanups and tweaks (#115534)
* Rename `_testinternalcapi.get_{uop,counter}_optimizer` to `new_*_optimizer`
* Use `_PyUOpName()` instead of` _PyOpcode_uop_name[]`
* Add `target` to executor iterator items -- `list(ex)` now returns `(opcode, oparg, target, operand)` quadruples
* Add executor methods `get_opcode()` and `get_oparg()` to get `vmdata.opcode`, `vmdata.oparg`
* Define a helper for printing uops, and unify various places where they are printed
* Add a hack to summarize_stats.py to fix legacy uop names (e.g. `POP_TOP` -> `_POP_TOP`)
* Define helpers in `test_opt.py` for accessing the set or list of opnames of an executor
2024-02-20 20:24:35 +00:00
Sam Gross 520403ed4c
gh-115733: Fix crash involving exhausted list iterator (#115740)
* gh-115733: Fix crash involving exhausted iterator

* Add blurb
2024-02-21 05:18:44 +09:00
Mark Shannon 494739e1f7
GH-115727: Temporary fix of confidence score test. (GH-115728)
Temporary fix of confidence score test.
2024-02-20 18:50:31 +00:00
Ken Jin 7a8c3ed43a
gh-115735: Fix current executor NULL before _START_EXECUTOR (#115736)
This fixes level 3 or higher lltrace debug output `--with-pydebug` runs.
2024-02-20 18:47:05 +00:00
Sam Gross e3ad6ca56f
gh-115103: Implement delayed free mechanism for free-threaded builds (#115367)
This adds `_PyMem_FreeDelayed()` and supporting functions. The
`_PyMem_FreeDelayed()` function frees memory with the same allocator as
`PyMem_Free()`, but after some delay to ensure that concurrent lock-free
readers have finished.
2024-02-20 13:04:37 -05:00
Victor Stinner d207c7cd5a
gh-110850: Cleanup pycore_time.h includes (#115724)
<pycore_time.h> include is no longer needed to get the PyTime_t type
in internal header files. This type is now provided by <Python.h>
include. Add <pycore_time.h> includes to C files instead.
2024-02-20 16:50:43 +00:00
Eugene Toder e976baba99
gh-86291: linecache: get module name from __spec__ if available (GH-22908)
This allows getting source code for the __main__ module when a custom
loader is used.
2024-02-20 16:47:41 +00:00
Serhiy Storchaka 937d282150
gh-115712: Support CSV dialects with delimiter=' ' and skipinitialspace=True (GH-115721)
Restore support of such combination, disabled in gh-113796.

csv.writer() now quotes empty fields if delimiter is a space and
skipinitialspace is true and raises exception if quoting is not possible.
2024-02-20 18:09:50 +02:00
Sam Gross cc82e33af9
gh-115491: Keep some fields valid across allocations (free-threading) (#115573)
This avoids filling the memory occupied by ob_tid, ob_ref_local, and
ob_ref_shared with debug bytes (e.g., 0xDD) in mimalloc in the
free-threaded build.
2024-02-20 10:36:40 -05:00
Eugene Toder c0b0c2f201
gh-101860: Expose __name__ on property (GH-101876)
Useful for introspection and consistent with functions and other
descriptors.
2024-02-20 17:14:34 +02:00
Victor Stinner 9af80ec83d
gh-110850: Replace _PyTime_t with PyTime_t (#115719)
Run command:

sed -i -e 's!\<_PyTime_t\>!PyTime_t!g' $(find -name "*.c" -o -name "*.h")
2024-02-20 15:02:27 +00:00
Brett Simmers 0749244d13
gh-112175: Add `eval_breaker` to `PyThreadState` (#115194)
This change adds an `eval_breaker` field to `PyThreadState`. The primary
motivation is for performance in free-threaded builds: with thread-local eval
breakers, we can stop a specific thread (e.g., for an async exception) without
interrupting other threads.

The source of truth for the global instrumentation version is stored in the
`instrumentation_version` field in PyInterpreterState. Threads usually read the
version from their local `eval_breaker`, where it continues to be colocated
with the eval breaker bits.
2024-02-20 09:57:48 -05:00
talcs e71468ba4f
gh-112020: Document the meaning of empty bytes returned by socket.recv() (GH-112055) 2024-02-20 16:54:33 +02:00
Victor Stinner e00960a74d
gh-110850: Enhance PyTime C API tests (#115715) 2024-02-20 15:53:40 +01:00
Alexander Shadchin 1ff6c1416b
Add missed `stream` argument (#111775)
* Add missed `stream` argument

* Add news
2024-02-20 14:09:46 +00:00
Victor Stinner d24bed5ba0
gh-110850: PyTime_Time() return 0 on success (GH-115713)
Thanks!
2024-02-20 14:35:41 +01:00
Ken Jin dcba21f905
gh-115687: Split up guards from COMPARE_OP (GH-115688) 2024-02-20 11:30:49 +00:00
Kirill Podoprigora a2bb8ad144
gh-115700: Add target `_RegenCases` in Windows build for cases regeneration. (GH-115708) 2024-02-20 19:10:47 +08:00
Mark Shannon 626c414995
GH-115457: Support splitting and replication of micro ops. (GH-115558) 2024-02-20 10:50:59 +00:00
Mark Shannon 7b21403ccd
GH-112354: Initial implementation of warm up on exits and trace-stitching (GH-114142) 2024-02-20 09:39:55 +00:00
Raymond Hettinger acda1757bc
gh-113157: Document and test __get__ for MethodType (gh-115492) 2024-02-20 01:53:25 -06:00
Raymond Hettinger 2aaef56236
Make the title match the content (GH-115702) 2024-02-20 01:51:56 -06:00
Raymond Hettinger 9f8a9e8ac7
Modernize the Sorting HowTo guide (gh-115479) 2024-02-19 21:22:07 -06:00
Jason Zhang c2cb31bbe1
gh-115539: Allow enum.Flag to have None members (GH-115636) 2024-02-19 14:36:11 -08:00
Steve Dower 6cd18c75a4
gh-115543: Update py.exe to know about Python 3.13 and to install 3.12 by default (GH-115544) 2024-02-19 20:36:20 +00:00
Naglis Jonaitis 57d31ec359
Fix typo in multiprocessing docs (#115650) 2024-02-19 18:19:14 +00:00
Serhiy Storchaka 8f602981ba
gh-115664: Fix versionadded and versionchanged directives in multiprocessing.rst (GH-115665) 2024-02-19 18:03:42 +00:00
Brian Schubert b02ab65e80
gh-115664: Fix chronological ordering of versionadded and versionchanged directives (#115676) 2024-02-19 17:54:54 +00:00
Serhiy Storchaka e47ecbd042
gh-60346: Improve handling single-dash options in ArgumentParser.parse_known_args() (GH-114180) 2024-02-19 19:20:00 +02:00
Serhiy Storchaka 872cc9957a
gh-115341: Fix loading unit tests with doctests in -OO mode (GH-115342) 2024-02-19 19:03:21 +02:00
Serhiy Storchaka 07ef9d86a5
Fix test_py_compile with -O mode (GH-115345) 2024-02-19 19:02:51 +02:00
Serhiy Storchaka 7b25a82e83
Fix test_compile with -O mode (GH-115346) 2024-02-19 19:02:29 +02:00
Pablo Galindo Salgado ecf16ee50e
gh-115154: Fix untokenize handling of unicode named literals (#115171) 2024-02-19 14:54:10 +00:00
Daniel Haag d504968983
gh-115652: Fix indentation in the documentation of multiprocessing.get_start_method (GH-115658) 2024-02-19 14:26:23 +00:00
Victor Stinner aa8c1a0d16
gh-114626: Add again _PyCFunctionFastWithKeywords name (GH-115561)
Keep the old private _PyCFunctionFastWithKeywords name (Python 3.7)
as an alias to the new public name PyCFunctionFastWithKeywords
(Python 3.13a4).

_PyCFunctionWithKeywords doesn't exist in Python 3.13a3, whereas
_PyCFunctionFastWithKeywords was removed in Python 3.13a4.
2024-02-19 13:20:46 +01:00
0xflotus cbe809dfa9
gh-83648: Add missing `deprecated` arg in argparse.rst (GH-115640) 2024-02-19 10:29:32 +02:00
Masayuki Moriyama 1476ac2c58
gh-102388: Add windows_31j to aliases for cp932 codec (#102389)
The charset name "Windows-31J" is registered in the IANA Charset Registry[1]
and is implemented in Python as the cp932 codec.

[1] https://www.iana.org/assignments/charset-reg/windows-31J

Signed-off-by: Masayuki Moriyama <masayuki.moriyama@miraclelinux.com>
2024-02-19 17:01:35 +09:00
Simon A. Eugster 177b9cb52e
Docs: Add explanation about little/big endian (#109841)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-02-18 23:50:09 -08:00