Commit graph

30238 commits

Author SHA1 Message Date
Miss Islington (bot)
68ba35eecb
[3.12] gh-68403: Fix test_coverage in test_trace (GH-108910) (#109104)
gh-68403: Fix test_coverage in test_trace (GH-108910)

Its behavior no longer affected by test running options such as -m.
(cherry picked from commit 7e1a7abb98)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-08 15:25:18 +02:00
Miss Islington (bot)
41ff5b0674
[3.12] gh-75743: Restore test_timeout.testConnectTimeout() (GH-109087) (#109103)
gh-75743: Restore test_timeout.testConnectTimeout() (GH-109087)

This un-skips this test now that pythontest.net implements appropriate firewall
rules for it.
(cherry picked from commit 1829a3c9a3)

Co-authored-by: Ee Durbin <ewdurbin@gmail.com>
2023-09-08 15:24:55 +02:00
Miss Islington (bot)
02e51f86d8
[3.12] gh-103186: Remove debug print in test_sys_settrace (GH-109077) (#109084)
gh-103186: Remove debug print in test_sys_settrace (GH-109077)
(cherry picked from commit e4bb0026b9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-08 15:22:19 +02:00
Miss Islington (bot)
29404b6d25
[3.12] gh-103186: Suppress and assert expected RuntimeWarnings in test_sys_settrace (GH-103244) (#109066)
gh-103186: Suppress and assert expected RuntimeWarnings in test_sys_settrace (GH-103244)

Caused as a result of frame manipulation where locals are never assigned / initialised.
(cherry picked from commit 3e53ac9903)

Co-authored-by: Ijtaba Hussain <ijtabahussain@live.com>
2023-09-08 15:21:38 +02:00
Miss Islington (bot)
8c9f5f714e
[3.12] test.pythoninfo logs freedesktop_os_release() (GH-109057) (#109064)
test.pythoninfo logs freedesktop_os_release() (GH-109057)
(cherry picked from commit babdced23f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-08 15:20:05 +02:00
Miss Islington (bot)
55d7e8fef1
[3.12] gh-108851: Fix tomllib recursion tests (GH-108853) (#109012)
gh-108851: Fix tomllib recursion tests (GH-108853)

* Add get_recursion_available() and get_recursion_depth() functions
  to the test.support module.
* Change infinite_recursion() default max_depth from 75 to 100.
* Fix test_tomllib recursion tests for WASI buildbots: reduce the
  recursion limit and compute the maximum nested array/dict depending
  on the current available recursion limit.
* test.pythoninfo logs sys.getrecursionlimit().
* Enhance test_sys tests on sys.getrecursionlimit()
  and sys.setrecursionlimit().
(cherry picked from commit 8ff1142578)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-08 15:18:02 +02:00
Miss Islington (bot)
038b0a9cb0
[3.12] gh-89392: Use unittest test runner for doctests in test_getopt (GH-108916) (#108919)
gh-89392: Use unittest test runner for doctests in test_getopt (GH-108916)
(cherry picked from commit f980cc19b9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-08 15:17:14 +02:00
Miss Islington (bot)
da02508a0e
[3.12] gh-89392: Use normal unittest runner in test_type_cache (GH-108911) (#108913)
gh-89392: Use normal unittest runner in test_type_cache (GH-108911)
(cherry picked from commit eaabaac7c0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-08 15:16:55 +02:00
Miss Islington (bot)
4b749ba470
[3.12] gh-91960: Skip test_gdb if gdb cannot retrive Python frames (GH-108999) (#109010)
gh-91960: Skip test_gdb if gdb cannot retrive Python frames (GH-108999)

Skip test_gdb if gdb is unable to retrieve Python frame objects: if a
frame is "<optimized out>". When Python is built with "clang -Og",
gdb can fail to retrive the 'frame' parameter of
_PyEval_EvalFrameDefault(). In this case, tests like py_bt() are
likely to fail. Without getting access to Python frames,
python-gdb.py is mostly clueless on retrieving the Python traceback.
Moreover, test_gdb is no longer skipped on macOS if Python is built
with Clang.
(cherry picked from commit fbce43a251)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-08 15:16:16 +02:00
Miss Islington (bot)
9441005bcf
[3.12] gh-108983: Add more PEP 526 tests to test_grammar (GH-108984) (#109000)
gh-108983: Add more PEP 526 tests to `test_grammar` (GH-108984)
(cherry picked from commit 1fb20d42c5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-09-08 15:16:02 +02:00
Miss Islington (bot)
b9dfe60e8d
[3.12] gh-108962: Skip test_tempfile.test_flags() if not supported (GH-108964) (#108967)
gh-108962: Skip test_tempfile.test_flags() if not supported (GH-108964)

Skip test_tempfile.test_flags() if chflags() fails with "OSError:
[Errno 45] Operation not supported" (ex: on FreeBSD 13).
(cherry picked from commit cd2ef21b07)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-08 15:14:57 +02:00
Victor Stinner
0855b2c8b6
[3.12] gh-108834: Sync libregrtest with the main branch (#108966)
* gh-108834: regrtest reruns failed tests in subprocesses (#108839)

When using --rerun option, regrtest now re-runs failed tests
in verbose mode in fresh worker processes to have more
deterministic behavior. So it can write its final report even
if a test killed a worker progress.

Add --fail-rerun option to regrtest: exit with non-zero exit code
if a test failed pass passed when re-run in verbose mode (in a
fresh process). That's now more useful since tests can pass
when re-run in a fresh worker progress, whereas they failed
when run after other tests when tests are run sequentially.

Rename --verbose2 option (-w) to --rerun. Keep --verbose2 as a
deprecated alias.

Changes:

* Fix and enhance statistics in regrtest summary. Add "(filtered)"
  when --match and/or --ignore options are used.
* Add RunTests class.
* Add TestResult.get_rerun_match_tests() method
* Rewrite code to serialize/deserialize worker arguments as JSON
  using a new WorkerJob class.
* Fix stats when a test is run with --forever --rerun.
* If failed test names cannot be parsed, log a warning and don't
  filter tests.
* test_regrtest.test_rerun_success() now uses a marker file, since
  the test is re-run in a separated process.
* Add tests on normalize_test_name() function.
* Add test_success() and test_skip() tests to test_regrtest.

(cherry picked from commit 31c2945f14)

* gh-108834: regrtest --fail-rerun exits with code 5 (#108896)

When the --fail-rerun option is used and a test fails and then pass,
regrtest now uses exit code 5 ("rerun) instead of 2 ("bad test").

(cherry picked from commit 1170d5a292)

* gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') (GH-108480)

(cherry picked from commit 1e0d62793a)

* Manually sync Lib/test/libregrtest/ from main

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-08 15:14:17 +02:00
Miss Islington (bot)
c9dc2bc0de
[3.12] gh-109015: Add test.support.socket_helper.tcp_blackhole() (GH-109016) (#109041)
gh-109015: Add test.support.socket_helper.tcp_blackhole() (GH-109016)

Skip test_asyncio, test_imaplib and test_socket tests if FreeBSD TCP
blackhole is enabled (net.inet.tcp.blackhole=2).
(cherry picked from commit a52a350977)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-08 15:12:29 +02:00
Miss Islington (bot)
495ba70356
[3.12] gh-108469: Update ast.unparse for unescaped quote support from PEP701 [3.12] (GH-108553) (#108960)
Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com>
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2023-09-05 20:49:55 +00:00
Miss Islington (bot)
460043b554
[3.12] gh-108927: Fix test_import + test_importlib + test_unittest problem (GH-108929) (#108954)
gh-108927: Fix test_import + test_importlib + test_unittest problem (GH-108929)
(cherry picked from commit 3f89b25763)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-09-05 20:43:47 +00:00
Mark Shannon
7ee021f999
[3.12] GH-108390: Prevent non-local events being set with sys.monitoring.set_local_events() (GH-108420) (#108899)
* GH-108390: Prevent non-local events being set with `sys.monitoring.set_local_events()` (GH-108420)

* Restore generated objects

* Restore size of monitoring arrays in code object for 3.12 ABI compatibility.

* Update ABI file
2023-09-05 11:29:38 +00:00
Serhiy Storchaka
5121faabd1
[3.12] gh-89392: Remove support of test_main() in libregrtest (GH-108876) (#108897)
[3.12] gh-89392: Remove support of test_main() in libregrtest (GH-108876).
(cherry picked from commit 04a0830b00)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-09-05 11:18:41 +00:00
Serhiy Storchaka
e76b0b7783
[3.12] bpo-45229: Make ElementTree tests discoverable (GH-108859) (#108873)
[3.12] bpo-45229: Make ElementTree tests discoverable (GH-108859).
(cherry picked from commit 074ac1f72e)
2023-09-05 12:51:37 +02:00
Serhiy Storchaka
88ff02e3c5
[3.12] gh-89392: Remove test_main() in test_netrc (GH-108860) (#108872)
[3.12] gh-89392: Remove test_main() in test_netrc (GH-108860).
(cherry picked from commit 76f3c043b6)

Co-authored-by: T. Wouters <thomas@python.org>
2023-09-04 21:13:02 +02:00
Miss Islington (bot)
bce77915b6
[3.12] Disable differing_test_runners health check (GH-108886) (#108887)
Disable `differing_test_runners` health check (GH-108886)
(cherry picked from commit 6ead5bd6ae)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-09-04 21:11:16 +02:00
Serhiy Storchaka
d5c2d453fd
[3.12] gh-89392: Make test_pep646_syntax discoverable (GH-108861) (#108871)
* [3.12] gh-89392: Make test_pep646_syntax discoverable (GH-108861).
(cherry picked from commit d0b22f6bd8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

* Add "import unittest".
2023-09-04 18:41:42 +02:00
Łukasz Langa
e0f6080819
[3.12] gh-46376: Revert "Return existing pointer when possible in ctypes (GH-107131) (GH-107487)" (#108864)
This reverts commit 54aaaadef8.

Co-authored-by: T. Wouters <thomas@python.org>
2023-09-04 16:24:16 +02:00
Miss Islington (bot)
7b936ac12e
[3.12] Reorder some test's decorators (GH-108804) (#108844)
Reorder some test's decorators (GH-108804)

For example, do not demand the 'cpu' resource if the test cannot be run
due to non-working threads.
(cherry picked from commit 509bb61977)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-04 13:47:07 +02:00
Victor Stinner
c8cf6be213
[3.12] gh-108822: regrtest computes statistics (#108793) (#108833)
gh-108822: regrtest computes statistics (#108793)

test_netrc, test_pep646_syntax and test_xml_etree now return results
in the test_main() function.

Changes:

* Rewrite TestResult as a dataclass with a new State class.
* Add test.support.TestStats class and Regrtest.stats_dict attribute.
* libregrtest.runtest functions now modify a TestResult instance
  in-place.
* libregrtest summary lists the number of run tests and skipped
  tests, and denied resources.
* Add TestResult.has_meaningful_duration() method.
* Compute TestResult duration in the upper function.
* Use time.perf_counter() instead of time.monotonic().
* Regrtest: rename 'resource_denieds' attribute to 'resource_denied'.
* Rename CHILD_ERROR to MULTIPROCESSING_ERROR.
* Use match/case syntadx to have different code depending on the
  test state.

Notes on the backport: doctest.TestResults.skipped is a new feature
in Python 3.13, so don't use it in the backport.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit d4e534cbb3)
2023-09-04 13:45:50 +02:00
Miss Islington (bot)
dcaacd9066
[3.12] gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421) (#108798)
gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421)

Only mark tests which spend significant system or user time,
by itself or in subprocesses.
(cherry picked from commit f3ba0a74cd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-09-03 01:22:33 +02:00
Miss Islington (bot)
4dc07d2bde
[3.12] Make test_fcntl quiet (GH-108758) (#108760)
Make test_fcntl quiet (GH-108758)

Running test_fcntl logs two "struct.pack: ..." lines because
multiprocessing imports test_fcntl twice with
test.support.verbose=1. Move get_lockdata() inside TestFcntl test
case and only call it where it's needed, to stop logging these lines.
(cherry picked from commit 23f54c1200)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-09-01 15:36:52 +02:00
Miss Islington (bot)
56683097f4
[3.12] gh-107805: Fix signatures of module-level generated functions in turtle (GH-107807) (#108749)
gh-107805: Fix signatures of module-level generated functions in `turtle` (GH-107807)
(cherry picked from commit 044b8b3b6a)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-09-01 15:32:35 +02:00
Miss Islington (bot)
8c3793a539
[3.12] gh-108682: [Enum] raise TypeError if super().__new__ called in custom __new__ (GH-108704) (#108733)
gh-108682: [Enum] raise TypeError if super().__new__ called in custom __new__ (GH-108704)

When overriding the `__new__` method of an enum, the underlying data type should be created directly; i.e. .

    member = object.__new__(cls)
    member = int.__new__(cls, value)
    member = str.__new__(cls, value)

Calling `super().__new__()` finds the lookup version of `Enum.__new__`, and will now raise an exception when detected.
(cherry picked from commit d48760b2f1)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-09-01 00:04:55 +02:00
Miss Islington (bot)
1a15d20b75
[3.12] gh-108654: restore comprehension locals before handling exception (GH-108659) (#108700)
gh-108654: restore comprehension locals before handling exception (GH-108659)
(cherry picked from commit d52c4482a8)

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2023-08-31 15:32:17 +02:00
Miss Islington (bot)
320d398262
[3.12] gh-108520: Fix bad fork detection in nested multiprocessing use case (GH-108568) (#108691)
gh-108520: Fix bad fork detection in nested multiprocessing use case (GH-108568)

gh-107275 introduced a regression where a SemLock would fail being passed along nested child processes, as the `is_fork_ctx` attribute would be left missing after the first deserialization.

---------

(cherry picked from commit add8d45cbe)

Co-authored-by: albanD <desmaison.alban@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
2023-08-30 23:18:49 +02:00
Miss Islington (bot)
4afc5d8716
[3.12] gh-108617: Extend interactive session tests for sqlite3 (GH-108556) (#108626)
gh-108617: Extend interactive session tests for sqlite3 (GH-108556)
(cherry picked from commit ecb2bf02a4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-08-29 20:30:23 +02:00
Miss Islington (bot)
1478a386e6
[3.12] gh-108558: Improve sqlite3 row factory tests (GH-108578) (#108615)
* gh-108558: Improve sqlite3 row factory tests (GH-108578)

Add test_sqlite_row_keys() to explicitly test sqlite3.Row.keys().

Cleanups:
- Reduce test noise by converting docstrings to regular comments
- Reduce boilerplate code by adding a setUp() method to RowFactoryTests

(cherry picked from commit 6eaddc10e9)

Co-authored-by: Edward Schauman-Haigh <142528725+EddInSverige@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>

* Fix backport

---------

Co-authored-by: Edward Schauman-Haigh <142528725+EddInSverige@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-08-29 20:29:52 +02:00
Miss Islington (bot)
f5c5f32f5a
[3.12] gh-108550: Speed up sqlite3 tests (GH-108551) (#108566)
gh-108550: Speed up sqlite3 tests (GH-108551)

Refactor the CLI so we can easily invoke it and mock command-line
arguments. Adapt the CLI tests so we no longer have to launch a
separate process.

Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

The sqlite3 test suite now completes ~8 times faster than before.

(cherry picked from commit 0e8b3fc718)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-08-29 00:26:29 +02:00
Erlend E. Aasland
b451e9020d
[3.12] gh-64662: Fix virtual table support in sqlite3.Connection.iterdump (#108340) (#108563)
* [3.12] gh-64662: Add virtual table support to sqlite3.Connection.iterdump (#108340)

(cherry picked from commit d0160c7c22)

Co-authored-by: Aviv Palivoda <palaviv@gmail.com>

* The _quote_value helper is not part of 3.12; spell out the replacement

* With quotes

* Ok, let's use explicit quoting

---------

Co-authored-by: Aviv Palivoda <palaviv@gmail.com>
2023-08-29 00:25:35 +02:00
Miss Islington (bot)
09877a15d5
[3.12] gh-108295: Fix crashes with TypeVar weakrefs (GH-108517) (#108527)
gh-108295: Fix crashes with TypeVar weakrefs (GH-108517)
(cherry picked from commit 482fad7f01)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-08-27 16:12:57 +02:00
Victor Stinner
bba9aa60ae
[3.12] gh-108388: Convert test_concurrent_futures to package (#108401) (#108443)
gh-108388: Convert test_concurrent_futures to package (#108401)

Convert test_concurrent_futures to a package of sub-tests.

(cherry picked from commit aa6f787faa)
2023-08-27 01:20:33 +02:00
Miss Islington (bot)
b28aaf98be
[3.12] gh-108418: Speed up bigmem compression tests in dry mode (GH-108419) (#108473)
gh-108418: Speed up bigmem compression tests in dry mode (GH-108419)

Only generate and compress small amount of random data in dry run.
(cherry picked from commit 4ae3edf300)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-08-25 18:22:06 +02:00
Miss Islington (bot)
0eb6d87304
[3.12] gh-80527: Change support.requires_legacy_unicode_capi() (GH-108438) (#108446)
gh-80527: Change support.requires_legacy_unicode_capi() (GH-108438)

The decorator now requires to be called with parenthesis:

    @support.requires_legacy_unicode_capi()

instead of:

    @support.requires_legacy_unicode_capi

The implementation now only imports _testcapi when the decorator is
called, so "import test.support" no longer imports the _testcapi
extension.
(cherry picked from commit 995f4c48e1)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-25 18:18:24 +02:00
Miss Islington (bot)
22621907ee
[3.12] gh-108388: Split test_multiprocessing_spawn (GH-108396) (#108442)
gh-108388: Split test_multiprocessing_spawn (GH-108396)

Split test_multiprocessing_fork, test_multiprocessing_forkserver and
test_multiprocessing_spawn into test packages. Each package is made
of 4 sub-tests: processes, threads, manager and misc. It allows
running more tests in parallel and so reduce the total test duration.
(cherry picked from commit aa9a359ca2)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-25 18:15:53 +02:00
Miss Islington (bot)
20357ed2a4
[3.12] gh-108111: Flush gzip write buffer before seeking, fixing bad writes (GH-108341) (#108402)
gh-108111: Flush gzip write buffer before seeking, fixing bad writes (GH-108341)
(cherry picked from commit 2eb60c1934)

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-08-24 12:30:16 +02:00
Łukasz Langa
459f24aef0
[3.12] gh-108342: Make ssl TestPreHandshakeClose more reliable (GH-108370) (#108404)
* In preauth tests of test_ssl, explicitly break reference cycles
  invoving SingleConnectionTestServerThread to make sure that the
  thread is deleted. Otherwise, the test marks the environment as
  altered because the threading module sees a "dangling thread"
  (SingleConnectionTestServerThread). This test leak was introduced
  by the test added for the fix of issue gh-108310.
* Use support.SHORT_TIMEOUT instead of hardcoded 1.0 or 2.0 seconds
  timeout.
* SingleConnectionTestServerThread.run() catchs TimeoutError
* Fix a race condition (missing synchronization) in
  test_preauth_data_to_tls_client(): the server now waits until the
  client connect() completed in call_after_accept().
* test_https_client_non_tls_response_ignored() calls server.join()
  explicitly.
* Replace "localhost" with server.listener.getsockname()[0].
(cherry picked from commit 592bacb6fc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-24 12:08:43 +02:00
Miss Islington (bot)
9903fe1c2a
[3.12] gh-108388: regrtest splits test_asyncio package (GH-108393) (#108397)
gh-108388: regrtest splits test_asyncio package (GH-108393)

Currently, test_asyncio package is only splitted into sub-tests when
using command "./python -m test". With this change, it's also
splitted when passing it on the command line:
"./python -m test test_asyncio".

Remove the concept of "STDTESTS". Python is now mature enough to not
have to bother with that anymore. Removing STDTESTS simplify the
code.
(cherry picked from commit 174e9da083)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-24 10:20:40 +02:00
Miss Islington (bot)
9cf49aaaa0
[3.12] gh-77377: Ensure multiprocessing SemLock is valid for spawn-based Process before serializing it (GH-107275) (#108377)
gh-77377: Ensure multiprocessing SemLock is valid for spawn-based Process before serializing it (GH-107275)

Ensure multiprocessing SemLock is valid for spawn Process before serializing it.

Creating a multiprocessing SemLock with a fork context, and then trying to pass it to a spawn-created Process, would segfault if not detected early.

---------

(cherry picked from commit 1700d34d31)

Co-authored-by: albanD <desmaison.alban@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
2023-08-24 01:44:07 +02:00
Miss Islington (bot)
0d6e657689
[3.12] gh-105776: Fix test_cppext when CC contains -std=c11 option (GH-108343) (#108345)
gh-105776: Fix test_cppext when CC contains -std=c11 option (GH-108343)

Fix test_cppext when the C compiler command has the "-std=c11" option.
Remove "-std=" options from the compiler command.
(cherry picked from commit 9173b2bbe1)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-23 13:45:37 +02:00
Miss Islington (bot)
b539dd3073
[3.12] gh-108303: Add Lib/test/test_cppext/ sub-directory (GH-108325) (#108328)
gh-108303: Add Lib/test/test_cppext/ sub-directory (GH-108325)

* Move test_cppext to its own directory
* Rename setup_testcppext.py to setup.py
* Rename _testcppext.cpp to extension.cpp
* The source (extension.cpp) is now also copied by the test.
(cherry picked from commit 21dda09600)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-22 22:06:33 +02:00
Victor Stinner
ca47a2183a
[3.12] gh-106016: Add Lib/test/test_module/ directory (#108293) (#108306)
gh-106016: Add Lib/test/test_module/ directory (#108293)

* Move Python scripts related to test_module to this new directory:
  good_getattr.py and bad_getattrX.py scripts.
* Move Lib/test/test_module.py to Lib/test/test_module/__init__.py.

(cherry picked from commit adfc118fda)
2023-08-22 22:06:07 +02:00
Łukasz Langa
256586ab87
[3.12] gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close flaw (#108316)
Instances of `ssl.SSLSocket` were vulnerable to a bypass of the TLS handshake
and included protections (like certificate verification) and treating sent
unencrypted data as if it were post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is sent by the
malicious peer and stored in a buffer, and then the malicious peer closes the
socket within a small timing window before the other peers’ TLS handshake can
begin. After this sequence of events the closed socket will not immediately
attempt a TLS handshake due to not being connected but will also allow the
buffered data to be read as if a successful TLS handshake had occurred.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-08-22 21:03:20 +02:00
Miss Islington (bot)
4ee9454792
[3.12] gh-107901: Fix missing line number on BACKWARD_JUMP at the end of a for loop (GH-108242) (#108275)
gh-107901: Fix missing line number on BACKWARD_JUMP at the end of a for loop (GH-108242)
(cherry picked from commit a1cc74c4ee)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-08-22 16:15:34 +02:00
Miss Islington (bot)
149d70c254
[3.12] gh-108179: Add error message for parser stack overflows (GH-108256) (#108263)
gh-108179: Add error message for parser stack overflows (GH-108256)
(cherry picked from commit 86617518c4)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2023-08-22 12:02:32 +02:00
Miss Islington (bot)
dd73f2f76a
[3.12] gh-106242: Make ntpath.realpath errors consistent with abspath when there are embedded nulls (GH-108248) (#108251)
gh-106242: Make ntpath.realpath errors consistent with abspath when there are embedded nulls (GH-108248)

* gh-106242: Make ntpath.realpath errors consistent with abspath when there are embedded nulls

* Update 2023-08-22-00-36-57.gh-issue-106242.q24ITw.rst

mention Windows and the former incorrect ValueError.

---------

(cherry picked from commit de33b5c662)

Co-authored-by: Steve Dower <steve.dower@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-08-22 12:01:24 +02:00