]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-103053: Skip test_freeze_simple_script() on PGO build (#109591)
Victor Stinner [Wed, 20 Sep 2023 01:58:34 +0000 (03:58 +0200)] 
gh-103053: Skip test_freeze_simple_script() on PGO build (#109591)

Skip test_freeze_simple_script() of test_tools.test_freeze if Python
is built with "./configure --enable-optimizations", which means with
Profile Guided Optimization (PGO): it just makes the test too slow.
The freeze tool is tested by many other CIs with other (faster)
compiler flags.

test.pythoninfo now gets also get_build_info() of
test.libregrtests.utils.

2 years agogh-90108: Disable LTO on _freeze_module and _testembed (#109581)
Victor Stinner [Wed, 20 Sep 2023 01:40:32 +0000 (03:40 +0200)] 
gh-90108: Disable LTO on _freeze_module and _testembed (#109581)

LTO optimization is nice to make Python faster, but _freeze_module
and _testembed performance is not important. Using LTO to build these
two programs make a whole Python build way slower, especially
combined with a sanitizer (like ASAN).

2 years agogh-109109: Expose retrieving certificate chains in SSL module (#109113)
Mateusz Nowak [Wed, 20 Sep 2023 01:20:54 +0000 (03:20 +0200)] 
gh-109109: Expose retrieving certificate chains in SSL module (#109113)

Adds APIs to get the TLS certificate chains, verified or full unverified, from SSLSocket and SSLObject.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2 years agogh-109033: Return filename with os.utime errors (#109034)
Ronan Pigott [Tue, 19 Sep 2023 23:18:23 +0000 (16:18 -0700)] 
gh-109033: Return filename with os.utime errors (#109034)

The filename was previously intentionally omitted from exception because
"it might confuse the user". Uncaught exceptions are not generally a
replacement for user-facing error messages, so obscuring this
information only has the effect of making the programmer's life more
difficult.

2 years agogh-76785: Use Pending Calls When Releasing Cross-Interpreter Data (gh-109556)
Eric Snow [Tue, 19 Sep 2023 21:01:34 +0000 (15:01 -0600)] 
gh-76785: Use Pending Calls When Releasing Cross-Interpreter Data (gh-109556)

This fixes some crashes in the _xxinterpchannels module, due to a race between interpreters.

2 years agogh-109580: Skip test_perf_profiler on ASAN build (#109584)
Victor Stinner [Tue, 19 Sep 2023 17:42:51 +0000 (19:42 +0200)] 
gh-109580: Skip test_perf_profiler on ASAN build (#109584)

Skip test_perf_profiler if Python is built with ASAN, MSAN or UBSAN
sanitizer. Python does crash randomly in this test on such build.

2 years agogh-108724: Fix _PySemaphore compile error on WASM (gh-109583)
Sam Gross [Tue, 19 Sep 2023 17:35:11 +0000 (13:35 -0400)] 
gh-108724: Fix _PySemaphore compile error on WASM (gh-109583)

Some WASM platforms have POSIX semaphores, but not sem_timedwait.

2 years agogh-108724: Add PyMutex and _PyParkingLot APIs (gh-109344)
Sam Gross [Tue, 19 Sep 2023 15:54:29 +0000 (11:54 -0400)] 
gh-108724: Add PyMutex and _PyParkingLot APIs (gh-109344)

PyMutex is a one byte lock with fast, inlineable lock and unlock functions for the common uncontended case.  The design is based on WebKit's WTF::Lock.

PyMutex is built using the _PyParkingLot APIs, which provides a cross-platform futex-like API (based on WebKit's WTF::ParkingLot).  This internal API will be used for building other synchronization primitives used to implement PEP 703, such as one-time initialization and events.

This also includes tests and a mini benchmark in Tools/lockbench/lockbench.py to compare with the existing PyThread_type_lock.

Uncontended acquisition + release:
* Linux (x86-64): PyMutex: 11 ns, PyThread_type_lock: 44 ns
* macOS (arm64): PyMutex: 13 ns, PyThread_type_lock: 18 ns
* Windows (x86-64): PyMutex: 13 ns, PyThread_type_lock: 38 ns

PR Overview:

The primary purpose of this PR is to implement PyMutex, but there are a number of support pieces (described below).

* PyMutex:  A 1-byte lock that doesn't require memory allocation to initialize and is generally faster than the existing PyThread_type_lock.  The API is internal only for now.
* _PyParking_Lot:  A futex-like API based on the API of the same name in WebKit.  Used to implement PyMutex.
* _PyRawMutex:  A word sized lock used to implement _PyParking_Lot.
* PyEvent:  A one time event.  This was used a bunch in the "nogil" fork and is useful for testing the PyMutex implementation, so I've included it as part of the PR.
* pycore_llist.h:  Defines common operations on doubly-linked list.  Not strictly necessary (could do the list operations manually), but they come up frequently in the "nogil" fork. ( Similar to https://man.freebsd.org/cgi/man.cgi?queue)

---------

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2 years agogh-109496: Skip test_capi.test_decref_freed_object() on ASAN (#109573)
Victor Stinner [Tue, 19 Sep 2023 14:42:08 +0000 (16:42 +0200)] 
gh-109496: Skip test_capi.test_decref_freed_object() on ASAN (#109573)

Skip test_decref_freed_object() of test_capi.test_misc if Python is
built with ASAN, MSAN or UBSAN sanitizers.

2 years agogh-109566: Run GHA and buildbot tests with --fail-rerun (#109567)
Victor Stinner [Tue, 19 Sep 2023 13:50:27 +0000 (15:50 +0200)] 
gh-109566: Run GHA and buildbot tests with --fail-rerun (#109567)

2 years agoMisc itertool recipe improvements, mostly docstrings and comments (gh-109555)
Raymond Hettinger [Tue, 19 Sep 2023 12:39:44 +0000 (07:39 -0500)] 
Misc itertool recipe improvements, mostly docstrings and comments (gh-109555)

2 years agogh-109485: Further improve `test_future_stmt` tests (#109486)
Nikita Sobolev [Tue, 19 Sep 2023 12:01:59 +0000 (15:01 +0300)] 
gh-109485: Further improve `test_future_stmt` tests (#109486)

Add assertSyntaxError() which run tests with an additional docstring
and without docstring, and checks for the error message.

2 years agogh-109435: Add Doc/library/cmdline.rst (#109436)
Victor Stinner [Tue, 19 Sep 2023 11:57:28 +0000 (13:57 +0200)] 
gh-109435: Add Doc/library/cmdline.rst (#109436)

Document modules providing a command-line interface (CLI).

2 years agono-issue: Fix typo TestContentTyopeHeader to TestContentTypeHeader (gh-109069)
Jenner [Tue, 19 Sep 2023 09:50:35 +0000 (18:50 +0900)] 
no-issue: Fix typo TestContentTyopeHeader to TestContentTypeHeader (gh-109069)

2 years agogh-109125: Run mypy on `Tools/wasm` (#109126)
Nikita Sobolev [Tue, 19 Sep 2023 05:49:26 +0000 (08:49 +0300)] 
gh-109125: Run mypy on `Tools/wasm` (#109126)

2 years agogh-109469: Silence compiler warnings on string comparisons in _testcapi (GH-109533)
Serhiy Storchaka [Tue, 19 Sep 2023 05:12:29 +0000 (08:12 +0300)] 
gh-109469: Silence compiler warnings on string comparisons in _testcapi (GH-109533)

2 years agogh-109546: Add more tests for formatting floats and fractions (GH-109548)
Serhiy Storchaka [Tue, 19 Sep 2023 05:09:11 +0000 (08:09 +0300)] 
gh-109546: Add more tests for formatting floats and fractions (GH-109548)

2 years agoFix error handling in _PySys_UpdateConfig() (GH-109524)
Serhiy Storchaka [Mon, 18 Sep 2023 17:09:59 +0000 (20:09 +0300)] 
Fix error handling in _PySys_UpdateConfig() (GH-109524)

2 years agogh-102757: fix function signature mismatch for `functools.reduce` between code and...
Xuehai Pan [Mon, 18 Sep 2023 16:42:58 +0000 (00:42 +0800)] 
gh-102757: fix function signature mismatch for `functools.reduce` between code and documentation (#102759)

2 years agogh-109496: Detect Py_DECREF() after dealloc in debug mode (#109539)
Victor Stinner [Mon, 18 Sep 2023 14:59:09 +0000 (16:59 +0200)] 
gh-109496: Detect Py_DECREF() after dealloc in debug mode (#109539)

On a Python built in debug mode, Py_DECREF() now calls
_Py_NegativeRefcount() if the object is a dangling pointer to
deallocated memory: memory filled with 0xDD "dead byte" by the debug
hook on memory allocators. The fix is to check the reference count
*before* checking for _Py_IsImmortal().

Add test_decref_freed_object() to test_capi.test_misc.

2 years agogh-109508: Fix libregrtest formatting of getcwd() (#109537)
Victor Stinner [Mon, 18 Sep 2023 14:45:48 +0000 (16:45 +0200)] 
gh-109508: Fix libregrtest formatting of getcwd() (#109537)

2 years agogh-109371: Fix monitoring with instruction events set (gh-109385)
Tian Gao [Mon, 18 Sep 2023 14:30:08 +0000 (07:30 -0700)] 
gh-109371: Fix monitoring with instruction events set (gh-109385)

2 years agogh-108843: fix ast.unparse for f-string with many quotes (#108981)
Shantanu [Mon, 18 Sep 2023 13:56:19 +0000 (06:56 -0700)] 
gh-108843: fix ast.unparse for f-string with many quotes (#108981)

2 years agogh-108303: Fix and move `badsyntax_pep3120.py` (#109513)
Nikita Sobolev [Mon, 18 Sep 2023 13:04:17 +0000 (16:04 +0300)] 
gh-108303: Fix and move `badsyntax_pep3120.py` (#109513)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-109408: Azure Pipelines: test 3.12 branch (#109453)
Hugo van Kemenade [Mon, 18 Sep 2023 12:37:23 +0000 (06:37 -0600)] 
gh-109408: Azure Pipelines: test 3.12 branch (#109453)

2 years agoDocs: getopt is deprecated in Python 3.13 (#109438)
Hugo van Kemenade [Mon, 18 Sep 2023 10:45:59 +0000 (04:45 -0600)] 
Docs: getopt is deprecated in Python 3.13 (#109438)

2 years agoFix a typo in c-analyzer (#109213)
DongWoo Son [Mon, 18 Sep 2023 07:27:54 +0000 (16:27 +0900)] 
Fix a typo in c-analyzer (#109213)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Dale Collison <92315623+dcollison@users.noreply.github.com>
2 years agoFix extraneous backslashes in hashlib docs (#109468)
Anthony Sottile [Mon, 18 Sep 2023 07:25:33 +0000 (03:25 -0400)] 
Fix extraneous backslashes in hashlib docs (#109468)

2 years agogh-109413: Improve mypy config for libregrtest (#109518)
Alex Waygood [Mon, 18 Sep 2023 00:35:51 +0000 (01:35 +0100)] 
gh-109413: Improve mypy config for libregrtest (#109518)

Improve the mypy config file for libregrtest

2 years agogh-109408: Remove Ubuntu unit tests from Azure Pipelines (#109452)
Hugo van Kemenade [Sun, 17 Sep 2023 17:46:15 +0000 (11:46 -0600)] 
gh-109408: Remove Ubuntu unit tests from Azure Pipelines (#109452)

2 years agogh-108511: Add C API functions which do not silently ignore errors (GH-109025)
Serhiy Storchaka [Sun, 17 Sep 2023 11:23:31 +0000 (14:23 +0300)] 
gh-108511: Add C API functions which do not silently ignore errors (GH-109025)

Add the following functions:

* PyObject_HasAttrWithError()
* PyObject_HasAttrStringWithError()
* PyMapping_HasKeyWithError()
* PyMapping_HasKeyStringWithError()

2 years agogh-108303: Move all certificates to `Lib/test/certdata/` (#109489)
Nikita Sobolev [Sat, 16 Sep 2023 16:47:18 +0000 (19:47 +0300)] 
gh-108303: Move all certificates to `Lib/test/certdata/` (#109489)

2 years agogh-109451: Fix wrong format specifier in logging documentation (GH-109465)
AlberLC [Sat, 16 Sep 2023 09:06:04 +0000 (11:06 +0200)] 
gh-109451: Fix wrong format specifier in logging documentation (GH-109465)

2 years agogh-109414: Add some basic information about venvs in the introduction. (GH-109440)
Vinay Sajip [Sat, 16 Sep 2023 08:49:02 +0000 (09:49 +0100)] 
gh-109414: Add some basic information about venvs in the introduction. (GH-109440)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years agogh-109474: Update two Unix packaging URLs (#109307)
partev [Sat, 16 Sep 2023 07:46:09 +0000 (03:46 -0400)] 
gh-109474: Update two Unix packaging URLs  (#109307)

update packaging URLs

fix a broken URL for fedora RPM packaging guide and fix a URL redirect for Slackware packaging guide.

2 years agoGH-83417: Allow `venv` to add a `.gitignore` file to environments via a new `scm_igno...
Brett Cannon [Fri, 15 Sep 2023 22:38:08 +0000 (15:38 -0700)] 
GH-83417: Allow `venv` to add a `.gitignore` file to environments via a new `scm_ignore_file` parameter (GH-108125)

This feature is off by default via code but on by default via the CLI. The `.gitignore` file contains `*` which causes the entire directory to be ignored.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-106213: Make Emscripten trampolines work with JSPI (GH-106219)
Hood Chatham [Fri, 15 Sep 2023 22:04:21 +0000 (15:04 -0700)] 
gh-106213: Make Emscripten trampolines work with JSPI (GH-106219)

There is a WIP proposal to enable webassembly stack switching which have been
implemented in v8:

https://github.com/WebAssembly/js-promise-integration

It is not possible to switch stacks that contain JS frames so the Emscripten JS
trampolines that allow calling functions with the wrong number of arguments
don't work in this case. However, the js-promise-integration proposal requires
the [type reflection for Wasm/JS API](https://github.com/WebAssembly/js-types)
proposal, which allows us to actually count the number of arguments a function
expects.

For better compatibility with stack switching, this PR checks if type reflection
is available, and if so we use a switch block to decide the appropriate
signature. If type reflection is unavailable, we should use the current EMJS
trampoline.

We cache the function argument counts since when I didn't cache them performance
was negatively affected.

Co-authored-by: T. Wouters <thomas@python.org>
Co-authored-by: Brett Cannon <brett@python.org>
2 years agogh-109096: Deprecate `http.server.CGIHTTPRequestHandler` (#109387)
Gregory P. Smith [Fri, 15 Sep 2023 21:26:45 +0000 (14:26 -0700)] 
gh-109096: Deprecate `http.server.CGIHTTPRequestHandler` (#109387)

Deprecate `http.server.CGIHTTPRequestHandler`.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agoGH-109373: Store metadata required for pystats comparison in the JSON (GH-109374)
Michael Droettboom [Fri, 15 Sep 2023 20:10:46 +0000 (16:10 -0400)] 
GH-109373: Store metadata required for pystats comparison in the JSON (GH-109374)

2 years agogh-109350: Fix outdated captured output in unittest.mock documentation (#109353)
Egil Martinsson [Fri, 15 Sep 2023 18:25:16 +0000 (20:25 +0200)] 
gh-109350: Fix outdated captured output in unittest.mock documentation (#109353)

2 years agogh-109413: Fix some trivial mypy nitpicks in libregrtest (#109454)
Alex Waygood [Fri, 15 Sep 2023 17:01:28 +0000 (18:01 +0100)] 
gh-109413: Fix some trivial mypy nitpicks in libregrtest (#109454)

2 years agogh-91960: Disable Cirrus CI for now (#109457)
Victor Stinner [Fri, 15 Sep 2023 16:41:25 +0000 (18:41 +0200)] 
gh-91960: Disable Cirrus CI for now (#109457)

Python is out of free credit and so all jobs are reported as failure.

Rename .cirrus.yml to .cirrus-DISABLED.yml to disable the job.

2 years agogh-109287: Desugar inst(X) to op(X); macro(X) = X (#109294)
Guido van Rossum [Fri, 15 Sep 2023 15:39:05 +0000 (08:39 -0700)] 
gh-109287: Desugar inst(X) to op(X); macro(X) = X (#109294)

This makes the internal representation in the code generator simpler: there's a list of ops, and a list of macros, and there's no special-casing needed for ops that aren't macros. (There's now special-casing for ops that are also macros, but that's simpler.)

2 years agoAdd missing `PyDoc_STR` calls (#109393)
Nikita Sobolev [Fri, 15 Sep 2023 13:10:48 +0000 (16:10 +0300)] 
Add missing `PyDoc_STR` calls (#109393)

In files:

* Modules/_ctypes/cfield.c
* Modules/_struct.c
* Objects/dictobject.c
* Objects/typevarobject.c
* Objects/unionobject.c

2 years agoFix date.__repr__() docstring (#109422)
Christopher Yeh [Fri, 15 Sep 2023 13:05:19 +0000 (06:05 -0700)] 
Fix date.__repr__() docstring (#109422)

2 years agoDocs: Superseded modules: list only module names (#109439)
Hugo van Kemenade [Fri, 15 Sep 2023 12:56:23 +0000 (06:56 -0600)] 
Docs: Superseded modules: list only module names (#109439)

2 years agogh-109395: Remove skipped macOS builds from Azure Pipelines (#109400)
Nikita Sobolev [Fri, 15 Sep 2023 08:55:09 +0000 (11:55 +0300)] 
gh-109395: Remove skipped macOS builds from Azure Pipelines (#109400)

2 years agogh-108303: Move `test_future` into its own test_future_stmt subdir (#109368)
Nikita Sobolev [Fri, 15 Sep 2023 07:52:24 +0000 (10:52 +0300)] 
gh-108303: Move `test_future` into its own test_future_stmt subdir (#109368)

2 years agogh-109395: Remove skipped coverage job from Azure Pipelines (#109412)
Hugo van Kemenade [Fri, 15 Sep 2023 05:27:47 +0000 (23:27 -0600)] 
gh-109395: Remove skipped coverage job from Azure Pipelines (#109412)

2 years agogh-109425: regrtest decodes worker stdout with backslashreplace (#109428)
Victor Stinner [Thu, 14 Sep 2023 23:37:37 +0000 (01:37 +0200)] 
gh-109425: regrtest decodes worker stdout with backslashreplace (#109428)

libregrtest now decodes stdout of test worker processes with the
"backslashreplace" error handler to log corrupted stdout, instead of
failing with an error and not logging the stdout.

2 years agogh-109375: Fix bug where pdb registers an alias without an associated command (#109376)
buermarc [Thu, 14 Sep 2023 21:31:30 +0000 (23:31 +0200)] 
gh-109375: Fix bug where pdb registers an alias without an associated command (#109376)

2 years agogh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (#109423)
Victor Stinner [Thu, 14 Sep 2023 21:24:11 +0000 (23:24 +0200)] 
gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (#109423)

Use a longer key: FIPS mode requires at least of at least 112 bits.
The previous key was only 32 bits.

2 years agogh-109418: Fix hypothesis strategy for b2a_roundtrip test (#109419)
Nikita Sobolev [Thu, 14 Sep 2023 20:38:31 +0000 (23:38 +0300)] 
gh-109418: Fix hypothesis strategy for b2a_roundtrip test (#109419)

2 years agogh-109413: libregrtest: Add and improve type annotations (#109405)
Alex Waygood [Thu, 14 Sep 2023 18:33:18 +0000 (19:33 +0100)] 
gh-109413: libregrtest: Add and improve type annotations (#109405)

2 years agogh-101100: Fix sphinx warnings in `turtle.rst` (#109394)
Nikita Sobolev [Thu, 14 Sep 2023 18:24:18 +0000 (21:24 +0300)] 
gh-101100: Fix sphinx warnings in `turtle.rst` (#109394)

2 years agogh-109219: propagate free vars through type param scopes (#109377)
Carl Meyer [Thu, 14 Sep 2023 16:20:32 +0000 (10:20 -0600)] 
gh-109219: propagate free vars through type param scopes (#109377)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-105658: fix excess trace events for except block ending with a conditional block...
Irit Katriel [Thu, 14 Sep 2023 16:06:08 +0000 (17:06 +0100)] 
gh-105658: fix excess trace events for except block ending with a conditional block (#109384)

2 years agodump readable opcode names in flowgraph debug utility (#109392)
Carl Meyer [Thu, 14 Sep 2023 14:28:21 +0000 (08:28 -0600)] 
dump readable opcode names in flowgraph debug utility (#109392)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2 years agogh-109402: Fix regrtest findtests() (#109403)
Victor Stinner [Thu, 14 Sep 2023 13:15:42 +0000 (15:15 +0200)] 
gh-109402: Fix regrtest findtests() (#109403)

Check for the full module name in SPLITTESTDIRS, not the relative
module name.

2 years agogh-107298: Document PyMODINIT_FUNC macro (#109236)
Victor Stinner [Thu, 14 Sep 2023 12:56:43 +0000 (14:56 +0200)] 
gh-107298: Document PyMODINIT_FUNC macro (#109236)

Document PyMODINIT_FUNC macro.

Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.

2 years agogh-107782: Use _testcapi to test non-representable signatures (GH-109325)
Serhiy Storchaka [Thu, 14 Sep 2023 06:12:17 +0000 (09:12 +0300)] 
gh-107782: Use _testcapi to test non-representable signatures (GH-109325)

Builtin functions and methods that have non-representable signatures today
will have representable signatures yesterday, and they will become unusable
for testing this feature.

So we need to add special functions and methods to the _testcapi module
that always have non-representable signatures.

2 years agoAdd missing PyDoc_STR to GenericAlias.__parameters__ (#108811)
James Hilton-Balfe [Thu, 14 Sep 2023 03:42:44 +0000 (04:42 +0100)] 
Add missing PyDoc_STR to GenericAlias.__parameters__ (#108811)

2 years agoFix invocation of wasm_build.py for node (GH-109383)
Sam Gross [Wed, 13 Sep 2023 22:28:08 +0000 (18:28 -0400)] 
Fix invocation of wasm_build.py for node (GH-109383)

2 years agoGH-104584: Don't call executors from JUMP_BACKWARD (GH-109347)
Brandt Bucher [Wed, 13 Sep 2023 17:26:50 +0000 (10:26 -0700)] 
GH-104584: Don't call executors from JUMP_BACKWARD (GH-109347)

2 years agoGH-105848: Replace KW_NAMES + CALL with LOAD_CONST + CALL_KW (GH-109300)
Brandt Bucher [Wed, 13 Sep 2023 17:25:45 +0000 (10:25 -0700)] 
GH-105848: Replace KW_NAMES + CALL with LOAD_CONST + CALL_KW (GH-109300)

2 years agogh-109341: Fix crash on compiling invalid AST including TypeAlias (#109349)
Jelle Zijlstra [Wed, 13 Sep 2023 16:00:39 +0000 (09:00 -0700)] 
gh-109341: Fix crash on compiling invalid AST including TypeAlias (#109349)

2 years agogh-109351: Fix crash when compiling AST with invalid NamedExpr (#109352)
Jelle Zijlstra [Wed, 13 Sep 2023 16:00:15 +0000 (09:00 -0700)] 
gh-109351: Fix crash when compiling AST with invalid NamedExpr (#109352)

2 years agogh-109156: Add tests for de-instrumenting instructions with instrumented lines (GH...
Tian Gao [Wed, 13 Sep 2023 08:47:35 +0000 (01:47 -0700)] 
gh-109156: Add tests for de-instrumenting instructions with instrumented lines (GH-109157)

2 years agoFix variable name in dis documentation example (GH-109343)
Oleksandr Kravets [Wed, 13 Sep 2023 05:07:56 +0000 (01:07 -0400)] 
Fix variable name in dis documentation example (GH-109343)

BINARY_SUBSCR example erroneously uses two different names `key` and `index` to refer to the same variable. STORE_SUBSCR and DELETE_SUBSCR use only `key` in the same context. Changing `index` to `key` for consistency.

2 years agogh-105189: fix importlib.resources.abc deprecation docs (#105232)
Thomas Grainger [Wed, 13 Sep 2023 04:42:26 +0000 (21:42 -0700)] 
gh-105189: fix importlib.resources.abc deprecation docs (#105232)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-104736: Fix test_gdb tests on ppc64le with clang (#109360)
Victor Stinner [Wed, 13 Sep 2023 04:24:32 +0000 (06:24 +0200)] 
gh-104736: Fix test_gdb tests on ppc64le with clang (#109360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.

2 years agogh-108346: Fix failed benchmark in decimal (#108353)
Charlie Zhao [Wed, 13 Sep 2023 04:17:55 +0000 (12:17 +0800)] 
gh-108346: Fix failed benchmark in decimal (#108353)

Fix benchmark in decimal to work again after the int str conversion limits.

2 years agogh-109357: Fix test_monitoring.test_gh108976() (#109358)
Victor Stinner [Wed, 13 Sep 2023 01:54:28 +0000 (03:54 +0200)] 
gh-109357: Fix test_monitoring.test_gh108976() (#109358)

The test now calls free_tool_id() so it can be run multiple times in
the same process. For example, the following command no longer fails:

    python -m test test_monitoring -R 3:3

2 years agogh-109276: libregrtest: fix work dir on WASI (#109356)
Victor Stinner [Wed, 13 Sep 2023 01:40:44 +0000 (03:40 +0200)] 
gh-109276: libregrtest: fix work dir on WASI (#109356)

On WASI platform, get_temp_dir() should behave differently since the
parent process is a WASI process and uses a different get_temp_dir()
path.

Fix also WorkerThread._runtest(): don't read JSON file if the worker
process exit code is non-zero.

2 years agogh-109276: libregrtest: WASM use stdout for JSON (#109355)
Victor Stinner [Wed, 13 Sep 2023 00:24:43 +0000 (02:24 +0200)] 
gh-109276: libregrtest: WASM use stdout for JSON (#109355)

On Emscripten and WASI, or if --python command line is used,
libregrtest now writes JSON into stdout, instead of using a name
file.

* Add JsonFileType.STDOUT.
* Remove JsonFileType.FILENAME.
* test.pythoninfo logs environment variables related to
  cross-compilation and running Python on Emscripten/WASI.

2 years agogh-109276: libregrtest: WASM use filename for JSON (#109340)
Victor Stinner [Tue, 12 Sep 2023 22:41:25 +0000 (00:41 +0200)] 
gh-109276: libregrtest: WASM use filename for JSON (#109340)

On Emscripten and WASI platforms, or if --python command line option
is used, libregrtest now uses a filename for the JSON file.

Emscripten and WASI buildbot workers run the main test process with a
different Python (Linux) which spawns Emscripten/WASI processes using
the command specified in --python command line option. Passing a file
descriptor from the parent process to the child process doesn't work
in this case.

* Add JsonFile and JsonFileType classes
* Add RunTests.json_file_use_filename() method.
* Add a test in test_regrtest on the --python command line option.
* test_regrtest: add parallel=False parameter.
* Split long RunWorkers._runtest() function into sub-functions.

2 years agoGH-109330: Dump and compare stats using opcode names, not numbers (GH-109335)
Michael Droettboom [Tue, 12 Sep 2023 21:12:57 +0000 (17:12 -0400)] 
GH-109330: Dump and compare stats using opcode names, not numbers (GH-109335)

2 years agoGH-104395: Add a link in 'Meta Information' to the docs download page (#104443)
Adam Turner [Tue, 12 Sep 2023 20:32:13 +0000 (21:32 +0100)] 
GH-104395: Add a link in 'Meta Information' to the docs download page (#104443)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agoUpdate workflow permissions in require-pr-label Action (#109342)
Mariatta [Tue, 12 Sep 2023 19:03:55 +0000 (12:03 -0700)] 
Update workflow permissions in require-pr-label Action (#109342)

Change the permission from `read` to `write`.

2 years agogh-106581: Honor 'always_exits' in write_components() (#109338)
Guido van Rossum [Tue, 12 Sep 2023 17:58:40 +0000 (10:58 -0700)] 
gh-106581: Honor 'always_exits' in write_components() (#109338)

I must have overlooked this when refactoring the code generator.
The Tier 1 interpreter contained a few silly things like
```
            goto resume_frame;
            STACK_SHRINK(1);
```
(and other variations, some where the unconditional `goto` was hidden in a macro).

2 years agogh-109276: test.pythoninfo gets more test.support data (#109337)
Victor Stinner [Tue, 12 Sep 2023 16:43:32 +0000 (18:43 +0200)] 
gh-109276: test.pythoninfo gets more test.support data (#109337)

Collect data from:

* test.support
* test.support.os_helper
* test.support.socket_helper
* test.support.threading_helper

2 years agogh-109319: deprecate dis.HAVE_ARGUMENT (#109320)
Irit Katriel [Tue, 12 Sep 2023 15:45:35 +0000 (16:45 +0100)] 
gh-109319: deprecate dis.HAVE_ARGUMENT (#109320)

2 years agogh-60283: Check for redefined test names in CI (#109161)
Hugo van Kemenade [Tue, 12 Sep 2023 15:28:20 +0000 (09:28 -0600)] 
gh-60283: Check for redefined test names in CI (#109161)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agogh-109184: update traceback module doc w.r.t notes (message is no longer always at...
Irit Katriel [Tue, 12 Sep 2023 14:54:04 +0000 (15:54 +0100)] 
gh-109184: update traceback module doc w.r.t notes (message is no longer always at the end) (#109201)

2 years agogh-109266: Fix msvcrt.kbhit's documented return value (GH-109267)
AN Long [Tue, 12 Sep 2023 14:44:48 +0000 (22:44 +0800)] 
gh-109266: Fix msvcrt.kbhit's documented return value (GH-109267)

2 years agogh-108303: Add `Lib/test/tokenizedata` to `TESTSUBDIRS` (#109314)
Nikita Sobolev [Tue, 12 Sep 2023 14:05:29 +0000 (17:05 +0300)] 
gh-108303: Add `Lib/test/tokenizedata` to `TESTSUBDIRS` (#109314)

2 years agogh-84867: Do not load tests from TestCase and FunctionTestCase (GH-100497)
Nikita Sobolev [Tue, 12 Sep 2023 13:33:30 +0000 (16:33 +0300)] 
gh-84867: Do not load tests from TestCase and FunctionTestCase (GH-100497)

2 years agogh-109276: libregrtest: fix worker working dir (#109313)
Victor Stinner [Tue, 12 Sep 2023 13:13:29 +0000 (15:13 +0200)] 
gh-109276: libregrtest: fix worker working dir (#109313)

Fix Emscripten and WASI: start the test worker process in the Python
source code directory, where 'python.js' and 'python.wasm' can be
found. Then worker_process() changes to a temporary directory created
to run tests.

* create_worker_process() uses os_helper.SAVEDCWD as cwd.
* worker_process() uses get_temp_dir() as the parent directory for
  get_work_dir().
* Don't use plural but singual for "test" in "Run 1 test ..."
  message.
* Remove unused imports.
* Add WORK_DIR_PREFIX and WORKER_WORK_DIR_PREFIX constants.

2 years agogh-109256: allocate opcode IDs for internal opcodes in their own range (#109269)
Irit Katriel [Tue, 12 Sep 2023 10:36:17 +0000 (11:36 +0100)] 
gh-109256: allocate opcode IDs for internal opcodes in their own range (#109269)

2 years agogh-109216: Fix possible memory leak in `BUILD_MAP` (#109257)
Nikita Sobolev [Tue, 12 Sep 2023 09:37:22 +0000 (12:37 +0300)] 
gh-109216: Fix possible memory leak in `BUILD_MAP` (#109257)

2 years agogh-108303: Move tokenize-related data to Lib/test/tokenizedata (GH-109265)
Nikita Sobolev [Tue, 12 Sep 2023 06:37:42 +0000 (09:37 +0300)] 
gh-108303: Move tokenize-related data to Lib/test/tokenizedata (GH-109265)

2 years agogh-109276: libregrtest: limit number workers (#109288)
Victor Stinner [Tue, 12 Sep 2023 03:47:04 +0000 (05:47 +0200)] 
gh-109276: libregrtest: limit number workers (#109288)

Don't spawn more threads than the number of jobs: these worker
threads would never get anything to do.

* Add the number of tests in "Run ... tests in ..." message.
* Add RunTests.get_jobs() method.
* Add plural() function.
* count() uses f-string.

2 years agogh-109276: libregrtest calls random.seed() before each test (#109279)
Victor Stinner [Tue, 12 Sep 2023 03:35:08 +0000 (05:35 +0200)] 
gh-109276: libregrtest calls random.seed() before each test (#109279)

libregrtest now calls random.seed() before running each test file
when -r/--randomize command line option is used. Moreover, it's also
called in worker processes. It should help to make tests more
deterministic. Previously, it was only called once in the main
process before running all test files and it was not called in worker
processes.

* Convert some f-strings to regular strings in test_regrtest when
  f-string is not needed.
* Remove unused all_methods variable from test_regrtest.
* Add RunTests members are now mandatory.

2 years agogh-109276: libregrtest only checks saved_test_environment() once (#109278)
Victor Stinner [Tue, 12 Sep 2023 03:01:33 +0000 (05:01 +0200)] 
gh-109276: libregrtest only checks saved_test_environment() once (#109278)

There is no need to check for environment changes twice.

2 years agogh-109276: Complete test.pythoninfo (#109312)
Victor Stinner [Tue, 12 Sep 2023 02:50:05 +0000 (04:50 +0200)] 
gh-109276: Complete test.pythoninfo (#109312)

* Enable collect_sysconfig() on Windows.
* Add sysconfig 'abs_builddir' and 'srcdir'
* Add sysconfig.is_python_build()
* Add tempfile.gettempdir()
* Remove compatiblity with Python 2.7 (print_function).

2 years agogh-109295: Skip test_generated_cases if different mount drives (#109308)
Victor Stinner [Tue, 12 Sep 2023 02:30:07 +0000 (04:30 +0200)] 
gh-109295: Skip test_generated_cases if different mount drives (#109308)

On Windows, skip the test if the current working directory and the
Python source code directory have different mount drives. It happens
if the temporary directory is on a different mount drive than the
Python source code.

2 years agoFix iter_index() to work with lists which do not support stop=None. (gh-109306)
Raymond Hettinger [Tue, 12 Sep 2023 02:04:28 +0000 (04:04 +0200)] 
Fix iter_index() to work with lists which do not support stop=None. (gh-109306)

2 years agogh-109295: Fix test_os.test_access_denied() for TEMP=cwd (#109299)
Victor Stinner [Tue, 12 Sep 2023 01:35:26 +0000 (03:35 +0200)] 
gh-109295: Fix test_os.test_access_denied() for TEMP=cwd (#109299)

Fix test_os.test_access_denied() when the TEMP environment variable
is equal to the current working directory. Run the test using a
different filename, since self.fname already exists in this case.

2 years agogh-109295: Clean up multiprocessing in test_asyncio and test_compileall (#109298)
Victor Stinner [Tue, 12 Sep 2023 01:31:15 +0000 (03:31 +0200)] 
gh-109295: Clean up multiprocessing in test_asyncio and test_compileall (#109298)

test_asyncio and test_compileall now clean up multiprocessing by
calling multiprocessing _cleanup_tests(): explicitly clean up
resources and stop background processes like the resource tracker.

2 years agoGH-106734: Disable tab completion in pdb's multiline mode (GH-106735)
Tian Gao [Tue, 12 Sep 2023 01:28:43 +0000 (18:28 -0700)] 
GH-106734: Disable tab completion in pdb's multiline mode (GH-106735)