Commit Graph

51001 Commits

Author SHA1 Message Date
Victor Stinner 1eb1b45183
gh-109702: Increase concurrent_futures deadlock timeout (#109703)
Replace SHORT_TIMEOUT with LONG_TIMEOUT in test_deadlock of
test_concurrent_futures.
2023-09-22 03:13:31 +02:00
AN Long 4230d7ce93
gh-108996: fix and enable test_msvcrt (#109226)
* Add _testconsole.flush_console_input_buffer() function.
* test_kbhit(), test_getwch() and test_getwche() now call
  flush_console_input_buffer().
* Don't override sys.stdin anymore (not needed).
2023-09-22 02:19:48 +02:00
Victor Stinner 26e06ad617
gh-108948: Skip test_tarfile.test_modes() on EFTYPE error (#109697)
On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
2023-09-22 00:59:08 +02:00
Davide Rizzo 608c1f3083
gh-109582: test_fork_signal_handling should wait for event (#109605)
Sometimes the child_handled event was missing because either
the child quits before it gets a chance to handle the signal,
or the parent asserts before the event notification is
delivered via IPC.  Synchronize explicitly to avoid this.
2023-09-21 23:20:29 +02:00
Victor Stinner 5b8f024683
gh-108303: Update test_fractions for new Lib/test/mathdata/ (#109686) 2023-09-21 19:48:20 +00:00
Nikita Sobolev ed587be0d0
gh-108303: Move all math files to `Lib/test/mathdata/` (#109512) 2023-09-21 21:14:41 +02:00
Nikita Sobolev 115c49ad5a
gh-109625: Move _ready_to_import() from test_import to support.import_helper (#109626) 2023-09-21 09:39:36 +02:00
Irit Katriel 9ccf0545ef
gh-109627: duplicated smalll exit blocks need to be assigned jump target labels (#109630) 2023-09-20 23:08:06 +00:00
Heinz-Alexander Fuetterer ef6d475db3
Fix typos in docs and comments (#109619) 2023-09-20 16:58:23 +00:00
Victor Stinner ced6924630
gh-108973: Fix asyncio test_subprocess_consistent_callbacks() (#109431)
SubprocessProtocol process_exited() method can be called before
pipe_data_received() and pipe_connection_lost() methods. Document it
and adapt the test for that.

Revert commit 282edd7b2a.
_child_watcher_callback() calls immediately _process_exited(): don't
add an additional delay with call_soon(). The reverted change didn't
make _process_exited() more determistic: it can still be called
before pipe_connection_lost() for example.

Co-authored-by: Davide Rizzo <sorcio@gmail.com>
2023-09-20 15:54:19 +02:00
Benjamin Peterson 850cc8d0b1
gh-109559: Update unicodedata checksums for 15.1.0. (#109597)
Update unicodedata checksums for 15.1.0.
2023-09-19 22:40:34 -07:00
Jelle Zijlstra 1293fcc3c6
gh-109543: Remove unnecessary hasattr check (#109544)
Also added a new test case covering the scenario I thought this
might be about.
2023-09-19 20:15:52 -07:00
Victor Stinner 81cd1bd713
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.
2023-09-20 01:58:34 +00:00
Mateusz Nowak 5a740cd06e
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>
2023-09-20 01:20:54 +00:00
Ronan Pigott ddf2e953c2
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.
2023-09-20 01:18:23 +02:00
Victor Stinner 754519a9f8
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.
2023-09-19 19:42:51 +02:00
Sam Gross 0c89056fe5
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>
2023-09-19 09:54:29 -06:00
Victor Stinner 0a31ff0050
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.
2023-09-19 14:42:08 +00:00
Nikita Sobolev 94c95d42a3
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.
2023-09-19 14:01:59 +02:00
Jenner afa7b0d743
no-issue: Fix typo TestContentTyopeHeader to TestContentTypeHeader (gh-109069) 2023-09-19 18:50:35 +09:00
Serhiy Storchaka beb5ec5817
gh-109546: Add more tests for formatting floats and fractions (GH-109548) 2023-09-19 08:09:11 +03:00
Xuehai Pan 74f315edd0
gh-102757: fix function signature mismatch for `functools.reduce` between code and documentation (#102759) 2023-09-18 10:42:58 -06:00
Victor Stinner 0bb0d88e2d
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.
2023-09-18 14:59:09 +00:00
Victor Stinner ef659b9616
gh-109508: Fix libregrtest formatting of getcwd() (#109537) 2023-09-18 16:45:48 +02:00
Tian Gao 412f5e85d6
gh-109371: Fix monitoring with instruction events set (gh-109385) 2023-09-18 23:30:08 +09:00
Shantanu 23f9f6f464
gh-108843: fix ast.unparse for f-string with many quotes (#108981) 2023-09-18 14:56:19 +01:00
Nikita Sobolev 4dd47c63a9
gh-108303: Fix and move `badsyntax_pep3120.py` (#109513)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-09-18 14:04:17 +01:00
Alex Waygood 54fbfa8d5e
gh-109413: Improve mypy config for libregrtest (#109518)
Improve the mypy config file for libregrtest
2023-09-17 17:35:51 -07:00
Serhiy Storchaka add16f1a5e
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()
2023-09-17 14:23:31 +03:00
Nikita Sobolev e57ecf6bbc
gh-108303: Move all certificates to `Lib/test/certdata/` (#109489) 2023-09-16 18:47:18 +02:00
Brett Cannon e218e5022e
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>
2023-09-15 22:38:08 +00:00
Gregory P. Smith 59073c9ab8
gh-109096: Deprecate `http.server.CGIHTTPRequestHandler` (#109387)
Deprecate `http.server.CGIHTTPRequestHandler`.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-09-15 14:26:45 -07:00
Alex Waygood 92ed7e4df1
gh-109413: Fix some trivial mypy nitpicks in libregrtest (#109454) 2023-09-15 17:01:28 +00:00
Christopher Yeh 5eec58a9e5
Fix date.__repr__() docstring (#109422) 2023-09-15 15:05:19 +02:00
Nikita Sobolev 82505dc351
gh-108303: Move `test_future` into its own test_future_stmt subdir (#109368) 2023-09-15 09:52:24 +02:00
Victor Stinner 74c72a2fc7
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.
2023-09-14 23:37:37 +00:00
buermarc 68a6f21f47
gh-109375: Fix bug where pdb registers an alias without an associated command (#109376) 2023-09-14 22:31:30 +01:00
Victor Stinner e091b9f20f
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.
2023-09-14 21:24:11 +00:00
Nikita Sobolev d7dc3d9455
gh-109418: Fix hypothesis strategy for b2a_roundtrip test (#109419) 2023-09-14 14:38:31 -06:00
Alex Waygood 3b9d10b031
gh-109413: libregrtest: Add and improve type annotations (#109405) 2023-09-14 18:33:18 +00:00
Carl Meyer 909adb5092
gh-109219: propagate free vars through type param scopes (#109377)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-09-14 10:20:32 -06:00
Irit Katriel 4a54074a0f
gh-105658: fix excess trace events for except block ending with a conditional block (#109384) 2023-09-14 17:06:08 +01:00
Victor Stinner 9ccd2e6aee
gh-109402: Fix regrtest findtests() (#109403)
Check for the full module name in SPLITTESTDIRS, not the relative
module name.
2023-09-14 13:15:42 +00:00
Serhiy Storchaka 1f885df2a5
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.
2023-09-14 09:12:17 +03:00
Brandt Bucher 22e65eecaa
GH-105848: Replace KW_NAMES + CALL with LOAD_CONST + CALL_KW (GH-109300) 2023-09-13 10:25:45 -07:00
Jelle Zijlstra 987b4bc087
gh-109341: Fix crash on compiling invalid AST including TypeAlias (#109349) 2023-09-13 09:00:39 -07:00
Jelle Zijlstra 79101edb03
gh-109351: Fix crash when compiling AST with invalid NamedExpr (#109352) 2023-09-13 09:00:15 -07:00
Tian Gao d69805b38a
gh-109156: Add tests for de-instrumenting instructions with instrumented lines (GH-109157) 2023-09-13 09:47:35 +01:00
Victor Stinner 44d9a71ea2
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.
2023-09-13 04:24:32 +00:00
Victor Stinner 388d91cd47
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
2023-09-13 01:54:28 +00:00