Commit Graph

51338 Commits

Author SHA1 Message Date
Sergey B Kirpichev 24b5cbd3dc
gh-111495: Add tests for PyComplex C API (GH-111591) 2023-11-05 07:42:42 +00:00
Sergey B Kirpichev b452202a11
gh-111495: Add tests for PyFloat C API (GH-111624) 2023-11-05 09:20:12 +02:00
Tian Gao 853b4b549d
gh-111719: Add extra check for alias command (#111720) 2023-11-04 23:05:22 +00:00
Davide Rizzo a6c1c04d4d
gh-110395: invalidate open kqueues after fork (#110517)
Invalidate open select.kqueue instances after fork as the fd will be invalid in the child.
2023-11-04 21:45:24 +00:00
Tian Gao cd6b2ced75
gh-80675: Set `f_trace_lines = True` on all frames upon `pdb.set_trace()` (#110881) 2023-11-04 19:59:36 +00:00
CF Bolz-Tereick 9573d14215
gh-96954: use a directed acyclic word graph for storing the unicodedata codepoint names (#97906)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2023-11-04 15:56:58 +01:00
Antoine Pitrou 0e9c364f4a
GH-110829: Ensure Thread.join() joins the OS thread (#110848)
Joining a thread now ensures the underlying OS thread has exited. This is required for safer fork() in multi-threaded processes.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-11-04 13:59:24 +00:00
Nikita Sobolev 890ef1b035
gh-108303: Move `zip` and `tar` archives to `Lib/test/archivetestdata` (#111549) 2023-11-04 10:57:53 +01:00
Nikita Sobolev 18c954849b
gh-111159: Fix `SyntaxError` doctests for non-builtin exception classes (#111541) 2023-11-04 09:54:10 +00:00
Serhiy Storchaka a8e1f474c2
gh-111495: Test C API functions with extreme sizes and indices (GH-111631) 2023-11-04 11:40:46 +02:00
Victor Stinner ac01e2243a
gh-111644: Fix asyncio test_unhandled_exceptions() (#111713)
Fix test_unhandled_exceptions() of test_asyncio.test_streams: break
explicitly a reference cycle.

Fix also StreamTests.tearDown(): the loop must not be closed
explicitly, but using set_event_loop() which takes care of shutting
down the executor with executor.shutdown(wait=True).
BaseEventLoop.close() calls executor.shutdown(wait=False).
2023-11-04 00:47:07 +00:00
Victor Stinner f62c7ccf9a
gh-111644: Fix support threading_cleanup() (#111714)
Copy the list of dangling threads to make sure that the list of
"Dangling thread" is complete. Previously, the list was incomplete if
threads completed just before the list was displayed.

Changes:

* Rewrite the warning to make it easier to understand.
* Use support.sleeping_retry().
* threading_cleanup() no longer copies threading._dangling,
  but only counts the number of dangling thread.
* Remove support.gc_support() call.
2023-11-04 00:18:42 +00:00
Victor Stinner 244e37b22a
gh-109649: Fix test_os.test_process_cpu_count_affinity() (#111689)
When CPUs are isolated on Linux, os.process_cpu_count() is smaller
than os.cpu_count(). Fix the test for this case.

Example with "isolcpus=5,11 rcu_nocbs=5,11" options passed to a Linux
command line to isolated two logical CPUs:

$ ./python -c 'import os; print(os.process_cpu_count(), "/", os.cpu_count())'
10 / 12
2023-11-03 23:53:18 +00:00
Victor Stinner 20cfab903d
gh-111506: Implement Py_SET_REFCNT() as opaque function in limited C API (#111508)
In the limited C API version 3.13, Py_SET_REFCNT() function is now
implemented as an opaque function call.

Add _Py_SetRefcnt() to the stable ABI.
2023-11-03 18:18:57 +01:00
Tian Gao e0afed7e27
gh-103615: Use local events for opcode tracing (GH-109472)
* Use local monitoring for opcode trace

* Remove f_opcode_trace_set

* Add test for setting f_trace_opcodes after settrace
2023-11-03 16:39:50 +00:00
Nikita Sobolev ccc8caa858
gh-111681: minor fixes to typing doctests; remove unused imports in `test_typing` (#111682)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-03 12:23:33 +00:00
Irit Katriel d49aba5a7a
gh-111354: Simplify _PyGen_yf by moving some of its work to the compiler and frame state (#111648) 2023-11-03 10:01:36 +00:00
Nikita Sobolev 7bcf184dac
gh-111490: Make the exception type check in test_pyexpat more specific (GH-111491) 2023-11-03 10:28:14 +02:00
Serhiy Storchaka 26c0e5e03a
gh-108082: Remove _PyErr_WriteUnraisableMsg() (GH-111643)
Replace the remaining calls with PyErr_FormatUnraisable().
2023-11-03 09:45:53 +02:00
AN Long 3a1b09e6d0
gh-111654: remove redundant decref in LOAD_FROM_DICT_OR_DEREF (#111655) 2023-11-02 21:06:51 -07:00
Tian Gao f4b5588bde
gh-110892: Return NULL for `PyTrace_RETURN` events caused by an exception (GH-110909) 2023-11-02 16:38:08 +00:00
partev 6a0d7b43df
gh-111625: Fix link to Info-ZIP homepage (#111626) 2023-11-02 11:10:30 +00:00
Irit Katriel 52cc4af6ae
gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 (#111459) 2023-11-02 10:18:43 +00:00
Serhiy Storchaka 970e719a7a
gh-108082: Use PyErr_FormatUnraisable() (GH-111580)
Replace most of calls of _PyErr_WriteUnraisableMsg() and some
calls of PyErr_WriteUnraisable(NULL) with PyErr_FormatUnraisable().

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-11-02 09:16:34 +00:00
Kumar Aditya 229f44d353
GH-110894: Call loop exception handler for exceptions in client_connected_cb (#111601)
Call loop exception handler for exceptions in `client_connected_cb` of `asyncio.start_server` so that applications can handle it.
2023-11-02 07:38:18 +00:00
Anthony Shaw 230e8e924d
GH-111435: Add Support for Sharing True and False Between Interpreters (gh-111436)
This only affects users of the APIs in pycore_crossinterp.h (AKA _xxsubinterpretersmodule.c and _xxinterpchannels.c).
2023-11-02 00:09:01 +00:00
Eric Snow 9322ce90ac
gh-76785: Crossinterp utils additions (gh-111530)
This moves several general internal APIs out of _xxsubinterpretersmodule.c and into the new Python/crossinterp.c (and the corresponding internal headers).

Specifically:

* _Py_excinfo, etc.:  the initial implementation for non-object exception snapshots (in pycore_pyerrors.h and Python/errors.c)
* _PyXI_exception_info, etc.:  helpers for passing an exception beween interpreters (wraps _Py_excinfo)
* _PyXI_namespace, etc.:  helpers for copying a dict of attrs between interpreters
* _PyXI_Enter(), _PyXI_Exit():  functions that abstract out the transitions between one interpreter and a second that will do some work temporarily

Again, these were all abstracted out of _xxsubinterpretersmodule.c as generalizations.  I plan on proposing these as public API at some point.
2023-11-01 17:36:40 -06:00
Yilei Yang 834b7c18d7
gh-106718: Treat PyConfig.stdlib_dir as highest-priority setting for stdlib_dir when calculating paths (GH-108730) 2023-11-01 21:11:18 +00:00
Yilei Yang 45a36d5f56
gh-111374: Add a new PYTHON_FROZEN_MODULES env var, equivalent of `-X frozen_modules`. (#111411)
Adds a new PYTHON_FROZEN_MODULES env var to correspond with -X frozen_modules.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-11-01 20:39:31 +00:00
Guido van Rossum 7e135a48d6
gh-111520: Integrate the Tier 2 interpreter in the Tier 1 interpreter (#111428)
- There is no longer a separate Python/executor.c file.
- Conventions in Python/bytecodes.c are slightly different -- don't use `goto error`,
  you must use `GOTO_ERROR(error)` (same for others like `unused_local_error`).
- The `TIER_ONE` and `TIER_TWO` symbols are only valid in the generated (.c.h) files.
- In Lib/test/support/__init__.py, `Py_C_RECURSION_LIMIT` is imported from `_testcapi`.
- On Windows, in debug mode, stack allocation grows from 8MiB to 12MiB.
- **Beware!** This changes the env vars to enable uops and their debugging
  to `PYTHON_UOPS` and `PYTHON_LLTRACE`.
2023-11-01 13:13:02 -07:00
Serhiy Storchaka 97b3cd38d1
gh-111495: Add tests for PyBytes and PyByteArray C API (GH-111496) 2023-11-01 17:31:07 +02:00
Mark Shannon b14e882428
GH-111485: Use micro-ops to split specialization code from base action (GH-111561) 2023-11-01 10:53:27 +00:00
Victor Stinner d9a5530d23
gh-110367: Make regrtest --verbose3 compatible with --huntrleaks -jN (#111577)
"./python -m test -j1 -R 3:3 --verbose3" now works as expected, since
run_single_test() does not replace sys.stdout with StringIO in this
case.
2023-11-01 04:28:55 +01:00
Thomas Grainger 770530679e
gh-110774: allow setting the Runner(loop_factory=...) from IsolatedAsyncioTestCase (#110776)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2023-10-31 15:03:54 -07:00
Serhiy Storchaka f6a02327b5
gh-108082: Add PyErr_FormatUnraisable() function (GH-111086) 2023-10-31 23:42:44 +02:00
Tomas R 453e96e302
gh-111420: Allow type comments in parenthesized `with` statements (#111468) 2023-10-31 21:02:42 +00:00
Anthony Shaw ad6380bc34
GH-111438: Add Support for Sharing Floats Between Interpreters (gh-111439)
This only affects users of the APIs in pycore_crossinterp.h (AKA _xxsubinterpretersmodule.c and _xxinterpchannels.c).
2023-10-31 08:17:20 -06:00
Mark Shannon d27acd4461
GH-111485: Increment `next_instr` consistently at the start of the instruction. (GH-111486) 2023-10-31 10:09:54 +00:00
Serhiy Storchaka e3353c498d
gh-111531: Tkinter: fix reference leaks in bind_class() and bind_all() (GH-111533) 2023-10-31 08:48:52 +02:00
Eric Snow c6fe0869ab
gh-76785: Move the Cross-Interpreter Code to Its Own File (gh-111502)
This is partly to clear this stuff out of pystate.c, but also in preparation for moving some code out of _xxsubinterpretersmodule.c.  This change also moves this stuff to the internal API (new: Include/internal/pycore_crossinterp.h).  @vstinner did this previously and I undid it.  Now I'm re-doing it. :/
2023-10-30 16:53:10 -06:00
Victor Stinner 7b153d14ef
gh-110697: Use CLOCK_RES in test_os.TimerfdTests (#111529)
More TimerfdTests tests tolerate a difference of 1 ms in measured
elapsed time.
2023-10-30 22:47:59 +00:00
Nikita Sobolev c4dc5a6ae8
gh-111181: Fix enum doctests (GH-111180)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-10-30 12:56:29 -07:00
Pablo Galindo Salgado cd6e0a04a1
gh-111366: Correctly show custom syntax error messages in the codeop module functions (#111384) 2023-10-30 19:24:21 +00:00
Serhiy Storchaka 624ace5a2f
gh-111284: Make multiprocessing tests with threads faster and more reliable (GH-111285) 2023-10-30 19:18:36 +02:00
Serhiy Storchaka bca3305429
gh-108082: C API: Add tests for PyErr_WriteUnraisable() (GH-111455)
Also document the behavior when called with NULL.
2023-10-30 19:01:03 +02:00
Sam Gross 6dfb8fe023
gh-110481: Implement biased reference counting (gh-110764) 2023-10-30 16:06:09 +00:00
Dino Viehland 05f2f0ac92
gh-90815: Add mimalloc memory allocator (#109914)
* Add mimalloc v2.12

Modified src/alloc.c to remove include of alloc-override.c and not
compile new handler.

Did not include the following files:

 - include/mimalloc-new-delete.h
 - include/mimalloc-override.h
 - src/alloc-override-osx.c
 - src/alloc-override.c
 - src/static.c
 - src/region.c

mimalloc is thread safe and shares a single heap across all runtimes,
therefore finalization and getting global allocated blocks across all
runtimes is different.

* mimalloc: minimal changes for use in Python:

 - remove debug spam for freeing large allocations
 - use same bytes (0xDD) for freed allocations in CPython and mimalloc
   This is important for the test_capi debug memory tests

* Don't export mimalloc symbol in libpython.
* Enable mimalloc as Python allocator option.
* Add mimalloc MIT license.
* Log mimalloc in Lib/test/pythoninfo.py.
* Document new mimalloc support.
* Use macro defs for exports as done in:
  https://github.com/python/cpython/pull/31164/

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-30 15:43:11 +00:00
zcxsythenew fa35b9e89b
gh-111347: Remove wrong assertion in test_sendfile (#111377)
Windows is different.
2023-10-29 08:22:15 -07:00
Evan Kohilas 842e5fcdcd
gh-94808: Add coverage test for number check (gh-111445) 2023-10-29 07:00:19 +00:00
c-bata 8c47ada2de
gh-66425: Remove the unreachable code to set `REMOTE_HOST` header (gh-111441) 2023-10-29 13:56:15 +09:00