Commit Graph

121555 Commits

Author SHA1 Message Date
Laurie O e16062dd34
gh-96471: Correct documentation for asyncio queue shutdown (#117621) 2024-04-08 14:50:54 +00:00
Sam Gross 26a680a585
gh-117293: Fix race condition in run_workers.py (#117298)
The worker thread may still be alive after it enqueues it's last result,
which can lead to a delay of 30 seconds after the test finishes. This
happens much more frequently in the free-threaded build with the GIL
disabled.

This changes run_workers.py to track of live workers by enqueueing a
`WorkerExited()` instance before the worker exits.
2024-04-08 10:47:42 -04:00
Sam Gross 59864edd57
gh-117552: Add timeout in HTTPHandlerTest (#117553) 2024-04-08 10:46:56 -04:00
Erlend E. Aasland ca62ffd1a5
gh-116303: Skip tests if C recursion limit is unavailable (GH-117368)
The test suite fetches the C recursion limit from the _testcapi
extension module. Test extension modules can be disabled using the
--disable-test-modules configure option.
2024-04-08 14:45:25 +02:00
Victor Stinner 9a12f5d1c1
gh-106023: Update What's New in 3.13: _PyObject_FastCall() (#117633)
The function _PyObject_FastCall() was restored.
2024-04-08 12:19:43 +00:00
Nikita Sobolev a7702663e3
gh-111726: Explicitly close database connections in sqlite3 doctests (#111730)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-04-08 09:29:47 +00:00
Erlend E. Aasland e338e1a4ec
gh-111726: Remove some doctests from sqlite3 docs (#117623)
* remove load extension doctest since we cannot skip it conditionally
* remove sys.unraisablehook example; using unraisable hooks is not "an
  improved debug experience"
2024-04-08 08:11:08 +00:00
Victor Stinner e1eeb990bd
gh-113317: Remove unused INVALID constant in Argument Clinic (#117624) 2024-04-08 09:51:20 +02:00
Hugo van Kemenade a453f5ef9d
gh-111726: Cleanup test files after running sqlite3 doctest (#117604)
Remove all temporary databases in a dedicated 'testcleanup' step
at the end of the file.
2024-04-08 08:35:48 +02:00
Donghee Na 784623c63c
gh-117594: Require cpu resource to test_search_anchor_at_beginning (gh-117595) 2024-04-07 23:58:19 +00:00
Anita Hammer fd3679025d
Fix reference in code.rst (#117615)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-04-07 22:58:57 +00:00
Ken Jin 375425abd1
Cases generator: Remove type_prop and passthrough (#117614) 2024-04-08 06:26:52 +08:00
Nice Zombies 733e56ef96
gh-117584: Raise TypeError for non-paths in posixpath.relpath() (GH-117585) 2024-04-07 12:00:08 +03:00
Brandt Bucher 62aeb0ee69
GH-117512: Allow 64-bit JIT operands on 32-bit platforms (GH-117527) 2024-04-06 08:26:43 -07:00
Laurie O df4d84c3cd
gh-96471: Add asyncio queue shutdown (#104228)
Co-authored-by: Duprat <yduprat@gmail.com>
2024-04-06 07:27:13 -07:00
Malcolm Smith 1d3225ae05
gh-116622: Test updates for Android (#117299)
- re-enable test_fcntl_64_bit on Linux aarch64, but disable it on all
  Android ABIs
- use support.setswitchinterval in all relevant tests
- skip test_fma_zero_result on Android x86_64
- accept EACCES when calling os.get_terminal_size on Android
2024-04-05 20:57:36 +00:00
Barney Gale 6150bb2412
GH-77609: Add recurse_symlinks argument to `pathlib.Path.glob()` (#117311)
Replace tri-state `follow_symlinks` with boolean `recurse_symlinks` argument. The new argument controls whether symlinks are followed when expanding recursive `**` wildcards. The possible argument values correspond as follows:

    follow_symlinks  recurse_symlinks
    ===============  ================
    False            N/A
    None             False
    True             True

We therefore drop support for not following symlinks when expanding non-recursive pattern parts; it wasn't requested in the original issue, and it's a feature not found in any shells.

This makes the API a easier to grok by eliminating `None` as an option.

No news blurb as `follow_symlinks` was new in 3.13.
2024-04-05 18:51:54 +00:00
Petr Viktorin 4d4a6f1b6a
gh-116608: Ignore UTF-16 BOM in importlib.resources._functional tests (GH-117569)
gh-116609: Ignore UTF-16 BOM in importlib.resources._functional tests

To test the `errors` argument, we read a UTF-16 file as UTF-8
with "backslashreplace" error handling. However, the utf-16
codec adds an endian-specific byte-order mark, so on big-endian
machines the expectation doesn't match the test file (which was
saved on a little-endian machine).

Use endswith to ignore the BOM.
2024-04-05 17:00:29 +02:00
Steve Dower 687616877b
gh-111140: PyLong_From/AsNativeBytes: Take *flags* rather than just *endianness* (GH-116053) 2024-04-05 16:21:16 +02:00
Barney Gale abfa16b44b
GH-114847: Speed up `posixpath.realpath()` (#114848)
Apply the following optimizations to `posixpath.realpath()`:

- Remove use of recursion
- Construct child paths directly rather than using `join()`
- Use `os.getcwd[b]()` rather than `abspath()`
- Use `startswith(sep)` rather than `isabs()`
- Use slicing rather than `split()`

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-04-05 12:35:01 +00:00
Petr Viktorin 9ceaee74db
gh-116608: importlib.resources: Un-deprecate functional API & add subdirectory support (GH-116609) 2024-04-05 13:55:59 +02:00
Erlend E. Aasland 757b62493b
gh-117457: Regen executor cases post PR #117477 (#117559) 2024-04-05 10:13:00 +00:00
Erlend E. Aasland 9c1dfe21fd
gh-116303: Don't build xxlimited and xxlimited_35 if --disable-test-modules is given (#117554) 2024-04-05 10:29:15 +02:00
Michael Droettboom 0edde64a41
GH-117457: Correct pystats uop "miss" counts (GH-117477) 2024-04-04 15:49:18 -07:00
Michael Droettboom b5e60918af
gh-117549: Match declaration order for _Py_BackoffCounter initializer (#117551)
Otherwise it might not compile with C++ (or certain C compilers/flags?).
2024-04-04 14:14:35 -07:00
Sam Gross 63998a1347
gh-117474: Skip GIL test in free-threaded build (#117475)
In the free-threaded build, the GIL will typically be disabled so
`py-bt` will not show threads waiting on the GIL.
2024-04-04 16:27:14 -04:00
Dino Viehland 434bc593df
gh-112075: Make _PyDict_LoadGlobal thread safe (#117529)
Make _PyDict_LoadGlobal threadsafe
2024-04-04 12:26:07 -07:00
Sam Gross 42205143f8
gh-117478: Add `@support.requires_gil_enabled` decorator (#117479)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-04-04 14:10:46 -04:00
Sam Gross de5ca0bf71
gh-117435: Make `SemLock` thread-safe in free-threaded build (#117436)
Use critical sections to make acquire, release, and _count thread-safe
without the GIL.
2024-04-04 14:09:38 -04:00
Irit Katriel 04697bcfaf
gh-117494: extract the Instruction Sequence data structure into a separate file (#117496) 2024-04-04 15:47:26 +00:00
Guido van Rossum 060a96f1a9
gh-116968: Reimplement Tier 2 counters (#117144)
Introduce a unified 16-bit backoff counter type (``_Py_BackoffCounter``),
shared between the Tier 1 adaptive specializer and the Tier 2 optimizer. The
API used for adaptive specialization counters is changed but the behavior is
(supposed to be) identical.

The behavior of the Tier 2 counters is changed:
- There are no longer dynamic thresholds (we never varied these).
- All counters now use the same exponential backoff.
- The counter for ``JUMP_BACKWARD`` starts counting down from 16.
- The ``temperature`` in side exits starts counting down from 64.
2024-04-04 15:03:27 +00:00
Sergey B Kirpichev 63bbe77d9b
gh-109802: Add coverage test for complex_abs() (GH-117449)
* gh-109802: Add coverage test for complex_abs()

This tests overflow on L594.

// line numbers wrt to 0f2fa6150b
2024-04-04 14:54:17 +00:00
Vinay Sajip df912c913a
[doc] Update logging documentation to improve grammar and elucidate an example. (GH-117541) 2024-04-04 13:14:44 +01:00
Jelle Zijlstra b32789ccb9
gh-117521: Improve typing.TypeGuard docstring (#117522) 2024-04-04 06:39:16 -04:00
Tony Mountifield 3f5bcc86d0
gh-117467: Add preserving of mailbox owner on flush (GH-117510)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-04-04 13:32:53 +03:00
Victor Stinner dc54714044
gh-113317: Finish splitting Argument Clinic into sub-files (#117513)
Add libclinic.parser module and move the following classes and
functions there:

* Parser
* PythonParser
* create_parser_namespace()

Add libclinic.dsl_parser module and move the following classes,
functions and variables there:

* ConverterArgs
* DSLParser
* FunctionNames
* IndentStack
* ParamState
* StateKeeper
* eval_ast_expr()
* unsupported_special_methods

Add libclinic.app module and move the Clinic class there.

Add libclinic.cli module and move the following functions there:

* create_cli()
* main()
* parse_file()
* run_clinic()
2024-04-04 11:09:40 +02:00
rsp4jack 85843348c5
gh-117459: Keep the traceback in _convert_future_exc (#117460) 2024-04-03 20:13:32 -07:00
Shantanu b4fe02f595
gh-117205: Increase chunksize when compiling pyc in parallel (#117206) 2024-04-03 15:24:24 -07:00
Steve Dower 985917dc8d
gh-117267: Ensure DirEntry.stat().st_ctime still contains creation time during deprecation period (GH-117354) 2024-04-03 23:14:55 +01:00
Victor Stinner 2057c92125
gh-114329: Fix PyList_GetItemRef() limited C API definition (#117520) 2024-04-03 21:02:42 +00:00
Victor Stinner c43f6a4dfa
gh-113317: Argument Clinic: Add libclinic.clanguage (#117455)
Add libclinic.clanguage module and move the following classes and
functions there:

* CLanguage
* declare_parser()

Add libclinic.codegen and move the following classes there:

* BlockPrinter
* BufferSeries
* Destination

Move the following functions to libclinic.function:

* permute_left_option_groups()
* permute_optional_groups()
* permute_right_option_groups()
2024-04-03 18:17:51 +00:00
Peter Lazorchak 1c43468886
gh-116168: Remove extra `_CHECK_STACK_SPACE` uops (#117242)
This merges all `_CHECK_STACK_SPACE` uops in a trace into a single `_CHECK_STACK_SPACE_OPERAND` uop that checks whether there is enough stack space for all calls included in the entire trace.
2024-04-03 17:14:18 +00:00
Eric Snow 976bcb2379
gh-76785: Raise InterpreterError, Not RuntimeError (gh-117489)
I had meant to switch everything to InterpreterError when I added it a while back.  At the time I missed a few key spots.

As part of this, I've added print-the-exception to _PyXI_InitTypes() and fixed an error case in `_PyStaticType_InitBuiltin().
2024-04-03 10:58:39 -06:00
Erlend E. Aasland 7ecd55d604
gh-117431: Adapt str.find and friends to Argument Clinic (#117468)
This change gives a significant speedup, as the METH_FASTCALL calling
convention is now used. The following methods are adapted:

- str.count
- str.find
- str.index
- str.rfind
- str.rindex
2024-04-03 17:59:18 +02:00
Barney Gale 345194de8c
GH-114847: Raise FileNotFoundError when getcwd() returns '(unreachable)' (#117481)
On Linux >= 2.6.36 with glibc < 2.27, `getcwd()` can return a relative
pathname starting with '(unreachable)'. We detect this and fail with
ENOENT, matching new glibc behaviour.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-04-03 16:39:40 +01:00
Raymond Hettinger 03f7aaf953
gh-117215 Make the fromskey() signature match dict.fromkeys(). (gh-117493) 2024-04-03 10:08:18 -05:00
Zackery Spytz fc5f68e58e
gh-59215: unittest: restore _top_level_dir at end of discovery (GH-15242) 2024-04-03 16:17:13 +02:00
Erlend E. Aasland ea94b3b149
gh-116303: Skip test module dependent tests if test modules are unavailable (#117341) 2024-04-03 15:11:36 +02:00
Nice Zombies 2ec6bb4111
gh-117381: Improve error messages for ntpath.commonpath() (GH-117382) 2024-04-03 16:10:09 +03:00
Sam Gross a214f55b27
gh-117483: Accept "Broken pipe" as valid error message in `test_wrong_cert_tls13` (GH-117484)
On macOS, the closed connection can lead to a "Broken pipe" error instead of
a "Connection reset by peer" error.
2024-04-03 14:29:02 +02:00