Commit Graph

119260 Commits

Author SHA1 Message Date
Michael Droettboom 9eb2489266
gh-109329: Add stat for "trace too short" (GH-110402) 2023-10-05 16:12:06 +01:00
Victor Stinner 1328fa31fe
gh-110393: Remove watchdog with hardcoded timeout (#110400)
test_builtin and test_socketserver no longer use signal.alarm() to
implement a watchdog with a hardcoded timeout (2 and 60 seconds).
Python test runner regrtest has two watchdogs: faulthandler and
timeout on running worker processes. Tests using short hardcoded
timeout can fail on slowest buildbots just because the timeout is too
short.
2023-10-05 15:02:48 +00:00
박문식 d33aa18f15
gh-82367: Use `FindFirstFile` Win32 API in `ntpath.realpath()` (GH-110298)
* Use `FindFirstFile` Win32 API to fix a bug where `ntpath.realpath()`
breaks out of traversing a series of paths where a (handled)
`ERROR_ACCESS_DENIED` or `ERROR_SHARING_VIOLATION` occurs.
* Update docs to reflect that `ntpath.realpath()` eliminates MS-DOS
style names.
2023-10-05 09:49:07 -05:00
sunmy2019 2cb62c6437
gh-110309: Prune empty constant in format specs (#110320)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-10-05 14:08:42 +00:00
Pablo Galindo Salgado cc389ef627
gh-110259: Fix f-strings with multiline expressions and format specs (#110271)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2023-10-05 14:26:44 +01:00
Victor Stinner af29282fce
gh-110367: Fix regrtest test_worker_output_on_failure() on ASAN build (#110387)
Set ASAN_OPTIONS="handle_segv=0" env var to run the test.
2023-10-05 14:42:36 +02:00
Nikita Sobolev 2bbbab212f
gh-110365: Fix error overwrite in `termios.tcsetattr` (#110366)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-10-05 11:02:52 +00:00
Victor Stinner 6592976061
gh-110367: Enhance regrtest -jN --verbose3 (#110368)
When using worker processes (-jN) with --verbose3 option, regrtest
can now display the worker output even if a worker process does
crash.  Previously, sys.stdout and sys.stderr were replaced and so
the worker output was lost on a crash.
2023-10-05 08:24:43 +02:00
Benjamin Peterson 313aa861ce
Remove duplicate word. (#110376) 2023-10-05 15:18:17 +11:00
Sam Gross cf6f23b0e3
gh-88402: Add new sysconfig variables on Windows (GH-110049)
Co-authored-by: Filipe Laíns <filipe.lains@gmail.com>
2023-10-04 22:50:29 +00:00
Eric Snow 80dc39e1dc
gh-110310: Add a Per-Interpreter XID Registry for Heap Types (gh-110311)
We do the following:

* add a per-interpreter XID registry (PyInterpreterState.xidregistry)
* put heap types there (keep static types in _PyRuntimeState.xidregistry)
* clear the registries during interpreter/runtime finalization
* avoid duplicate entries in the registry (when _PyCrossInterpreterData_RegisterClass() is called more than once for a type)
* use Py_TYPE() instead of PyObject_Type() in _PyCrossInterpreterData_Lookup()

The per-interpreter registry helps preserve isolation between interpreters.  This is important when heap types are registered, which is something we haven't been doing yet but I will likely do soon.
2023-10-04 16:35:27 -06:00
Michael Droettboom e561e98058
GH-109329: Add tier 2 stats (GH-109913) 2023-10-04 14:52:28 -07:00
P. L. Lim f7860295b1
Add back bltin-boolean-values ref tag (#110371)
To avoid breaking downstream intersphinx via numpydoc
2023-10-04 12:56:11 -07:00
Eric Snow ee317f7ddd
gh-76785: Print the Traceback from Interpreter.run() (gh-110322)
This is a temporary solution.  The full fix may involve serializing the traceback in some form.

(FYI, I merged this yesterday and the reverted it due to buildbot failures.  See gh-110248.)
2023-10-04 11:57:03 -06:00
Xuehai Pan 3bbe3b7c82
gh-110222: Add support of PyStructSequence in copy.replace() (GH-110223) 2023-10-04 19:47:41 +03:00
Xuehai Pan 9561648f4a
gh-110235: Raise TypeError for duplicate/unknown fields in PyStructSequence constructor (GH-110258) 2023-10-04 19:44:17 +03:00
Mark Shannon bf4bc36069
GH-109369: Merge all eval-breaker flags and monitoring version into one word. (GH-109846) 2023-10-04 16:09:48 +01:00
Guido van Rossum 7c149a76b2
gh-104909: Split more LOAD_ATTR specializations (GH-110317)
* Split LOAD_ATTR_MODULE

* Split LOAD_ATTR_WITH_HINT

* Split _GUARD_TYPE_VERSION out of the latter

* Split LOAD_ATTR_CLASS

* Split LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES

* Fix indent of DEOPT_IF in macros

* Split LOAD_ATTR_METHOD_LAZY_DICT

* Split LOAD_ATTR_NONDESCRIPTOR_NO_DICT

* Fix omission of _CHECK_ATTR_METHOD_LAZY_DICT
2023-10-04 16:08:02 +01:00
Hugo van Kemenade d8c00d2a60
Lint: Remove files that no longer fail to parse or with F811 (#110356) 2023-10-04 16:11:32 +03:00
Nikita Sobolev 43baddc2b9
gh-110260: Check for PyList_SetItem() errors in termios module (GH-110261) 2023-10-04 15:42:17 +03:00
Serhiy Storchaka 254e30c487
gh-109151: Enable readline in the sqlite3 CLI (GH-109152) 2023-10-04 14:16:44 +03:00
Nikita Sobolev e9f2352b7b
gh-110332: Remove mentions of `random.WichmannHill` from `test_zlib` (#110334) 2023-10-04 12:51:45 +02:00
Victor Stinner efd8c7a7c9
gh-109276: regrtest: shorter list of resources (#110326) 2023-10-04 09:39:50 +00:00
Victor Stinner 1337765225
gh-110335: asyncio test_unix_events cleans multiprocessing (#110336)
test_unix_events tests using the multiprocessing module now call
multiprocessing.util._cleanup_tests().
2023-10-04 09:19:08 +00:00
Victor Stinner 1de9406f91
gh-110166: Fix gdb CFunctionFullTests on ppc64le clang build (#110331)
CFunctionFullTests now also runs "bt" command before "py-bt-full",
similar to CFunctionTests which also runs "bt" command before
"py-bt". So test_gdb can skip the test if patterns like "?? ()" are
found in the gdb output.
2023-10-04 08:57:35 +00:00
Nikita Sobolev 1465386720
gh-110171: `libregrtest` always sets `random.seed` (#110172) 2023-10-04 06:42:12 +00:00
Serhiy Storchaka 5b9a3fd6a0
gh-110273: dataclasses.replace() now raise TypeError for all invalid arguments (GH-110274)
dataclasses.replace() now raises TypeError instead of ValueError if
specify keyword argument for a field declared with init=False or miss keyword
argument for required InitVar field.
2023-10-04 09:20:14 +03:00
Alex Waygood bfe7e72522
gh-109653: Defer importing `warnings` in several modules (#110286) 2023-10-04 06:09:43 +01:00
Jelle Zijlstra f02f26e293
gh-85984: Document change in return type of tty functions (#110028) 2023-10-03 20:46:38 -07:00
Eric Snow 269005e784
gh-110300: Fix Refleaks in test_interpreters and test__xxinterpchannels (gh-110318) 2023-10-04 00:36:50 +00:00
Guido van Rossum 625ecbe92e
gh-109979: Unify _GUARD_TYPE_VERSION{,_STORE} (#110301)
Now the target for `DEOPT_IF()` is auto-filled,
we don't need a separate `_GUARD_TYPE_VERSION_STORE` uop.
2023-10-03 22:37:21 +00:00
elfstrom a376a72bd9
gh-109917: Fix test instability in test_concurrent_futures (#110306)
The test had an instability issue due to the ordering of the dummy
queue operation and the real wakeup pipe operations. Both primitives
are thread safe but not done atomically as a single update and may
interleave arbitrarily. With the old order of operations this can lead
to an incorrect state where the dummy queue is full but the wakeup
pipe is empty. By swapping the order in clear() I think this can no
longer happen in any possible operation interleaving (famous last
words).
2023-10-03 22:59:49 +01:00
Eric Snow 4467d2c3ac
Revert "gh-76785: Print the Traceback from Interpreter.run() (gh-110248)" (gh-110314)
This reverts commit 6bc889aedc.

That commit is causing some buildbot failures.
2023-10-03 21:18:25 +00:00
Eric Snow 6bc889aedc
gh-76785: Print the Traceback from Interpreter.run() (gh-110248)
This is a temporary fix. The full fix may involve serializing the traceback in some form.
2023-10-03 14:41:02 -06:00
Adam Turner 77e9aae383
Docs: Avoid the deprecated ``.. cmdoption::`` directive (#110292) 2023-10-03 17:38:12 +00:00
Guido van Rossum d67edcf0b3
gh-109979: Auto-generate the target for DEOPT_IF() (#110193)
In Python/bytecodes.c, you now write
```
    DEOPT_IF(condition);
```
The code generator expands this to
```
    DEOPT_IF(condition, opcode);
```
where `opcode` is the name of the unspecialized instruction.
This works inside macro expansions too.

**CAVEAT:** The entire `DEOPT_IF(condition)` statement must be on a single line.
If it isn't, the substitution will fail; an error will be printed by the code generator
and the C compiler will report some errors.
2023-10-03 10:13:50 -07:00
Victor Stinner d73501602f
gh-108867: Add PyThreadState_GetUnchecked() function (#108870)
Add PyThreadState_GetUnchecked() function: similar to
PyThreadState_Get(), but don't issue a fatal error if it is NULL. The
caller is responsible to check if the result is NULL. Previously,
this function was private and known as _PyThreadState_UncheckedGet().
2023-10-03 16:53:51 +00:00
Victor Stinner 6ab6040054
gh-110276: No longer ignore PROFILE_TASK failure silently (#110295) 2023-10-03 18:43:23 +02:00
Victor Stinner eeb4e974d0
gh-107073: Mention pythoncapi-compat for PyObject_VisitManagedDict() (#110291) 2023-10-03 15:50:10 +00:00
Eric Snow f5198b09e1
gh-109860: Use a New Thread State When Switching Interpreters, When Necessary (gh-110245)
In a few places we switch to another interpreter without knowing if it has a thread state associated with the current thread.  For the main interpreter there wasn't much of a problem, but for subinterpreters we were *mostly* okay re-using the tstate created with the interpreter (located via PyInterpreterState_ThreadHead()).  There was a good chance that tstate wasn't actually in use by another thread.

However, there are no guarantees of that.  Furthermore, re-using an already used tstate is currently fragile.  To address this, now we create a new thread state in each of those places and use it.

One consequence of this change is that PyInterpreterState_ThreadHead() may not return NULL (though that won't happen for the main interpreter).
2023-10-03 09:20:48 -06:00
Lincoln 4227bfa8b2
Enhanced sqlite3 connection context management documentation with contextlib.closing gh-109234 (#109322)
* Enhanced sqlite3 connection context management documentation with contextlib.closing

* 📜🤖 Added by blurb_it.

* Fixed gitignore spelling error from nitignore to gitignore

* Renamed .gitignore to .nitignore

* Added generated doctests

* Deleted sqlite3 generated files

* Removed white-space changes

* Removed News entry from the doc

* Expanded a note that context manager can be used for connection management using contextlib.closing

* Removed repeated contextlib.closing code snippet

* Expanded the note around usage of context manageer for sqlite3 connection management

* Deleted extra white-spaces

* Deleted extra white-space

* re-arranged context manager wording

* Re-arranged word layout on how to use context manager

* Fix whitespace errors

* Remove unneeded change in .gitignore

* Added suggested changes

* Added suggested change redirecting to the contextlib.closing implementation

* Added closing keyword

* Removed line 2473

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-10-03 17:32:43 +03:00
Xuehai Pan 2d4865d775
gh-110267: Add tests for pickling and copying PyStructSequence objects (GH-110272) 2023-10-03 17:09:49 +03:00
Alex Waygood f1663a492e
Bump various dependencies in `Doc/requirements-oldest-sphinx.txt` (#110278)
This resolves a Dependabot security alert on the repository for urllib3==2.0.4.
2023-10-03 14:10:03 +01:00
Alex Waygood dddc757303
gh-110276: Run `test_str`, not `test_unicode`, as part of the PGO build (#110277)
`test_unicode` does not exist
2023-10-03 13:54:21 +01:00
Nikita Sobolev bb2e96f6f4
gh-109956: Also test typing.NamedTuple with copy.replace() (GH-109957) 2023-10-03 14:13:13 +03:00
Lele Gaifax 8c071373f1
Fix typo in py312 whatsnew: add missing closing paren (#110255) 2023-10-03 07:10:16 +01:00
Hugo van Kemenade 1001233fe1
Remove unused Misc/requirements-test.txt (#110240) 2023-10-03 08:01:50 +03:00
Guido van Rossum 6678ef41d2
Add --inline-caches flag to dis command line (#110249) 2023-10-03 00:49:34 +00:00
Alex Waygood 21a6263020
gh-109653: Reduce the import time of `random` by 60% (#110221) 2023-10-02 22:56:31 +00:00
Nikita Sobolev 4596c76d1a
gh-110241: Add missing error check to `record_eval` in `_testinternalcapi` (#110242) 2023-10-02 21:19:32 +00:00