]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-105373: Doc lists pending removals (#106540)
Victor Stinner [Sun, 9 Jul 2023 15:26:26 +0000 (17:26 +0200)] 
gh-105373: Doc lists pending removals (#106540)

2 years agogh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304)
Serhiy Storchaka [Sun, 9 Jul 2023 12:27:03 +0000 (15:27 +0300)] 
gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304)

It simplifies and speed up the code.

2 years agogh-104469: Convert_testcapi/vectorcall.c to use AC (gh-106557)
littlebutt's workshop [Sun, 9 Jul 2023 12:08:18 +0000 (12:08 +0000)] 
gh-104469: Convert_testcapi/vectorcall.c to use AC (gh-106557)

2 years agoMove implementation specific RE tests to separate class (GH-106563)
Serhiy Storchaka [Sun, 9 Jul 2023 09:48:36 +0000 (12:48 +0300)] 
Move implementation specific RE tests to separate class (GH-106563)

2 years agogh-105376: Remove logging.warn() and LoggerAdapter.warn() (#106553)
Victor Stinner [Sun, 9 Jul 2023 08:32:50 +0000 (10:32 +0200)] 
gh-105376: Remove logging.warn() and LoggerAdapter.warn() (#106553)

2 years agogh-106535: Soft deprecate the getopt module (#105735)
Victor Stinner [Sat, 8 Jul 2023 15:51:45 +0000 (17:51 +0200)] 
gh-106535: Soft deprecate the getopt module (#105735)

The getopt module exists since the initial revision of the Python
source code (1990). The optparse module was added to Python 2.3. When
Python 2.7 added the 3rd argparse module, the optparse module was
soft deprecated. Soft deprecate the getopt module.

2 years agogh-106508: Improve debugging of the _sre module (GH-106509)
Serhiy Storchaka [Sat, 8 Jul 2023 15:00:39 +0000 (18:00 +0300)] 
gh-106508: Improve debugging of the _sre module (GH-106509)

Now the VERBOSE macro can control tracing on per-pattern basis:

* 0 -- disabled
* 1 -- only if the DEBUG flag set
* 2 -- always

2 years agogh-106510: Fix DEBUG output for atomic group (GH-106511)
Serhiy Storchaka [Sat, 8 Jul 2023 11:31:25 +0000 (14:31 +0300)] 
gh-106510: Fix DEBUG output for atomic group (GH-106511)

2 years agogh-101880: add link to object.__hash__() in hash() builtin documentation (#101883)
Owain Davies [Sat, 8 Jul 2023 08:48:33 +0000 (15:48 +0700)] 
gh-101880: add link to object.__hash__() in hash() builtin documentation (#101883)

2 years agogh-105873: Make `_xxsubinterpreters` use exception type name in shared exception...
Radislav Chugunov [Sat, 8 Jul 2023 08:44:50 +0000 (11:44 +0300)] 
gh-105873: Make `_xxsubinterpreters` use exception type name in shared exception (#105874)

2 years agogh-106524: Fix a crash in _sre.template() (GH-106525)
Radislav Chugunov [Sat, 8 Jul 2023 07:47:01 +0000 (10:47 +0300)] 
gh-106524: Fix a crash in _sre.template() (GH-106525)

Some items remained uninitialized if _sre.template() was called with invalid
indices. Then attempt to clear them in the destructor led to dereferencing
of uninitialized pointer.

2 years agogh-106078: Move static objects related to `CONTEXTVAR` to the decimal module global...
Charlie Zhao [Sat, 8 Jul 2023 07:44:24 +0000 (15:44 +0800)] 
gh-106078: Move static objects related to `CONTEXTVAR` to the decimal module global state (#106395)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2 years agoRestore previous behavior of 'make regen-cases' (#106541)
Guido van Rossum [Sat, 8 Jul 2023 04:50:09 +0000 (21:50 -0700)] 
Restore previous behavior of 'make regen-cases' (#106541)

When running 'make regen-cases' just to check whether anything changed,
it's annoying that even if nothing changes, the output files are touched,
causing an expensiv rebuild of _bootstrap_python and anything it creates.

So use  consistently for all output files.

2 years agogh-105373: Remove C API global config vars in Python 3.14 (#106538)
Victor Stinner [Fri, 7 Jul 2023 23:49:20 +0000 (01:49 +0200)] 
gh-105373: Remove C API global config vars in Python 3.14 (#106538)

Schedule the removal of C API global configuration variables in
Python 3.14. Announce the removal to help C extension maintainers to
upgrade their code.

2 years agogh-105373: Doc lists pending C API removals (#106537)
Victor Stinner [Fri, 7 Jul 2023 22:50:51 +0000 (00:50 +0200)] 
gh-105373: Doc lists pending C API removals (#106537)

2 years agogh-106535: Document PEP 387 Soft Deprecation (#106536)
Victor Stinner [Fri, 7 Jul 2023 22:03:51 +0000 (00:03 +0200)] 
gh-106535: Document PEP 387 Soft Deprecation (#106536)

Mark the optparse module as soft deprecated.

2 years agogh-103200: Fix performance issues with `zipimport.invalidate_caches()` (GH-103208)
Desmond Cheong [Fri, 7 Jul 2023 22:02:13 +0000 (15:02 -0700)] 
gh-103200: Fix performance issues with `zipimport.invalidate_caches()` (GH-103208)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2 years agogh-106300: Improve `assertRaises(Exception)` usages in tests (GH-106302)
Nikita Sobolev [Fri, 7 Jul 2023 20:42:40 +0000 (23:42 +0300)] 
gh-106300: Improve `assertRaises(Exception)` usages in tests (GH-106302)

2 years agogh-104584: Replace ENTER_EXECUTOR with the original in trace projection (#106526)
Guido van Rossum [Fri, 7 Jul 2023 18:41:42 +0000 (11:41 -0700)] 
gh-104584: Replace ENTER_EXECUTOR with the original in trace projection (#106526)

2 years agoDelete dead ceval code. (gh-106486)
Benjamin Peterson [Fri, 7 Jul 2023 18:16:19 +0000 (13:16 -0500)] 
Delete dead ceval code. (gh-106486)

2 years agogh-104584: Allow unspecialized instructions in superblocks (#106497)
Guido van Rossum [Fri, 7 Jul 2023 18:03:27 +0000 (11:03 -0700)] 
gh-104584: Allow unspecialized instructions in superblocks (#106497)

This adds several of unspecialized opcodes to superblocks:

TO_BOOL, BINARY_SUBSCR, STORE_SUBSCR,
UNPACK_SEQUENCE, LOAD_GLOBAL, LOAD_ATTR,
COMPARE_OP, BINARY_OP.

While we may not want that eventually, for now this helps finding bugs.

There is a rudimentary test checking for UNPACK_SEQUENCE.

Once we're ready to undo this, that would be simple:
just replace the call to variable_used_unspecialized
with a call to variable_used (as shown in a comment).
Or add individual opcdes to FORBIDDEN_NAMES_IN_UOPS.

2 years agogh-104584: Move super-instruction special-casing to generator (#106500)
Guido van Rossum [Fri, 7 Jul 2023 17:42:10 +0000 (10:42 -0700)] 
gh-104584: Move super-instruction special-casing to generator (#106500)

Instead of special-casing specific instructions,
we add a few more special values to the 'size' field of expansions,
so in the future we can automatically handle
additional super-instructions in the generator.

2 years agogh-104683: clinic.py: refactor `Parameter` and `Function` as dataclasses (#106477)
Alex Waygood [Fri, 7 Jul 2023 13:10:07 +0000 (14:10 +0100)] 
gh-104683: clinic.py: refactor `Parameter` and `Function` as dataclasses (#106477)

2 years agogh-106503: asyncio._SelectorSocketTransport: fix cyclic reference on close(). (#106504)
Andrew Geng [Fri, 7 Jul 2023 11:41:54 +0000 (07:41 -0400)] 
gh-106503: asyncio._SelectorSocketTransport: fix cyclic reference on close(). (#106504)

2 years agoGH-106057: Handle recursion errors in inline class calls properly. (GH-106108)
Mark Shannon [Fri, 7 Jul 2023 10:09:26 +0000 (11:09 +0100)] 
GH-106057: Handle recursion errors in inline class calls properly. (GH-106108)

2 years ago gh-104584: Handle EXTENDED_ARG in superblock creation (#106489)
Guido van Rossum [Thu, 6 Jul 2023 23:46:06 +0000 (16:46 -0700)] 
 gh-104584: Handle EXTENDED_ARG in superblock creation (#106489)

With test.

2 years agogh-90876: Restore the ability to import multiprocessing when `sys.executable` is...
Gregory P. Smith [Thu, 6 Jul 2023 22:46:50 +0000 (15:46 -0700)] 
gh-90876: Restore the ability to import multiprocessing when `sys.executable` is `None` (#106464)

Prevent `multiprocessing.spawn` from failing to *import* in environments
where `sys.executable` is `None`.  This regressed in 3.11 with the addition
of support for path-like objects in multiprocessing.

Adds a test decorator to have tests only run when part of test_multiprocessing_spawn to `_test_multiprocessing.py` so we can start to avoid re-running the same not-global-state specific test in all 3 modes when there is no need.

2 years agogh-104584: Clean up and fix uops tests and fix crash (#106492)
Guido van Rossum [Thu, 6 Jul 2023 22:45:56 +0000 (15:45 -0700)] 
gh-104584: Clean up and fix uops tests and fix crash (#106492)

The uops test wasn't testing anything by default,
and was failing when run with -Xuops.

Made the two executor-related context managers global,
so TestUops can use them (notably `with temporary_optimizer(opt)`).

Made clear_executor() a little more thorough.

Fixed a crash upon finalizing a uop optimizer,
by adding a `tp_dealloc` handler.

2 years agocloses gh-106479: fix typo in __cplusplus macro (gh-106480)
Dustin Rodrigues [Thu, 6 Jul 2023 22:34:00 +0000 (18:34 -0400)] 
closes gh-106479: fix typo in __cplusplus macro (gh-106480)

2 years agogh-104683: clinic.py: refactor four simple classes as dataclasses (#106476)
Alex Waygood [Thu, 6 Jul 2023 21:17:12 +0000 (22:17 +0100)] 
gh-104683: clinic.py: refactor four simple classes as dataclasses (#106476)

2 years agogh-104584: Fix error handling from backedge optimization (#106484)
Guido van Rossum [Thu, 6 Jul 2023 18:39:53 +0000 (11:39 -0700)] 
gh-104584: Fix error handling from backedge optimization (#106484)

When `_PyOptimizer_BackEdge` returns `NULL`, we should restore `next_instr` (and `stack_pointer`). To accomplish this we should jump to `resume_with_error` instead of just `error`.

The problem this causes is subtle -- the only repro I have is in PR gh-106393, at commit d7df54b139bcc47f5ea094bfaa9824f79bc45adc. But the fix is real (as shown later in that PR).

While we're at it, also improve the debug output: the offsets at which traces are identified are now measured in bytes, and always show the start offset. This makes it easier to correlate executor calls with optimizer calls, and either with `dis` output.

<!-- gh-issue-number: gh-104584 -->
* Issue: gh-104584
<!-- /gh-issue-number -->

2 years agogh-106458: Mark `testthreadingmock.py` with `@requires_working_threading` (GH-106366)
Mario Corchero [Thu, 6 Jul 2023 17:54:45 +0000 (19:54 +0200)] 
gh-106458: Mark `testthreadingmock.py` with `@requires_working_threading` (GH-106366)

Mark `testthreadingmock.py` with `threading_helper.requires_working_threading`.

Also add longer delays to reduce the change of a race conditions on the tests that validate short timeouts.

2 years agoIntroduce a gate/check GHA job (#97533)
Sviatoslav Sydorenko [Thu, 6 Jul 2023 15:06:18 +0000 (17:06 +0200)] 
Introduce a gate/check GHA job (#97533)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-104683: clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout` ...
Alex Waygood [Thu, 6 Jul 2023 13:23:02 +0000 (14:23 +0100)] 
gh-104683: clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout` (#106478)

clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout`

2 years agogh-106238: Handle KeyboardInterrupt during logging._acquireLock() (GH-106239)
Ariel Eizenberg [Thu, 6 Jul 2023 07:02:22 +0000 (10:02 +0300)] 
gh-106238: Handle KeyboardInterrupt during logging._acquireLock() (GH-106239)

Co-authored-by: Ariel Eizenberg <ariel.eizenberg@pagaya.com>
2 years agoDoc: Add missing ref labels to exception groups/notes sections (#106465)
C.A.M. Gerlach [Thu, 6 Jul 2023 05:41:04 +0000 (00:41 -0500)] 
Doc: Add missing ref labels to exception groups/notes sections (#106465)

2 years agogh-105256: What's New note for comprehension over locals() (#106378)
Carl Meyer [Thu, 6 Jul 2023 00:12:21 +0000 (18:12 -0600)] 
gh-105256: What's New note for comprehension over locals() (#106378)

2 years agogh-105340: include hidden fast-locals in locals() (#105715)
Carl Meyer [Wed, 5 Jul 2023 23:05:02 +0000 (17:05 -0600)] 
gh-105340: include hidden fast-locals in locals() (#105715)

* gh-105340: include hidden fast-locals in locals()

2 years agogh-106292: restore checking __dict__ in cached_property.__get__ (#106380)
Carl Meyer [Wed, 5 Jul 2023 23:01:35 +0000 (17:01 -0600)] 
gh-106292: restore checking __dict__ in cached_property.__get__ (#106380)

* gh-106292: restore checking __dict__ in cached_property.__get__

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2 years agogh-96844: Improve error message of list.remove (gh-106455)
Dong-hee Na [Wed, 5 Jul 2023 22:19:49 +0000 (07:19 +0900)] 
gh-96844: Improve error message of list.remove (gh-106455)

2 years agoshlex docs: remove outdated note (#106463)
Jelle Zijlstra [Wed, 5 Jul 2023 20:38:53 +0000 (13:38 -0700)] 
shlex docs: remove outdated note (#106463)

As the versionchanged notice says, this note is no longer true on 3.12+.

2 years agogh-102542 Remove unused bytes object and bytes slicing (#106433)
JosephSBoyle [Wed, 5 Jul 2023 16:17:37 +0000 (17:17 +0100)] 
gh-102542 Remove unused bytes object and bytes slicing (#106433)

Remove unused bytes object and bytes slicing

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agoClarify state of CancelledError in doc (#106453)
Kristján Valur Jónsson [Wed, 5 Jul 2023 15:07:02 +0000 (15:07 +0000)] 
Clarify state of CancelledError in doc (#106453)

This change makes it explicit that asyncio.CancelledError is not a subclass of Exception.

2 years agogh-64595: Fix regression in file write logic in Argument Clinic (#106449)
Erlend E. Aasland [Wed, 5 Jul 2023 11:23:22 +0000 (13:23 +0200)] 
gh-64595: Fix regression in file write logic in Argument Clinic (#106449)

Revert the two commits that introduced the regressions:

 - gh-104152
 - gh-104507

2 years agogh-104683: Rename Lib/test/clinic.test as Lib/test/clinic.test.c (#106443)
Erlend E. Aasland [Wed, 5 Jul 2023 08:33:05 +0000 (10:33 +0200)] 
gh-104683: Rename Lib/test/clinic.test as Lib/test/clinic.test.c (#106443)

2 years agotp_flags docs: fix indentation (#106420)
Jelle Zijlstra [Wed, 5 Jul 2023 05:08:25 +0000 (22:08 -0700)] 
tp_flags docs: fix indentation (#106420)

2 years agogh-104050: Partially annotate Argument Clinic CLanguage class (#106437)
Erlend E. Aasland [Tue, 4 Jul 2023 23:07:57 +0000 (01:07 +0200)] 
gh-104050: Partially annotate Argument Clinic CLanguage class (#106437)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-106368: Add tests for formatting helpers in Argument Clinic (#106415)
Erlend E. Aasland [Tue, 4 Jul 2023 22:35:57 +0000 (00:35 +0200)] 
gh-106368: Add tests for formatting helpers in Argument Clinic (#106415)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104050: Annotate Argument Clinic parameter permutation helpers (#106431)
Erlend E. Aasland [Tue, 4 Jul 2023 22:15:10 +0000 (00:15 +0200)] 
gh-104050: Annotate Argument Clinic parameter permutation helpers (#106431)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104050: Annotate toplevel functions in clinic.py (#106435)
Erlend E. Aasland [Tue, 4 Jul 2023 22:13:30 +0000 (00:13 +0200)] 
gh-104050: Annotate toplevel functions in clinic.py (#106435)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-106320: Fix specialize.c compilation by including pycore_pylifecycle.h (#106434)
Guido van Rossum [Tue, 4 Jul 2023 21:42:12 +0000 (14:42 -0700)] 
gh-106320: Fix specialize.c compilation by including pycore_pylifecycle.h (#106434)

Compilation of Python/specialize.c was broken on macOS for me by gh-106400.

2 years agoAdd some codeowners for `Tools/clinic/` (#106430)
Alex Waygood [Tue, 4 Jul 2023 19:45:32 +0000 (20:45 +0100)] 
Add some codeowners for `Tools/clinic/` (#106430)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-106217: Truncate the issue body size of `new-bugs-announce-notifier` (#106423)
Nikita Sobolev [Tue, 4 Jul 2023 18:20:00 +0000 (21:20 +0300)] 
gh-106217: Truncate the issue body size of `new-bugs-announce-notifier` (#106423)

2 years agogh-61215: Rename `wait_until_any_call` to `wait_until_any_call_with` (#106414)
Mario Corchero [Tue, 4 Jul 2023 17:34:43 +0000 (19:34 +0200)] 
gh-61215: Rename `wait_until_any_call` to `wait_until_any_call_with` (#106414)

mock: Rename `wait_until_any_call` to `wait_until_any_call_with`

Rename the method to be more explicit that it expects the args and
kwargs to wait for.

2 years agogh-106162: array: suppress warning in test_array (#106404)
Inada Naoki [Tue, 4 Jul 2023 17:02:49 +0000 (02:02 +0900)] 
gh-106162: array: suppress warning in test_array (#106404)

array: suppress warning in test_array

2 years agogh-106320: Remove _PyInterpreterState_HasFeature() (#106425)
Victor Stinner [Tue, 4 Jul 2023 16:55:45 +0000 (18:55 +0200)] 
gh-106320: Remove _PyInterpreterState_HasFeature() (#106425)

Remove the _PyInterpreterState_HasFeature() function from the C API:
move it to the internal C API (pycore_interp.h). No longer export
the function.

2 years agoGH-106360: Support very basic superblock introspection (#106422)
Mark Shannon [Tue, 4 Jul 2023 16:23:00 +0000 (17:23 +0100)] 
GH-106360: Support very basic superblock introspection (#106422)

* Add len() and indexing support to uop superblocks.

2 years agogh-106406: Fix _Py_IsInterpreterFinalizing() in _winapi.c (#106408)
Nikita Sobolev [Tue, 4 Jul 2023 14:19:20 +0000 (17:19 +0300)] 
gh-106406: Fix _Py_IsInterpreterFinalizing() in _winapi.c (#106408)

2 years agogh-106396: Special-case empty format spec to gen empty JoinedStr node (#106401)
Lysandros Nikolaou [Tue, 4 Jul 2023 12:19:08 +0000 (14:19 +0200)] 
gh-106396: Special-case empty format spec to gen empty JoinedStr node (#106401)

2 years agogh-106368: Add tests for permutation helpers in Argument Clinic (#106407)
Erlend E. Aasland [Tue, 4 Jul 2023 11:36:40 +0000 (13:36 +0200)] 
gh-106368: Add tests for permutation helpers in Argument Clinic (#106407)

Added new test class PermutationTests()

2 years agoGH-106008: Fix refleak when peepholing `None` comparisons (#106367)
Brandt Bucher [Tue, 4 Jul 2023 10:03:57 +0000 (03:03 -0700)] 
GH-106008: Fix refleak when peepholing `None` comparisons (#106367)

2 years agogh-106320: Remove private pylifecycle.h functions (#106400)
Victor Stinner [Tue, 4 Jul 2023 09:41:43 +0000 (11:41 +0200)] 
gh-106320: Remove private pylifecycle.h functions (#106400)

Remove private pylifecycle.h functions: move them to the internal C
API ( pycore_atexit.h, pycore_pylifecycle.h and pycore_signal.h). No
longer export most of these functions.

Move _testcapi.test_atexit() to _testinternalcapi.

2 years agogh-106320: Remove _PyUnicode_TransformDecimalAndSpaceToASCII() (#106398)
Victor Stinner [Tue, 4 Jul 2023 08:59:09 +0000 (10:59 +0200)] 
gh-106320: Remove _PyUnicode_TransformDecimalAndSpaceToASCII() (#106398)

Remove private _PyUnicode_TransformDecimalAndSpaceToASCII() and other
private _PyUnicode C API functions: move them to the internal C API
(pycore_unicodeobject.h). No longer most of these functions.

Replace _testcapi.unicode_transformdecimalandspacetoascii() with
_testinternal._PyUnicode_TransformDecimalAndSpaceToASCII().

2 years agogh-106320: Remove _PyBytesWriter C API (#106399)
Victor Stinner [Tue, 4 Jul 2023 08:27:23 +0000 (10:27 +0200)] 
gh-106320: Remove _PyBytesWriter C API (#106399)

Remove the _PyBytesWriter C API: move it to the internal C API
(pycore_bytesobject.h).

2 years agogh-106320: Remove private _PyUnicode codecs C API functions (#106385)
Victor Stinner [Tue, 4 Jul 2023 07:29:52 +0000 (09:29 +0200)] 
gh-106320: Remove private _PyUnicode codecs C API functions (#106385)

Remove private _PyUnicode codecs C API functions: move them to the
internal C API (pycore_unicodeobject.h). No longer export most of
these functions.

2 years agogh-106368: Increase Argument Clinic test coverage (#106389)
Erlend E. Aasland [Mon, 3 Jul 2023 23:58:27 +0000 (01:58 +0200)] 
gh-106368: Increase Argument Clinic test coverage (#106389)

Add:

- test_disallowed_gropuing__no_matching_bracket
- test_double_slash

2 years agogh-106320: Fix _PyImport_GetModuleAttr() declaration (#106386)
Victor Stinner [Mon, 3 Jul 2023 23:37:48 +0000 (01:37 +0200)] 
gh-106320: Fix _PyImport_GetModuleAttr() declaration (#106386)

Replace PyAPI_DATA() with PyAPI_FUNC().

2 years agogh-106368: Harden Argument Clinic parser tests (#106384)
Erlend E. Aasland [Mon, 3 Jul 2023 23:10:47 +0000 (01:10 +0200)] 
gh-106368: Harden Argument Clinic parser tests (#106384)

2 years agogh-106320: Remove private _PyImport C API functions (#106383)
Victor Stinner [Mon, 3 Jul 2023 23:02:07 +0000 (01:02 +0200)] 
gh-106320: Remove private _PyImport C API functions (#106383)

* Remove private _PyImport C API functions: move them to the internal
  C API (pycore_import.h).
* No longer export most of these private functions.
* _testcapi avoids private _PyImport_GetModuleAttrString().

2 years agogh-86085: Remove _PyCodec_Forget() declaration (#106377)
Victor Stinner [Mon, 3 Jul 2023 22:52:27 +0000 (00:52 +0200)] 
gh-86085: Remove _PyCodec_Forget() declaration (#106377)

The code was already removed by:
commit c9f696cb96d1c362d5cad871f61da520572d9b08.

2 years agogh-106320: Remove more private _PyUnicode C API functions (#106382)
Victor Stinner [Mon, 3 Jul 2023 22:35:46 +0000 (00:35 +0200)] 
gh-106320: Remove more private _PyUnicode C API functions (#106382)

Remove more private _PyUnicode C API functions:
move them to the internal C API (pycore_unicodeobject.h).

No longer export most pycore_unicodeobject.h functions.

2 years agogh-104050: Annotate more Argument Clinic DSLParser state methods (#106376)
Erlend E. Aasland [Mon, 3 Jul 2023 22:10:46 +0000 (00:10 +0200)] 
gh-104050: Annotate more Argument Clinic DSLParser state methods (#106376)

Annotate the following methods:

- state_parameter()
- state_parameter_docstring_start()

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-106368: Clean up Argument Clinic tests (#106373)
Erlend E. Aasland [Mon, 3 Jul 2023 21:57:20 +0000 (23:57 +0200)] 
gh-106368: Clean up Argument Clinic tests (#106373)

2 years agogh-104683: Modernise Argument Clinic parameter state machine (#106362)
Erlend E. Aasland [Mon, 3 Jul 2023 21:16:21 +0000 (23:16 +0200)] 
gh-104683: Modernise Argument Clinic parameter state machine (#106362)

Use enums and pattern matching to make the code more readable.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoSmall speed-up for the convolve() recipe. (GH-106371)
Raymond Hettinger [Mon, 3 Jul 2023 20:38:38 +0000 (15:38 -0500)] 
Small speed-up for the convolve() recipe. (GH-106371)

2 years agoGH-106330: Fix matching of empty path in `pathlib.PurePath.match()` (GH-106331)
Barney Gale [Mon, 3 Jul 2023 20:29:44 +0000 (21:29 +0100)] 
GH-106330: Fix matching of empty path in `pathlib.PurePath.match()` (GH-106331)

We match paths using the `_lines` attribute, which is derived from the
path's string representation. The bug arises because an empty path's string
representation is `'.'` (not `''`), which is matched by the `'*'` wildcard.

2 years agoGH-104584: Fix ENTER_EXECUTOR (GH-106141)
Mark Shannon [Mon, 3 Jul 2023 20:28:27 +0000 (21:28 +0100)] 
GH-104584: Fix ENTER_EXECUTOR (GH-106141)

* Check eval-breaker in ENTER_EXECUTOR.

* Make sure that frame->prev_instr is set before entering executor.

2 years agogh-106368: Increase Argument Clinic test coverage (#106369)
Erlend E. Aasland [Mon, 3 Jul 2023 20:16:50 +0000 (22:16 +0200)] 
gh-106368: Increase Argument Clinic test coverage (#106369)

Add tests for 'self' and 'defining_class' converter requirements.

2 years agogh-106078: Move `context template` to decimal module global state (#106346)
Charlie Zhao [Mon, 3 Jul 2023 20:10:01 +0000 (04:10 +0800)] 
gh-106078: Move `context template` to decimal module global state (#106346)

2 years agogh-106290: Fix edge cases around uops (#106319)
Guido van Rossum [Mon, 3 Jul 2023 20:05:11 +0000 (13:05 -0700)] 
gh-106290: Fix edge cases around uops (#106319)

- Tweak uops debugging output
- Fix the bug from gh-106290
- Rename `SET_IP` to `SAVE_IP` (per https://github.com/faster-cpython/ideas/issues/558)
- Add a `SAVE_IP` uop at the start of the trace (ditto)
- Allow `unbound_local_error`; this gives us uops for `LOAD_FAST_CHECK`, `LOAD_CLOSURE`, and `DELETE_FAST`
- Longer traces
- Support `STORE_FAST_LOAD_FAST`, `STORE_FAST_STORE_FAST`
- Add deps on pycore_uops.h to Makefile(.pre.in)

2 years agogh-91053: make func watcher tests resilient to other func watchers (#106286)
Carl Meyer [Mon, 3 Jul 2023 14:25:22 +0000 (08:25 -0600)] 
gh-91053: make func watcher tests resilient to other func watchers (#106286)

2 years agogh-104050: Add more type hints to Argument Clinic DSLParser() (#106354)
Erlend E. Aasland [Mon, 3 Jul 2023 14:03:31 +0000 (16:03 +0200)] 
gh-104050: Add more type hints to Argument Clinic DSLParser() (#106354)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-106359: Fix corner case bugs in Argument Clinic converter parser (#106361)
Erlend E. Aasland [Mon, 3 Jul 2023 13:14:59 +0000 (15:14 +0200)] 
gh-106359: Fix corner case bugs in Argument Clinic converter parser (#106361)

DSLParser.parse_converter() could return unusable kwdicts in some rare cases

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104146: Remove unused attr 'parameter_indent' from clinic.DLParser (#106358)
Erlend E. Aasland [Mon, 3 Jul 2023 11:00:35 +0000 (13:00 +0200)] 
gh-104146: Remove unused attr 'parameter_indent' from clinic.DLParser (#106358)

2 years agogh-106320: Remove private _PyErr C API functions (#106356)
Victor Stinner [Mon, 3 Jul 2023 10:48:50 +0000 (12:48 +0200)] 
gh-106320: Remove private _PyErr C API functions (#106356)

Remove private _PyErr C API functions: move them to the internal
C API (pycore_pyerrors.h).

2 years agogh-104050: Annotate Argument Clinic DSLParser attributes (#106357)
Erlend E. Aasland [Mon, 3 Jul 2023 10:06:54 +0000 (12:06 +0200)] 
gh-104050: Annotate Argument Clinic DSLParser attributes (#106357)

2 years agogh-106320: Create pycore_modsupport.h header file (#106355)
Victor Stinner [Mon, 3 Jul 2023 09:39:11 +0000 (11:39 +0200)] 
gh-106320: Create pycore_modsupport.h header file (#106355)

Remove the following functions from the C API, move them to the internal C
API: add a new pycore_modsupport.h internal header file:

* PyModule_CreateInitialized()
* _PyArg_NoKwnames()
* _Py_VaBuildStack()

No longer export these functions.

2 years agogh-106320: Move _PyUnicodeWriter to the internal C API (#106342)
Victor Stinner [Mon, 3 Jul 2023 08:23:43 +0000 (10:23 +0200)] 
gh-106320: Move _PyUnicodeWriter to the internal C API (#106342)

Move also _PyUnicode_FormatAdvancedWriter().

CJK codecs and multibytecodec.c now define the Py_BUILD_CORE_MODULE
macro.

2 years agogh-61215: New mock to wait for multi-threaded events to happen (#16094)
Mario Corchero [Mon, 3 Jul 2023 06:56:54 +0000 (07:56 +0100)] 
gh-61215: New mock to wait for multi-threaded events to happen (#16094)

mock: Add `ThreadingMock` class

Add a new class that allows to wait for a call to happen by using
`Event` objects. This mock class can be used to test and validate
expectations of multithreading code.

It uses two attributes for events to distinguish calls with any argument
and calls with specific arguments.

The calls with specific arguments need a lock to prevent two calls in
parallel from creating the same event twice.

The timeout is configured at class and constructor level to allow users
to set a timeout, we considered passing it as an argument to the
function but it could collide with a function parameter. Alternatively
we also considered passing it as positional only but from an API
caller perspective it was unclear what the first number meant on the
function call, think `mock.wait_until_called(1, "arg1", "arg2")`, where
1 is the timeout.

Lastly we also considered adding the new attributes to magic mock
directly rather than having a custom mock class for multi threading
scenarios, but we preferred to have specialised class that can be
composed if necessary. Additionally, having added it to `MagicMock`
directly would have resulted in `AsyncMock` having this logic, which
would not work as expected, since when if user "waits" on a
coroutine does not have the same meaning as waiting on a standard
call.

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
2 years agoDocument PYTHONSAFEPATH along side -P (#106122)
Jeremy Paige [Mon, 3 Jul 2023 05:44:37 +0000 (22:44 -0700)] 
Document PYTHONSAFEPATH along side -P (#106122)

2 years agoReplace the esoteric term 'datum' when describing dict comprehensions (#106119)
Ned Batchelder [Mon, 3 Jul 2023 03:22:40 +0000 (20:22 -0700)] 
Replace the esoteric term 'datum' when describing dict comprehensions (#106119)

2 years agogh-104050: Add more type hints to Argument Clinic DSLParser() (#106343)
Erlend E. Aasland [Sun, 2 Jul 2023 23:42:38 +0000 (01:42 +0200)] 
gh-104050: Add more type hints to Argument Clinic DSLParser() (#106343)

Annotate the following method signatures:

- state_dsl_start()
- state_parameter_docstring_start()
- state_parameters_start()

Inverting ignore_line() logic, add type hints (including type guard) to
it, and rename to valid_line().

2 years agogh-106320: _testcapi avoids private _PyUnicode_EqualToASCIIString() (#106341)
Victor Stinner [Sun, 2 Jul 2023 21:56:58 +0000 (23:56 +0200)] 
gh-106320: _testcapi avoids private _PyUnicode_EqualToASCIIString() (#106341)

Replace private _PyUnicode_EqualToASCIIString() with public
PyUnicode_CompareWithASCIIString().

2 years agogh-106320: Add pycore_complexobject.h header file (#106339)
Victor Stinner [Sun, 2 Jul 2023 21:19:59 +0000 (23:19 +0200)] 
gh-106320: Add pycore_complexobject.h header file (#106339)

Add internal pycore_complexobject.h header file.

Move _Py_c_xxx() functions and _PyComplex_FormatAdvancedWriter()
function to this new header file.

2 years agogh-106078: Move DecimalException to _decimal state (#106301)
Charlie Zhao [Sun, 2 Jul 2023 16:50:40 +0000 (00:50 +0800)] 
gh-106078: Move DecimalException to _decimal state (#106301)

2 years agogh-106320: Use _PyInterpreterState_GET() (#106336)
Victor Stinner [Sun, 2 Jul 2023 16:37:37 +0000 (18:37 +0200)] 
gh-106320: Use _PyInterpreterState_GET() (#106336)

Replace PyInterpreterState_Get() with inlined
_PyInterpreterState_GET().

2 years agogh-106320: Remove private _PyInterpreterState functions (#106335)
Victor Stinner [Sun, 2 Jul 2023 16:11:45 +0000 (18:11 +0200)] 
gh-106320: Remove private _PyInterpreterState functions (#106335)

Remove private _PyThreadState and _PyInterpreterState C API
functions: move them to the internal C API (pycore_pystate.h and
pycore_interp.h). Don't export most of these functions anymore, but
still export functions used by tests.

Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C
API, but keep it in the stable API.

2 years agogh-104922: Doc: add note about PY_SSIZE_T_CLEAN (#106314)
Inada Naoki [Sun, 2 Jul 2023 15:54:35 +0000 (00:54 +0900)] 
gh-104922: Doc: add note about PY_SSIZE_T_CLEAN (#106314)

Add note about PY_SSIZE_T_CLEAN in extending and embedding document.

2 years agogh-106217: Truncate the issue body size of `new-bugs-announce-notifier` (#106329)
Nikita Sobolev [Sun, 2 Jul 2023 14:15:28 +0000 (17:15 +0300)] 
gh-106217: Truncate the issue body size of `new-bugs-announce-notifier` (#106329)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-104922: remove PY_SSIZE_T_CLEAN (#106315)
Inada Naoki [Sun, 2 Jul 2023 06:07:46 +0000 (15:07 +0900)] 
gh-104922: remove PY_SSIZE_T_CLEAN (#106315)