]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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)

2 years agogh-106320: Remove private _PyInterpreterState functions (#106325)
Victor Stinner [Sun, 2 Jul 2023 01:39:38 +0000 (03:39 +0200)] 
gh-106320: Remove private _PyInterpreterState functions (#106325)

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-106320: Remove private _PyTraceMalloc C API functions (#106324)
Victor Stinner [Sun, 2 Jul 2023 00:49:18 +0000 (02:49 +0200)] 
gh-106320: Remove private _PyTraceMalloc C API functions (#106324)

* Remove private _PyTraceMalloc C API functions: move them to the
  internal C API.
* Don't export most of these functions anymore, but still export
  _PyTraceMalloc_GetTraceback() used by tests.
* Rename Include/tracemalloc.h to Include/cpython/tracemalloc.h

2 years agogh-106320: Remove _PyInterpreterState_Get() alias (#106321)
Victor Stinner [Sat, 1 Jul 2023 23:44:07 +0000 (01:44 +0200)] 
gh-106320: Remove _PyInterpreterState_Get() alias (#106321)

Replace calls to the (removed) slow _PyInterpreterState_Get() with
fast inlined _PyInterpreterState_GET() function.

2 years agogh-102541: Fix Helper.help("mod") for non-existent mod (#105934)
Kirill Podoprigora [Sat, 1 Jul 2023 22:46:06 +0000 (01:46 +0300)] 
gh-102541: Fix Helper.help("mod") for non-existent mod (#105934)

If the output arg to Helper() is a stream rather than the default None, which means 'page to stdout', the ImportError from pydoc.resolve is currently not caught in pydoc.doc. The same error is caught when output is None.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agogh-106316: Remove pytime.h header file (#106317)
Victor Stinner [Sat, 1 Jul 2023 22:27:18 +0000 (00:27 +0200)] 
gh-106316: Remove pytime.h header file (#106317)

Remove the "cpython/pytime.h" header file: it only contained private
functions. Move functions to the internal pycore_time.h header file.

Move tests from _testcapi to _testinternalcapi. Rename also test
methods to have the same name than tested C functions.

No longer export these functions:

* _PyTime_Add()
* _PyTime_As100Nanoseconds()
* _PyTime_FromMicrosecondsClamp()
* _PyTime_FromTimespec()
* _PyTime_FromTimeval()
* _PyTime_GetPerfCounterWithInfo()
* _PyTime_MulDiv()

2 years agoFix duplicate word typos in comments (#106225)
Md Sadman Chowdhury [Sat, 1 Jul 2023 19:47:14 +0000 (01:47 +0600)] 
Fix duplicate word typos in comments (#106225)

2 years agoGH-89812: Improve test for `pathlib.Path.stat()` (GH-106064)
Barney Gale [Sat, 1 Jul 2023 12:33:29 +0000 (13:33 +0100)] 
GH-89812: Improve test for `pathlib.Path.stat()` (GH-106064)

Make assertions about the `st_mode`, `st_ino` and `st_dev` attributes of
the stat results from two files and a directory, rather than checking if
`chmod()` affects `st_mode` (which is already tested elsewhere).

2 years agoGH-89812: Miscellaneous pathlib test improvements (GH-106063)
Barney Gale [Sat, 1 Jul 2023 12:29:02 +0000 (13:29 +0100)] 
GH-89812: Miscellaneous pathlib test improvements (GH-106063)

- Split out dedicated test for unbuffered `open()`
- Split out dedicated test for `is_mount()` at the filesystem root
- Avoid `os.stat()` when checking that empty paths point to '.'
- Remove unnecessary `rmtree()` call
- Remove unused `assertSame()` method

2 years agoGH-89812: Test that `pathlib.Path.is_junction()` returns false (GH-106062)
Barney Gale [Sat, 1 Jul 2023 11:58:30 +0000 (12:58 +0100)] 
GH-89812: Test that `pathlib.Path.is_junction()` returns false (GH-106062)

Slightly expand the test coverage of `is_junction()`. The existing test
only checks that `os.path.isjunction()` is called under-the-hood.

2 years agoGH-89812: Make symlink support configurable in pathlib tests. (GH-106060)
Barney Gale [Sat, 1 Jul 2023 11:24:34 +0000 (12:24 +0100)] 
GH-89812: Make symlink support configurable in pathlib tests. (GH-106060)

Adjust the pathlib tests to add a new `PathTest.can_symlink` class
attribute, which allows us to enable or disable symlink support in tests.
A (near-)future commit will add an `AbstractPath` class; its tests will
hard-code the value to `True` or `False` depending on a stub subclass's
capabilities.

2 years agogh-106149: move unconditional jump direction resolution from optimizer to assembler...
Irit Katriel [Sat, 1 Jul 2023 10:28:07 +0000 (11:28 +0100)] 
gh-106149: move unconditional jump direction resolution from optimizer to assembler (#106291)

2 years agobuild(deps): bump mheap/github-action-required-labels from 4 to 5 (#106306)
dependabot[bot] [Sat, 1 Jul 2023 10:23:57 +0000 (13:23 +0300)] 
build(deps): bump mheap/github-action-required-labels from 4 to 5 (#106306)

Bumps [mheap/github-action-required-labels](https://github.com/mheap/github-action-required-labels) from 4 to 5.
- [Release notes](https://github.com/mheap/github-action-required-labels/releases)
- [Commits](https://github.com/mheap/github-action-required-labels/compare/v4...v5)

---
updated-dependencies:
- dependency-name: mheap/github-action-required-labels
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agobuild(deps-dev): bump mypy from 1.3.0 to 1.4.1 in /Tools/clinic (#106305)
dependabot[bot] [Sat, 1 Jul 2023 09:54:32 +0000 (09:54 +0000)] 
build(deps-dev): bump mypy from 1.3.0 to 1.4.1 in /Tools/clinic (#106305)

Bumps [mypy](https://github.com/python/mypy) from 1.3.0 to 1.4.1.
- [Commits](https://github.com/python/mypy/compare/v1.3.0...v1.4.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agogh-106232: Make timeit doc command lines compatible with Windows. (#106296)
Terry Jan Reedy [Sat, 1 Jul 2023 02:34:31 +0000 (22:34 -0400)] 
gh-106232: Make timeit doc command lines compatible with Windows. (#106296)

Command Prompt (CMD Shell) and older versions of PowerShell
require double quotes and single quotes inside the string.
This form also works on linux and macOS.

2 years agogh-105486: Change the `repr` of `ParamSpec` list of args in `GenericAlias` (#105488)
Nikita Sobolev [Sat, 1 Jul 2023 00:04:50 +0000 (03:04 +0300)] 
gh-105486: Change the `repr` of `ParamSpec` list of args in `GenericAlias` (#105488)

2 years agoGH-89812: Simplify creation of symlinks in pathlib tests. (GH-106061)
Barney Gale [Fri, 30 Jun 2023 23:46:44 +0000 (00:46 +0100)] 
GH-89812: Simplify creation of symlinks in pathlib tests. (GH-106061)

Remove `PathTest.dirlink()` function. Symlinks in `PathTest.setUp()` are
created using `os.symlink()` directly; symlinks in test functions use
`Path.symlink_to()` in order to make the tests applicable to a
(near-)future `AbstractPath` class.

2 years agogh-106145: Make `end_{lineno,col_offset}` required on `type_param` nodes (#106224)
Nikita Sobolev [Fri, 30 Jun 2023 23:45:08 +0000 (02:45 +0300)] 
gh-106145: Make `end_{lineno,col_offset}` required on `type_param` nodes (#106224)

2 years agoGH-106135: Add more edge-"cases" to test_patma (GH-106271)
Nikita Sobolev [Fri, 30 Jun 2023 19:39:50 +0000 (22:39 +0300)] 
GH-106135: Add more edge-"cases" to test_patma (GH-106271)

2 years agogh-106267: Add type cast to generated code (#106289)
Kirill Podoprigora [Fri, 30 Jun 2023 19:11:10 +0000 (22:11 +0300)] 
gh-106267: Add type cast to generated code (#106289)

2 years agogh-106280: Remove unnecessary unreachable code (gh-106285)
Dong-hee Na [Fri, 30 Jun 2023 15:58:07 +0000 (00:58 +0900)] 
gh-106280: Remove unnecessary unreachable code (gh-106285)

2 years agogh-101100: Docs: Fix references to several numeric dunders (#106278)
F3eQnxN3RriK [Fri, 30 Jun 2023 14:27:09 +0000 (23:27 +0900)] 
gh-101100: Docs: Fix references to several numeric dunders (#106278)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoGH-104584: Add Include/cpython/optimizer.h to Makefile.pre.in (#106277)
Victor Stinner [Fri, 30 Jun 2023 10:40:09 +0000 (12:40 +0200)] 
GH-104584: Add Include/cpython/optimizer.h to Makefile.pre.in (#106277)

2 years agoCleanup clear_static_tp_subclasses() (#106276)
Victor Stinner [Fri, 30 Jun 2023 10:39:55 +0000 (12:39 +0200)] 
Cleanup clear_static_tp_subclasses() (#106276)

Only iterate on the dictionary if Python is built with assertions:
subclass is only needed when Python is built with assertions.

2 years agogh-106023: Remove _PyObject_FastCallTstate() function (#106273)
Victor Stinner [Fri, 30 Jun 2023 10:28:59 +0000 (12:28 +0200)] 
gh-106023: Remove _PyObject_FastCallTstate() function (#106273)

2 years agogh-77782: Deprecate Py_HasFileSystemDefaultEncoding (#106272)
Victor Stinner [Fri, 30 Jun 2023 09:57:06 +0000 (11:57 +0200)] 
gh-77782: Deprecate Py_HasFileSystemDefaultEncoding (#106272)

Deprecate Py_HasFileSystemDefaultEncoding variable.

2 years agogh-106023: Remove _PyObject_FastCall() function (#106265)
Victor Stinner [Fri, 30 Jun 2023 09:46:43 +0000 (11:46 +0200)] 
gh-106023: Remove _PyObject_FastCall() function (#106265)

2 years agoRemove private _PyCodec_Lookup() function (#106269)
Victor Stinner [Fri, 30 Jun 2023 09:34:01 +0000 (11:34 +0200)] 
Remove private _PyCodec_Lookup() function (#106269)

Remove the following private functions of the C API:

* _PyCodecInfo_GetIncrementalDecoder()
* _PyCodecInfo_GetIncrementalEncoder()
* _PyCodec_DecodeText()
* _PyCodec_EncodeText()
* _PyCodec_Forget()
* _PyCodec_Lookup()
* _PyCodec_LookupTextEncoding()

Move these functions to a new pycore_codecs.h internal header file.

These functions are no longer exported.

2 years agogh-106023: Rename _PyObject_FastCallDictTstate() (#106264)
Victor Stinner [Fri, 30 Jun 2023 07:53:42 +0000 (09:53 +0200)] 
gh-106023: Rename _PyObject_FastCallDictTstate() (#106264)

Rename _PyObject_FastCallDictTstate() to
_PyObject_VectorcallDictTstate().

2 years agogh-106182: sys: Intern getfilesystemencoding() and getfilesystemencodeerrors() (...
Inada Naoki [Fri, 30 Jun 2023 04:02:03 +0000 (13:02 +0900)] 
gh-106182: sys: Intern getfilesystemencoding() and getfilesystemencodeerrors() (#106183)

sys: Intern getfilesystemencoding() and getfilesystemencodeerrors()

2 years agofix typos (#106247)
Inada Naoki [Fri, 30 Jun 2023 04:00:22 +0000 (13:00 +0900)] 
fix typos (#106247)

Most typos are in comments, but two typos are in docstring.

2 years agogh-106023: Remove _PY_FASTCALL_SMALL_STACK constant (#106258)
Victor Stinner [Fri, 30 Jun 2023 01:07:59 +0000 (03:07 +0200)] 
gh-106023: Remove _PY_FASTCALL_SMALL_STACK constant (#106258)

Remove _PY_FASTCALL_SMALL_STACK constant from the C API: move it to
the internal C API (pycore_call.h).

2 years agogh-106023: Update code using _PyObject_FastCall() (#106257)
Victor Stinner [Fri, 30 Jun 2023 01:05:01 +0000 (03:05 +0200)] 
gh-106023: Update code using _PyObject_FastCall() (#106257)

Replace _PyObject_FastCall() calls with PyObject_Vectorcall().

2 years agogh-106210 Remove Emscripten import trampoline (#106211)
Hood Chatham [Fri, 30 Jun 2023 00:20:49 +0000 (17:20 -0700)] 
gh-106210 Remove Emscripten import trampoline (#106211)

It's no longer necessary.

Co-authored-by: Brett Cannon <brett@python.org>
2 years agoGH-106152: Add PY_THROW event to cProfile (GH-106161)
Tian Gao [Thu, 29 Jun 2023 23:14:09 +0000 (16:14 -0700)] 
GH-106152: Add PY_THROW event to cProfile (GH-106161)

2 years agoGH-106008: Make implicit boolean conversions explicit (GH-106003)
Brandt Bucher [Thu, 29 Jun 2023 20:49:54 +0000 (13:49 -0700)] 
GH-106008: Make implicit boolean conversions explicit (GH-106003)

2 years agoGH-106250: Support insts using one cache entry and no oparg (GH-106252)
Guido van Rossum [Thu, 29 Jun 2023 20:02:25 +0000 (13:02 -0700)] 
GH-106250: Support insts using one cache entry and no oparg (GH-106252)

2 years agogh-105775: Convert LOAD_CLOSURE to a pseudo-op (#106059)
hms [Thu, 29 Jun 2023 16:34:00 +0000 (10:34 -0600)] 
gh-105775: Convert LOAD_CLOSURE to a pseudo-op (#106059)

This enables super-instruction formation,
removal of checks for uninitialized variables,
and frees up an instruction.

2 years agoFix possible refleak in CodeType.replace() (GH-106243)
Serhiy Storchaka [Thu, 29 Jun 2023 14:22:15 +0000 (17:22 +0300)] 
Fix possible refleak in CodeType.replace() (GH-106243)

A reference to c_code was leaked if PySys_Audit() failed.

2 years agogh-106078: Convert `_decimal` types to heap types (#106079)
Charlie Zhao [Thu, 29 Jun 2023 10:27:20 +0000 (18:27 +0800)] 
gh-106078: Convert `_decimal` types to heap types (#106079)

- Establish global state struct
- Convert static types to heap types and add them to global state:
    * PyDecContextManager_Type
    * PyDecContext_Type
    * PyDecSignalDictMixin_Type
    * PyDec_Type
- Add to global state:
    * PyDecSignalDict_Type
    * DecimalTuple

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2 years agogh-89392: Make test_decimal discoverable (GH-106209)
Serhiy Storchaka [Thu, 29 Jun 2023 09:53:22 +0000 (12:53 +0300)] 
gh-89392: Make test_decimal discoverable (GH-106209)

2 years agogh-106033: Get rid of PyDict_GetItem in _PyFunction_FromConstructor (GH-106044)
Serhiy Storchaka [Thu, 29 Jun 2023 09:31:08 +0000 (12:31 +0300)] 
gh-106033: Get rid of PyDict_GetItem in _PyFunction_FromConstructor (GH-106044)

2 years agogh-101006: Improve error handling when read marshal data (GH-101007)
Serhiy Storchaka [Thu, 29 Jun 2023 09:22:19 +0000 (12:22 +0300)] 
gh-101006: Improve error handling when read marshal data (GH-101007)

* EOFError no longer overrides other errors such as MemoryError or OSError at
  the start of the object.
* Raise more relevant error when the NULL object occurs as a code object
  component.
* Minimize an overhead of calling PyErr_Occurred().

2 years agogh-106194: Rename duplicated tests in `test_curses` (#106196)
Nikita Sobolev [Wed, 28 Jun 2023 20:41:08 +0000 (23:41 +0300)] 
gh-106194: Rename duplicated tests in `test_curses` (#106196)

2 years agoGH-106214: Fix `test_opcache` to skip threaded tests on non-threaded platforms (GH... 106215/head
Hood Chatham [Wed, 28 Jun 2023 20:04:59 +0000 (13:04 -0700)] 
GH-106214: Fix `test_opcache` to skip threaded tests on non-threaded platforms (GH-106166)

This skips the test added in GH-105953 on threadless builds.

2 years agogh-104584: Emit macro expansions to opcode_metadata.h (#106163)
Guido van Rossum [Wed, 28 Jun 2023 18:28:07 +0000 (11:28 -0700)] 
gh-104584: Emit macro expansions to opcode_metadata.h (#106163)

This produces longer traces (superblocks?).

Also improved debug output (uop names are now printed instead of numeric opcodes). This would be simpler if the numeric opcode values were generated by generate_cases.py, but that's another project.

Refactored some code in generate_cases.py so the essential algorithm for cache effects is only run once. (Deciding which effects are used and what the total cache size is, regardless of what's used.)

2 years agogh-106197: Deduplicate tests in `test_buffer` (#106198)
Nikita Sobolev [Wed, 28 Jun 2023 14:43:41 +0000 (17:43 +0300)] 
gh-106197: Deduplicate tests in `test_buffer` (#106198)

2 years agogh-101100: Fix reference to `parse_args` in `optparse.rst` (#105265)
F3eQnxN3RriK [Wed, 28 Jun 2023 12:30:26 +0000 (21:30 +0900)] 
gh-101100: Fix reference to `parse_args` in `optparse.rst` (#105265)

2 years agogh-106200: Remove unused imports (#106201)
Nikita Sobolev [Wed, 28 Jun 2023 11:55:41 +0000 (14:55 +0300)] 
gh-106200: Remove unused imports (#106201)

2 years agogh-106118: Add O_CLOEXEC preprocessor guard (#106120)
Erlend E. Aasland [Wed, 28 Jun 2023 11:11:32 +0000 (13:11 +0200)] 
gh-106118: Add O_CLOEXEC preprocessor guard (#106120)

2 years agogh-101100: Fix reference to asynchronous methods (#106172)
F3eQnxN3RriK [Wed, 28 Jun 2023 10:43:11 +0000 (19:43 +0900)] 
gh-101100: Fix reference to asynchronous methods (#106172)

2 years agogh-105993: Add possible `None` return type to `asyncio.EventLoop.start_tls` docs...
Sam Bull [Wed, 28 Jun 2023 10:38:15 +0000 (11:38 +0100)] 
gh-105993: Add possible `None` return type to `asyncio.EventLoop.start_tls` docs (#105995)

2 years agogh-106162: fix test_array modifies warning filter (#106181)
Inada Naoki [Wed, 28 Jun 2023 07:50:36 +0000 (16:50 +0900)] 
gh-106162: fix test_array modifies warning filter (#106181)

2 years agoRefer to `TimeoutError` instead of `asyncio.TimeoutError` in `asyncio-task.rst` ...
lightdrk [Wed, 28 Jun 2023 05:21:38 +0000 (10:51 +0530)] 
Refer to `TimeoutError` instead of `asyncio.TimeoutError` in `asyncio-task.rst` (#106136)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agoFix c-analyzer for GCC: ignore LANG env var (#106173)
Victor Stinner [Wed, 28 Jun 2023 02:50:51 +0000 (04:50 +0200)] 
Fix c-analyzer for GCC: ignore LANG env var (#106173)

The c-analyzer doesn't support GCC localized messages, so just unset
the LANG environment variable.

2 years agoGH-104584: Fix test_capi.test_counter_optimizer() when run twice (#106171)
Victor Stinner [Wed, 28 Jun 2023 02:41:21 +0000 (04:41 +0200)] 
GH-104584: Fix test_capi.test_counter_optimizer() when run twice (#106171)

test_counter_optimizer() and test_long_loop() of test_capi now create
a new function at each call. Otherwise, the optimizer counters are
not the expected values when the test is run more than once.

2 years agogh-101634: regrtest reports decoding error as failed test (#106169)
Victor Stinner [Wed, 28 Jun 2023 02:26:52 +0000 (04:26 +0200)] 
gh-101634: regrtest reports decoding error as failed test (#106169)

When running the Python test suite with -jN option, if a worker stdout
cannot be decoded from the locale encoding report a failed testn so the
exitcode is non-zero.

2 years agogh-106168: PyTuple_SET_ITEM() now checks the index (#106164)
Victor Stinner [Wed, 28 Jun 2023 01:45:57 +0000 (03:45 +0200)] 
gh-106168: PyTuple_SET_ITEM() now checks the index (#106164)

PyTuple_SET_ITEM() and PyList_SET_ITEM() now check the index argument
with an assertion if Python is built in debug mode or is built with
assertions.

* list_extend() and _PyList_AppendTakeRef() now set the list size
  before calling PyList_SET_ITEM().
* PyStructSequence_GetItem() and PyStructSequence_SetItem() now check
  the index argument: must be lesser than REAL_SIZE(op).
* PyStructSequence_GET_ITEM() and PyStructSequence_SET_ITEM() are now
  aliases to PyStructSequence_GetItem() and
  PyStructSequence_SetItem().

2 years agoGH-106160: Fix test_gzip failing under WASI, which does not have zlib. (#106167)
T. Wouters [Wed, 28 Jun 2023 00:55:11 +0000 (02:55 +0200)] 
GH-106160: Fix test_gzip failing under WASI, which does not have zlib. (#106167)

Fix test_gzip's failure under WASI, which does not have zlib, by using
test.support.import_helper.import_module to import zlib. (gzip
unconditionally imports zlib, so this does not cause any new skips.)

2 years agogh-106084: Remove _PyObject_CallMethod() function (#106159)
Victor Stinner [Tue, 27 Jun 2023 23:34:37 +0000 (01:34 +0200)] 
gh-106084: Remove _PyObject_CallMethod() function (#106159)

Remove the following private functions from the public C API:

* _Py_CheckFunctionResult()
* _PyObject_CallMethod()
* _PyObject_CallMethodId()
* _PyObject_CallMethodIdNoArgs()
* _PyObject_CallMethodIdObjArgs()
* _PyObject_CallMethodIdOneArg()
* _PyObject_MakeTpCall()
* _PyObject_VectorcallMethodId()
* _PyStack_AsDict()

Move these functions to the internal C API (pycore_call.h).

No longer export the following functions:

* _PyObject_Call()
* _PyObject_CallMethod()
* _PyObject_CallMethodId()
* _PyObject_CallMethodIdObjArgs()
* _PyObject_Call_Prepend()
* _PyObject_FastCallDictTstate()
* _PyStack_AsDict()

The following functions are still exported for stdlib shared
extensions:

* _Py_CheckFunctionResult()
* _PyObject_MakeTpCall()

Mark the following internal functions as extern:

* _PyStack_UnpackDict()
* _PyStack_UnpackDict_Free()
* _PyStack_UnpackDict_FreeNoDecRef()

2 years agogh-104584: Change DEOPT_IF in uops executor (#106146)
Guido van Rossum [Tue, 27 Jun 2023 21:17:41 +0000 (14:17 -0700)] 
gh-104584: Change DEOPT_IF in uops executor (#106146)

This effectively reverts bb578a0, restoring the original DEOPT_IF() macro in ceval_macros.h, and redefining it in the Tier 2 interpreter. We can get rid of the PREDICTED() macros there as well!

2 years agogh-106149: move jump target resolution from optimizer to assembler (#106150)
Irit Katriel [Tue, 27 Jun 2023 19:24:58 +0000 (20:24 +0100)] 
gh-106149: move jump target resolution from optimizer to assembler (#106150)

2 years agoIDLE: Condense run.main threading.Thread start. (#106125)
Terry Jan Reedy [Tue, 27 Jun 2023 17:12:56 +0000 (13:12 -0400)] 
IDLE: Condense run.main threading.Thread start. (#106125)

Use daemon argument added in 3.3 and directly call .start.
Remove now unused 'sockthread' name.

2 years agogh-106140: Reorder some more fields to facilitate out-of-process inspection (#106148)
Pablo Galindo Salgado [Tue, 27 Jun 2023 16:09:15 +0000 (17:09 +0100)] 
gh-106140: Reorder some more fields to facilitate out-of-process inspection (#106148)

2 years agogh-106140: Reorder some fields to facilitate out-of-process inspection (#106143)
Pablo Galindo Salgado [Tue, 27 Jun 2023 15:26:53 +0000 (16:26 +0100)] 
gh-106140: Reorder some fields to facilitate out-of-process inspection (#106143)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2 years agogh-104584: Fix assert in DEOPT macro -- should fix buildbot (#106131)
Guido van Rossum [Tue, 27 Jun 2023 14:02:51 +0000 (07:02 -0700)] 
gh-104584: Fix assert in DEOPT macro -- should fix buildbot (#106131)

2 years agogh-104584: Add #line directives to executor_cases.c.h (#106126)
Guido van Rossum [Tue, 27 Jun 2023 13:56:39 +0000 (06:56 -0700)] 
gh-104584: Add #line directives to executor_cases.c.h (#106126)

2 years agogh-92788: Add docs for `ast.Module`, `ast.Expression`, and others (#101055)
Nikita Sobolev [Tue, 27 Jun 2023 13:43:49 +0000 (16:43 +0300)] 
gh-92788: Add docs for `ast.Module`, `ast.Expression`, and others (#101055)

2 years agoGH-105774: Clarify operation of normalize() (GH-106093)
Raymond Hettinger [Tue, 27 Jun 2023 04:12:22 +0000 (23:12 -0500)] 
GH-105774: Clarify operation of normalize() (GH-106093)

2 years agogh-106123: Modules/_sha3 appears to no longer be necessary (#106124)
Skip Montanaro [Tue, 27 Jun 2023 03:40:34 +0000 (22:40 -0500)] 
gh-106123: Modules/_sha3 appears to no longer be necessary (#106124)

2 years agogh-104584: Baby steps towards generating and executing traces (#105924)
Guido van Rossum [Tue, 27 Jun 2023 02:02:57 +0000 (19:02 -0700)] 
gh-104584: Baby steps towards generating and executing traces (#105924)

Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose).

All of this code is likely to change dramatically before the 3.13 feature freeze. But this is a first step.

2 years agoRevert "GH-96145: Add AttrDict to JSON module for use with object_hook (#96146)"...
Łukasz Langa [Mon, 26 Jun 2023 18:35:53 +0000 (18:35 +0000)] 
Revert "GH-96145: Add AttrDict to JSON module for use with object_hook (#96146)" (#105948)

This reverts commit 1f0eafa844bf5a380603d55e8d4b42d8c2a3439d.

2 years agogh-106107: document correct error that's raised when a mutable default value for...
Roderich Schupp [Mon, 26 Jun 2023 18:00:21 +0000 (20:00 +0200)] 
gh-106107: document correct error that's raised when a mutable default value for a field is detected (gh-106109)

2 years agoGH-105793: Add follow_symlinks argument to `pathlib.Path.is_dir()` and `is_file(...
Barney Gale [Mon, 26 Jun 2023 16:58:17 +0000 (17:58 +0100)] 
GH-105793: Add follow_symlinks argument to `pathlib.Path.is_dir()` and `is_file()` (GH-105794)

Brings `pathlib.Path.is_dir()` and `in line with `os.DirEntry.is_dir()`, which
will be important for implementing generic path walking and globbing.
Likewise `is_file()`.

2 years agogh-106111: Remove zipapp documentation on creating a Windows executable (#106112)
Paul Moore [Mon, 26 Jun 2023 16:14:20 +0000 (17:14 +0100)] 
gh-106111: Remove zipapp documentation on creating a Windows executable (#106112)

Remove zipapp documentation on creating a Windows executable