summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* gh-109256: allocate opcode IDs for internal opcodes in their own range (#109269)Irit Katriel2023-09-1211-742/+757
|
* gh-109216: Fix possible memory leak in `BUILD_MAP` (#109257)Nikita Sobolev2023-09-124-9/+1
|
* gh-108303: Move tokenize-related data to Lib/test/tokenizedata (GH-109265)Nikita Sobolev2023-09-1218-25/+40
|
* gh-109276: libregrtest: limit number workers (#109288)Victor Stinner2023-09-124-5/+40
| | | | | | | | | 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.
* gh-109276: libregrtest calls random.seed() before each test (#109279)Victor Stinner2023-09-125-34/+94
| | | | | | | | | | | | | 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.
* gh-109276: libregrtest only checks saved_test_environment() once (#109278)Victor Stinner2023-09-122-15/+12
| | | There is no need to check for environment changes twice.
* gh-109276: Complete test.pythoninfo (#109312)Victor Stinner2023-09-121-10/+11
| | | | | | | * 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).
* gh-109295: Skip test_generated_cases if different mount drives (#109308)Victor Stinner2023-09-121-1/+21
| | | | | | 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.
* Fix iter_index() to work with lists which do not support stop=None. (gh-109306)Raymond Hettinger2023-09-121-0/+11
|
* gh-109295: Fix test_os.test_access_denied() for TEMP=cwd (#109299)Victor Stinner2023-09-121-1/+1
| | | | | 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.
* gh-109295: Clean up multiprocessing in test_asyncio and test_compileall ↵Victor Stinner2023-09-122-3/+10
| | | | | | | (#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.
* GH-106734: Disable tab completion in pdb's multiline mode (GH-106735)Tian Gao2023-09-122-21/+39
|
* gh-109118: Disallow nested scopes within PEP 695 scopes within classes (#109196)Jelle Zijlstra2023-09-123-0/+118
| | | | | Fixes #109118. Fixes #109194. Co-authored-by: Carl Meyer <carl@oddbird.net>
* gh-109292: add symtable impact of PEP 709 to What's New (#109293)Carl Meyer2023-09-121-0/+3
|
* gh-109195: fix source location for super load before LOAD_SUPER_ATTR (#109289)Carl Meyer2023-09-113-1/+12
|
* gh-109214: Rename SAVE_IP to _SET_IP, and similar (#109285)Guido van Rossum2023-09-1111-117/+117
| | | | | | | | * Rename SAVE_IP to _SET_IP * Rename EXIT_TRACE to _EXIT_TRACE * Rename SAVE_CURRENT_IP to _SAVE_CURRENT_IP * Rename INSERT to _INSERT (This is for Ken Jin's abstract interpreter) * Rename IS_NONE to _IS_NONE * Rename JUMP_TO_TOP to _JUMP_TO_TOP
* gh-107322: zipapp: Remove the suggestion to remove .dist-info directories ↵wim glenn2023-09-111-6/+1
| | | | | (#107296) Removed zipapp suggestion to rm .dist-info subdirectories. This totally breaks importlib.metadata
* gh-109039: Branch prediction for Tier 2 interpreter (#109038)Guido van Rossum2023-09-1115-181/+339
| | | | | | | | | | | This adds a 16-bit inline cache entry to the conditional branch instructions POP_JUMP_IF_{FALSE,TRUE,NONE,NOT_NONE} and their instrumented variants, which is used to keep track of the branch direction. Each time we encounter these instructions we shift the cache entry left by one and set the bottom bit to whether we jumped. Then when it's time to translate such a branch to Tier 2 uops, we use the bit count from the cache entry to decided whether to continue translating the "didn't jump" branch or the "jumped" branch. The counter is initialized to a pattern of alternating ones and zeros to avoid bias. The .pyc file magic number is updated. There's a new test, some fixes for existing tests, and a few miscellaneous cleanups.
* gh-109179: Fix traceback display for SyntaxErrors with notes (#109197)Irit Katriel2023-09-113-34/+34
|
* gh-109276: libregrtest: use separated file for JSON (#109277)Victor Stinner2023-09-116-36/+84
| | | | | | | | | | | | | | libregrtest now uses a separated file descriptor to write test result as JSON. Previously, if a test wrote debug messages late around the JSON, the main test process failed to parse JSON. Rename TestResult.write_json() to TestResult.write_json_into(). worker_process() no longer writes an empty line at the end. There is no need to separate test process output from the JSON output anymore, since JSON is now written into a separated file descriptor. create_worker_process() now always spawn the process with close_fds=True.
* gh-90805: Make sure test_functools works with and without _functoolsmodule ↵Nikita Sobolev2023-09-111-30/+28
| | | | (GH-108644)
* gh-109190: What's New in 3.12: Add subheadings to removals for easy linking ↵Hugo van Kemenade2023-09-111-52/+107
| | | | | | (#109159) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-108987: Fix _thread.start_new_thread() race condition (#109135)Victor Stinner2023-09-115-41/+69
| | | | | | | | | | | | | Fix _thread.start_new_thread() race condition. If a thread is created during Python finalization, the newly spawned thread now exits immediately instead of trying to access freed memory and lead to a crash. thread_run() calls PyEval_AcquireThread() which checks if the thread must exit. The problem was that tstate was dereferenced earlier in _PyThreadState_Bind() which leads to a crash most of the time. Move _PyThreadState_CheckConsistency() from thread_run() to _PyThreadState_Bind().
* gh-109182: Fix and improve tests for gh-108654 (GH-109189)Serhiy Storchaka2023-09-111-18/+28
|
* GH-108976. Keep monitoring data structures valid during de-optimization ↵Mark Shannon2023-09-114-55/+79
| | | | during callback. (GH-109131)
* Better integration of doctest and unittest in test_ctypes.test_objects ↵Serhiy Storchaka2023-09-111-6/+4
| | | | | (GH-108922) Better integration of docrtest and unittest in test_ctypes.test_objects
* Test DocTestFinder directly instead of calling support.run_doctest() (GH-108917)Serhiy Storchaka2023-09-111-5/+3
|
* gh-109162: libregrtest: move code around (#109253)Victor Stinner2023-09-113-93/+105
| | | | | * Move Regrtest.display_header() to utils.py. * Move cleanup_temp_dir() to utils.py. * Move list_cases() to findtests.py.
* gh-107219: Fix concurrent.futures terminate_broken() (#109244)Victor Stinner2023-09-113-0/+27
| | | | | | | | | | | | | | | Fix a race condition in concurrent.futures. When a process in the process pool was terminated abruptly (while the future was running or pending), close the connection write end. If the call queue is blocked on sending bytes to a worker process, closing the connection write end interrupts the send, so the queue can be closed. Changes: * _ExecutorManagerThread.terminate_broken() now closes call_queue._writer. * multiprocessing PipeConnection.close() now interrupts WaitForMultipleObjects() in _send_bytes() by cancelling the overlapped operation.
* GH-108614: Increase importlib MAGIC for RESUME_CHECK instruction (#109247)Victor Stinner2023-09-111-1/+2
|
* gh-109162: libregrtest: use relative imports (#109250)Victor Stinner2023-09-1117-105/+110
| | | | libregrtest.__init__ no longer exposes any symbol, so "python -m test.libregrtest.worker" imports less modules.
* gh-109162: libregrtest: rename runtest_mp.py to run_workers.py (#109248)Victor Stinner2023-09-119-164/+171
| | | | | | | | | | | | | | | * Rename runtest_mp.py to run_workers.py * Move exit_timeout() and temp_cwd() context managers from Regrtest.main() to Regrtest.run_tests(). Actions like --list-tests or --list-cases don't need these protections. * Regrtest: remove selected and tests attributes. Pass 'selected' to list_tests(), list_cases() and run_tests(). display_result() now expects a TestTuple, instead of TestList. * Rename setup_tests() to setup_process() and rename setup_support() to setup_tests(). * Move _adjust_resource_limits() to utils and rename it to adjust_rlimit_nofile(). * Move replace_stdout() to utils. * Fix RunTests.verbose type: it's an int.
* gh-109162: libregrtest: fix Logger (#109246)Victor Stinner2023-09-113-30/+38
| | | | | * Pass results, quiet and pgo to Logger constructor. * Move display_progress() method from Regrtest to Logger. * No longer pass Regrtest to RunWorkers, but logger and results.
* gh-109162: libregrtest: add single.py and result.py (#109243)Victor Stinner2023-09-1114-697/+722
| | | | | | | | | | | * Add single.py and result.py files. * Rename runtest.py to runtests.py. * Move run_single_test() function and its helper functions to single.py. * Move remove_testfn(), abs_module_name() and normalize_test_name() to utils.py. * Move setup_support() to setup.py. * Move type hints like TestName to utils.py. * Rename runtest.py to runtests.py.
* gh-109162: libregrtest: add worker.py (#109229)Victor Stinner2023-09-1010-213/+238
| | | | | | | | | | | | | | | | | | | | | | | | Add new worker.py file: * Move create_worker_process() and worker_process() to this file. * Add main() function to worker.py. create_worker_process() now runs the command: "python -m test.libregrtest.worker JSON". * create_worker_process() now starts the worker process in the current working directory. Regrtest now gets the absolute path of the reflog.txt filename: -R command line option filename. * Remove --worker-json command line option. Remove test_regrtest.test_worker_json(). Related changes: * Add write_json() and from_json() methods to TestResult. * Rename select_temp_dir() to get_temp_dir() and move it to utils. * Rename make_temp_dir() to get_work_dir() and move it to utils. It no longer calls os.makedirs(): Regrtest.main() now calls it. * Move fix_umask() to utils. The function is now called by setup_tests(). * Move StrPath to utils. * Add exit_timeout() context manager to utils. * RunTests: Replace junit_filename (StrPath) with use_junit (bool).
* gh-109230: test_pyexpat no longer depends on the current directory (#109233)Victor Stinner2023-09-102-24/+53
| | | | | | | | Fix test_pyexpat.test_exception(): it can now be run from a directory different than Python source code directory. Before, the test failed in this case. Skip the test if Modules/pyexpat.c source is not available. Skip also the test on Python implementations other than CPython.
* gh-109237: Fix test_site for non-ASCII working directory (#109238)Victor Stinner2023-09-102-2/+6
| | | | | | Fix test_site.test_underpth_basic() when the working directory contains at least one non-ASCII character: encode the "._pth" file to UTF-8 and enable the UTF-8 Mode to use UTF-8 for the child process stdout.
* gh-50644: Forbid pickling of codecs streams (GH-109180)Serhiy Storchaka2023-09-103-0/+95
| | | | | | | | | Attempts to pickle or create a shallow or deep copy of codecs streams now raise a TypeError. Previously, copying failed with a RecursionError, while pickling produced wrong results that eventually caused unpickling to fail with a RecursionError.
* gh-109054: Don't use libatomic on cross-compilation (#109211)Victor Stinner2023-09-102-8/+6
| | | | | | | configure no longer uses libatomic by default when Python is cross-compiled. The LIBATOMIC variable can be set manually in this case: ./configure LIBATOMIC="-latomic" (...)
* gh-109207: Fix SystemError when printing symtable entry object. (GH-109225)云line2023-09-103-3/+7
|
* Fix "FSTRING_MIDDLE" typo in py312 "What's New" (#109222)Delgan2023-09-101-1/+1
|
* gh-93627: Align Python implementation of pickle with C implementation of ↵Pieter Eendebak2023-09-103-10/+72
| | | | | pickle (GH-103035) If a method like __reduce_ex_ or __reduce__ is set to None, a TypeError is raised.
* gh-109174: Add support of SimpleNamespace in copy.replace() (GH-109175)Serhiy Storchaka2023-09-104-0/+58
|
* gh-109162: libregrtest: add Logger class (#109212)Victor Stinner2023-09-104-99/+123
| | | | | | | | | | | | | | | | | | | | * Add Logger class in a new logger.py file. * Move Regrtest attributes to Logger: * start_time * test_count_text * test_count_width * win_load_tracker * Move Regrtest method to Logger: * log() * getloadavg(): rename to get_load_avg() * set_tests() * Add methods to the Logger class: * start_load_tracker() * stop_load_tracker()
* gh-109162: libregrtest: add TestResults class (#109208)Victor Stinner2023-09-103-274/+306
| | | | | | | | | | | | | | | | | | | | * Add TestResults class. * Move Regrtest methods to TestResults: * accumulate_result(): now takes a RunTests parameter * get_executed() * no_tests_run() * Add methods to TestResults: * add_junit() * display_result() * display_summary() * need_rerun() * prepare_rerun() * write_junit() * Rename 'need_rerun' attribute to 'bad_results'. * Rename 'total_stats' attribute to 'stats'.
* gh-109162: Refactor libregrtest.Regrtest (#109206)Victor Stinner2023-09-105-115/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add type hint types: TestName, StrPath, StrJSON. * Add attributes to Regrtest: * cmdline_args * coverage * coverage_dir * fail_rerun * next_single_filename * print_slowest * tmp_dir * want_rerun * want_run_leaks * Remove Regrtest.ns attribute. * Rename Regrtest methods: * cleanup() => cleanup_temp_dir() * create_temp_dir() => make_temp_dir() * set_temp_dir() => select_temp_dir() * Convert Regrtest methods to static methods: * cleanup_temp_dir() * display_header() * fix_umask() * get_rerun_match_tests() * list_tests() * make_temp_dir() * select_temp_dir() * Remove display_sanitizers() method: move code into display_header(). * Rename 'test_cwd' variable to 'work_dir'.
* gh-109162: Refactor libregrtest.runtest_mp (#109205)Victor Stinner2023-09-104-56/+57
| | | | | | | | | | | | | | * Add attributes to Regrtest and RunTests: * fail_env_changed * num_workers * Rename MultiprocessTestRunner to RunWorkers. Add num_workers parameters to RunWorkers constructor. Remove RunWorkers.ns attribute. * Rename TestWorkerProcess to WorkerThread. * get_running() now returns a string like: "running (...): ...". * Regrtest.action_run_tests() now selects the number of worker processes, instead of the command line parser.
* gh-109162: libregrtest: remove WorkerJob class (#109204)Victor Stinner2023-09-097-88/+126
| | | | | | | | | | | | | | | * Add attributes to Regrtest and RunTests: * gc_threshold * memory_limit * python_cmd * use_resources * Remove WorkerJob class. Add as_json() and from_json() methods to RunTests. A worker process now only uses RunTests for all parameters. * Add tests on support.set_memlimit() in test_support. Create _parse_memlimit() and also adds tests on it. * Remove 'ns' parameter from runtest.py.
* gh-109162: libregrtest: fix _decode_worker_job() (#109202)Victor Stinner2023-09-093-5/+21
| | | | | Decode also HuntRefleak() object inside the RunTests object. Add an unit test on huntrleaks with multiprocessing (-R -jN).
* Improve the sieve() recipe in the itertools docs (gh-109199)Raymond Hettinger2023-09-091-4/+7
| | | Lazier sieve