Commit Graph

119644 Commits

Author SHA1 Message Date
AN Long 1a969b4f55
gh-111965: Use critical sections to make io.TextIOWrapper thread safe (gh-112193) 2023-11-19 08:21:04 +09:00
Donghee Na e52cc80f7f
gh-112213: Add @critical_section target directive to Argument Clinic (gh-112232)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-19 08:05:49 +09:00
Barney Gale 607b5e30c6
GH-110109: Test pure functionality of `pathlib.Path` user subclasses (#112242)
Add `PurePathTest` as a superclass of `PathTest`, and therefore also
`PathSubclassTest`. This adds coverage of pure functionality in user
subclasses of `pathlib.Path`.

Remove `PosixPathAsPureTest` and `WindowsPathAsPureTest`, as they
now duplicate `PosixPathTest` and `WindowsPathTest`.

This makes the MROs of test unit classes match the MROs of pathlib
classes.
2023-11-18 17:06:10 +00:00
Barney Gale 9c7c8bacc1
GH-110109: Fix misplaced tests for `pathlib.WindowsPath.owner()` and `group()` (#112239)
Move test methods from `WindowsPathAsPureTest` to `WindowsPathTest` unit.
The former test unit is intended to exercise only pure path functionality.
2023-11-18 15:42:07 +00:00
Serhiy Storchaka 91d1730541
gh-112234: Remove the toplevel parameter in converttuple() (GH-112235)
It is and always was 0.
2023-11-18 13:47:34 +02:00
Donghee Na 0566ab9c4d
gh-111926: Update _weakref to be threadsafe in --disable-gil build (gh-112189) 2023-11-18 16:09:23 +09:00
Guido van Rossum eb3c94ea66
gh-110319: Assert type_version != 0 before using it (#112226)
- Ensure that `assert(type_version != 0);` always comes *before* using `type_version`

Also:
- In cases_generator, rename `-v` to from `--verbose` to `--viable`
2023-11-17 20:58:13 -08:00
Nikita Sobolev 43b1c33204
gh-111810: Fix `test_repr_deep` from `test_userlist` on WASI (#112197)
Co-authored-by: Brett Cannon <brett@python.org>
2023-11-17 16:08:23 -08:00
Brett Cannon f489ace9e7
GH-111808: Make the default value for `test.support.infinite_recursion()` conditional on compiler optimizations (GH-112223)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-11-17 15:52:11 -08:00
Charlie Zhao dabc0d77b2
Fix typo in documentation of `importlib.metadata` (GH-112099)
Fix minor typo in importlib doc
2023-11-17 15:11:30 -08:00
Guido van Rossum da314f7c8d
A few more cases_generator cleanups (#112220) 2023-11-17 22:36:37 +00:00
Victor Stinner cb5048ea0e
gh-112026: Update What's New: _PyObject_Vectorcall() was restored (#112171) 2023-11-17 23:30:42 +01:00
Guido van Rossum 7405745817
Various small improvements to uop debug output (#112218)
- Show uop name in Error/DEOPT messages
- Add target to some messages
- Expose uop_name() as _PyUopName()
2023-11-17 22:25:57 +00:00
Guido van Rossum be0bd54c6b
gh-106529: Cleanups split off gh-112134 (#112214)
- Double max trace size to 256
- Add a dependency on executor_cases.c.h for ceval.o
- Mark `_SPECIALIZE_UNPACK_SEQUENCE` as `TIER_ONE_ONLY`
- Add debug output back showing the optimized trace
- Bunch of cleanups to Tools/cases_generator/
2023-11-17 11:49:42 -08:00
Alex Waygood b414497993
Fix syntax in CODEOWNERS file (#112210) 2023-11-17 18:31:45 +00:00
Nikita Sobolev 949b2cc6ea
gh-112194: Convert more examples to doctests in `typing.py` (#112195)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-17 17:56:31 +00:00
Barney Gale 9fb0f2dfee
GH-110109: Speed up `pathlib._PathBase.resolve()` (#110412)
- Add fast path to `_split_stack()`
- Skip unnecessarily resolution of the current directory when a relative
  path is given to `resolve()`
- Remove stat and target caches, which slow down most `resolve()` calls in
  practice.
- Slightly refactor code for clarity.
2023-11-17 16:58:17 +00:00
Guido van Rossum 25538c72d1
Tweak my interests (and Mark Shannon's :-) in CODEOWNERS (#112206) 2023-11-17 16:44:51 +00:00
Barney Gale 2dbb2e035b
GH-110109: Churn `pathlib.PurePath` methods (#112012)
Re-arrange `pathlib.PurePath` methods in source code. No other changes.

The `PurePath` implementations of certain special methods, such as
`__eq__()` and `__hash__()`, are not usually applicable to user subclasses
of `_PathBase`. To facilitate their removal, another patch will split the
`PurePath` class into `_PurePathBase` and `PurePath`, with the latter
providing these special methods.

This patch prepares the ground for splitting `PurePath`. It's similar to
e8d77b0, which preceded splitting `Path`. By churning the methods here,
subsequent patches will be easier to review and less likely to break
things.
2023-11-17 07:32:50 -08:00
Victor Stinner 7c50800241
gh-110481, doc: Add "immortal" term to the glossary (#112180) 2023-11-17 15:09:19 +01:00
Ori Avtalion fb4cddb0cc
gh-94309: "What's new in Python 3.12": improve deprecation notice for typing.Hashable and typing.Sized (#112196) 2023-11-17 12:30:47 +00:00
Wanderxjtu 0ee2d77331
gh-112070: make `functools.lru_cache` threadsafe in --disable-gil build (gh-112111)
* gh-112070: make `functools.lrucacle` threadsafe in --disable-gil build

* gh-112070: update generate `functoolsmodule` files

* gh-112070: add NEWS file

* Delete Misc/NEWS.d/next/Library/2023-11-15-20-19-45.gh-issue-112070.q6OhcU.rst

* gh-112070: reformat functoolsmodule.c

---------

Co-authored-by: Sam Gross <colesbury@gmail.com>
2023-11-17 14:03:02 +09:00
Terry Jan Reedy 8cd70eefc7
gh-112165: Fix typo in `__main__.py` (#112183)
Change '[2]' to '[1]' to get second argument.
2023-11-16 20:05:16 -05:00
Nikita Sobolev f92ea63f6f
gh-111799: Fix `testRecursiveRepr` from `test_fileio` on WASI (GH-112181) 2023-11-16 15:12:27 -08:00
Victor Stinner ceefa0b079
gh-111482: Fix time_clockid_converter() on AIX (#112170)
clockid_t is defined as long long on AIX.
2023-11-17 00:00:16 +01:00
Nikita Sobolev 974847be44
gh-111800: Fix `test_recursive_repr` from `test_io` under WASI to not recurse so deeply (GH-112150) 2023-11-16 11:47:38 -08:00
Nikita Sobolev 762eb58220
Remove `imp_dummy_def` from `Tools/c-analyzer/cpython/ignored.tsv` (gh-112122)
It was removed in 3.12, no need to keep the ignore.
2023-11-16 12:21:23 -07:00
Sam Gross 446f18a911
gh-111956: Add thread-safe one-time initialization. (gh-111960) 2023-11-16 12:19:54 -07:00
Victor Stinner f66afa395a
gh-111881: Import lazily zipfile in support.script_helper (#112172)
It allows running the test suite when the zlib extension is missing.
2023-11-16 18:57:22 +01:00
Nikita Sobolev 7680da4583
gh-112155: Run `typing.py` doctests as part of `test_typing` (#112156) 2023-11-16 15:40:09 +00:00
Qua27 12c7e9d573
GH-112152: Fix typo in `typing.override` docstring (#112158) 2023-11-16 15:16:04 +00:00
Victor Stinner bd89bca9e2
gh-111798: Use lower Py_C_RECURSION_LIMIT in debug mode (#112124)
* Run again test_ast_recursion_limit() on WASI platform.
* Add _testinternalcapi.get_c_recursion_remaining().
* Fix test_ast and test_sys_settrace: test_ast_recursion_limit() and
  test_trace_unpack_long_sequence() now adjust the maximum recursion
  depth depending on the the remaining C recursion.
2023-11-16 13:52:33 +00:00
Luis Pedro Coelho 81ab0e8a4a
[doc] Make subprocess.wait documentation more precise (#98700)
[doc] Make subprocess.wait doc more precise

An active loop is only used when the `timeout` parameter is used on
POSIX.

When no timeout is used, the code calls `os.waitpid` internally (which puts
the process on a sleep status). On Windows, the internal Windows API
call accepts a timeout parameter, so that is delegated to the OS.
2023-11-16 05:04:46 -08:00
Petr Viktorin 985679f05d
gh-110812: Isolating Extension Modules HOWTO: List GC-related gotchas (GH-111504)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2023-11-16 12:05:44 +01:00
Tomas R a6465605c1
gh-111916: Make hashlib related modules thread-safe without the GIL (#111981)
Always use an individual lock on hash objects when in free-threaded builds.

Fixes #111916
2023-11-15 23:53:38 +00:00
Kushal Das 7218bac8c8
gh-111811: Fix test_recursive_repr for WASI (#112130) 2023-11-15 23:28:58 +01:00
Victor Stinner d9fd33a869
gh-112088: Run autoreconf in GHA check_generated_files (#112090)
The "Check if generated files are up to date" job of GitHub Actions
now runs the "autoreconf -ivf -Werror" command instead of the "make
regen-configure" command to avoid depending on the external quay.io
server.

Add Tools/build/regen-configure.sh script to regenerate the configure
with an Ubuntu container image. The
"quay.io/tiran/cpython_autoconf:271" container image
(https://github.com/tiran/cpython_autoconf) is no longer used.
2023-11-15 21:47:14 +01:00
Victor Stinner 7e2308aaa2
gh-112026: Add again _PyThreadState_UncheckedGet() function (#112121)
Add again the private _PyThreadState_UncheckedGet() function as an
alias to the new public PyThreadState_GetUnchecked() function.
2023-11-15 19:15:03 +01:00
Victor Stinner e5dfcc2b6e
gh-96954: Don't run regen-unicodedata in regen-all (#112120)
The "make regen-unicodedata" should now be run manually. By the
default, it requires an Internet connection, which is not always the
case. Some Linux distributions build Linux packages in isolated
environment (without network).
2023-11-15 18:14:08 +01:00
Victor Stinner bd2f1485b0
gh-112026: Restore removed _PyDict_GetItemStringWithError() (#112119)
Restore the removed _PyDict_GetItemStringWithError() function. It is
used by numpy.
2023-11-15 17:10:06 +00:00
Miro Hrončok ec05507367
gh-96954: Fix `make regen-unicodedata` in out-of-tree builds (#112118)
This avoids:

    python3.13 Tools/unicode/makeunicodedata.py
    python3.13: can't open file '.../build/debug/Tools/unicode/makeunicodedata.py': [Errno 2] No such file or directory
    make: *** [Makefile:1498: regen-unicodedata] Error 2

Re-run `make regen-unicodedata` to update the script path in generated files.
2023-11-15 16:42:17 +00:00
Victor Stinner 58469244be
gh-112026: Restore removed private C API (#112115)
Restore removed private C API functions, macros and structures which
have no simple replacement for now:

* _PyDict_GetItem_KnownHash()
* _PyDict_NewPresized()
* _PyHASH_BITS
* _PyHASH_IMAG
* _PyHASH_INF
* _PyHASH_MODULUS
* _PyHASH_MULTIPLIER
* _PyLong_Copy()
* _PyLong_FromDigits()
* _PyLong_New()
* _PyLong_Sign()
* _PyObject_CallMethodId()
* _PyObject_CallMethodNoArgs()
* _PyObject_CallMethodOneArg()
* _PyObject_CallOneArg()
* _PyObject_EXTRA_INIT
* _PyObject_FastCallDict()
* _PyObject_GetAttrId()
* _PyObject_Vectorcall()
* _PyObject_VectorcallMethod()
* _PyStack_AsDict()
* _PyThread_CurrentFrames()
* _PyUnicodeWriter structure
* _PyUnicodeWriter_Dealloc()
* _PyUnicodeWriter_Finish()
* _PyUnicodeWriter_Init()
* _PyUnicodeWriter_Prepare()
* _PyUnicodeWriter_PrepareKind()
* _PyUnicodeWriter_WriteASCIIString()
* _PyUnicodeWriter_WriteChar()
* _PyUnicodeWriter_WriteLatin1String()
* _PyUnicodeWriter_WriteStr()
* _PyUnicodeWriter_WriteSubstring()
* _PyUnicode_AsString()
* _PyUnicode_FromId()
* _PyVectorcall_Function()
* _Py_HashDouble()
* _Py_HashPointer()
* _Py_IDENTIFIER()
* _Py_c_abs()
* _Py_c_diff()
* _Py_c_neg()
* _Py_c_pow()
* _Py_c_prod()
* _Py_c_quot()
* _Py_c_sum()
* _Py_static_string()
* _Py_static_string_init()
2023-11-15 16:38:31 +00:00
Victor Stinner b338ffa4bc
gh-112026: Add again <unistd.h> include in Python.h (#112046)
Add again <ctype.h> and <unistd.h> includes in Python.h, but don't
include them in the limited C API version 3.13 and newer.
2023-11-15 16:59:32 +01:00
Mark Shannon 4bbb367ba6
GH-111848: Set the IP when de-optimizing (GH-112065)
* Replace jumps with deopts in tier 2

* Fewer special cases of uop names

* Add target field to uop IR

* Remove more redundant SET_IP and _CHECK_VALIDITY micro-ops

* Extend whitelist of non-escaping API functions.
2023-11-15 15:48:58 +00:00
Ryuji Tsutsui 0cfdd6e3d1
Fix typo in perf profiling docs (#112112) 2023-11-15 15:40:19 +00:00
Nikita Sobolev 422c0f0301
gh-108303: Delete `imp_dummy` test file (#112110) 2023-11-15 13:26:49 +01:00
Serhiy Storchaka d4f83e1e3a
gh-111789: Use PyDict_GetItemRef() in Modules/_asynciomodule.c (GH-112072) 2023-11-15 04:28:30 +00:00
Adam Turner 6c214dea7c
Docs: Add the time to the HTML last updated format (#110091) 2023-11-15 04:04:28 +00:00
Radislav Chugunov 4744f59a5e
gh-112062: Make `_struct` module thread-safe in `--disable-gil` builds (#112094)
* gh-112062: Make `_struct` module thread-safe in --disable-gil builds
2023-11-15 09:30:34 +05:30
Victor Stinner 55f3cce821
gh-111545: Test PyHash_GetFuncDef() function (#112098)
Add Modules/_testcapi/hash.c and Lib/test/test_capi/test_hash.py.
2023-11-15 03:41:29 +01:00