125505 Commits

Author SHA1 Message Date
RUANG (James Roy)
303043f506
gh-128703: Fix mimetypes.guess_type for empty Content-Type in registry (GH-128854) 2025-02-14 17:26:26 +00:00
Stan Ulbrych
3402e133ef
gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130118)
We had the definition of what makes a character "printable" documented in three places, giving two different definitions.
The definition in the comment on `_PyUnicode_IsPrintable` was inverted; correct that.

With that correction, the two definitions turn out to be equivalent -- but to confirm that, you have to go look up, or happen to know, that those are the only five "Other" categories and only three "Separator" categories in the Unicode character database.  That makes it hard for the reader to tell whether they really are the same, or if there's some subtle difference in the intended semantics.

Fix that by cutting the C API docs' and the C comment's copies of the subtle details, in favor of referring to the Python-level docs. That ensures it's explicit that these are all meant to agree, and also lets us concentrate improvements to the wording in one place.

Speaking of which, borrow some ideas from the C comment, along with other tweaks, to hopefully add a bit more clarity to that one newly-centralized copy in the docs.

Also add a thorough test that the implementation agrees with this definition.

Author:    Greg Price <gnprice@gmail.com>

Co-authored-by: Greg Price <gnprice@gmail.com>
2025-02-14 18:16:47 +01:00
Stefano Rivera
6666b38c28
Correct typo in GH-129623 (#130079)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-14 16:27:17 +00:00
Peter Bierma
fda87c028b
CI: Mark the cross-build-linux job as skippable (#130113) 2025-02-14 14:46:04 +00:00
Yan Yanchii
334589f619
gh-126835: Set location for noped out instructions after constant folding in CFG. (#130109) 2025-02-14 14:15:08 +00:00
Tomas R.
0f20281fa2
gh-107510: gettext: Remove unnecessary tests (GH-127965)
There are now separate pygettext tests.
2025-02-14 12:16:10 +00:00
Tomas R.
9d1e668e6f
gh-129911: pygettext: Fix the keyword entry in help output (GH-129914) 2025-02-14 11:34:09 +02:00
Pablo Galindo Salgado
3bd3e09588
gh-125331: Allow the parser to activate future imports on the fly (#125482) 2025-02-14 04:54:56 +00:00
Brandt Bucher
05e89c34bd
GH-115869: Don't JIT zeroed bytes (GH-130023) 2025-02-13 10:51:03 -08:00
Bartosz Sławecki
07f5e33f2e
Fix a typo in _localemodule.c (GH-130085) 2025-02-13 17:29:26 +00:00
Sam Gross
451f291baa
gh-128130: Fix unhandled keyboard interrupt data race (gh-129975)
Use an atomic operation when setting
`_PyRuntime.signals.unhandled_keyboard_interrupt`. We now only clear the
variable at the start of `_PyRun_Main`, which is the same function where
we check it.

This avoids race conditions where previously another thread might call
`run_eval_code_obj()` and erroneously clear the unhandled keyboard
interrupt.
2025-02-13 12:29:03 -05:00
Ken Jin
aa28423201
Revert "gh-130048: Reintroduce full LTO as default on Clang (GH-130049)" (#130088)
This reverts commit 34c06ccc4c6c21935b46302935f3df24b00daa2c.
2025-02-13 17:27:19 +00:00
Dino Viehland
28f5e3de57
gh-129984: Mark immortal objects as deferred (#129985)
Mark immortal objects as deferred
2025-02-13 09:01:43 -08:00
Sam Gross
0559339ccd
gh-130019: Fix data race in _PyType_AllocNoTrack (gh-130058)
The reference count fields, such as `ob_tid` and `ob_ref_shared`, may be
accessed concurrently in the free threading build by a `_Py_TryXGetRef`
or similar operation. The PyObject header fields will be initialized by
`_PyObject_Init`, so only call `memset()` to zero-initialize the remainder
of the allocation.
2025-02-13 11:50:45 -05:00
Donghee Na
c357d69003
no-issue: Add free-threading build for TC dispatch (gh-130083)
no-issue: Add free-threading build for TCO dispatch
2025-02-14 00:25:40 +09:00
Ken Jin
34c06ccc4c
gh-130048: Reintroduce full LTO as default on Clang (GH-130049) 2025-02-13 22:06:00 +08:00
Filipe Laíns 🇵🇸
1eb3ade6e5
GH-107956: install build-details.json (PEP 739) (#130069) 2025-02-13 13:58:00 +00:00
Yan Yanchii
140e69c4a8
gh-126835: Move const folding of lists & sets from ast_opt.c to flowgraph.c (#130032) 2025-02-13 12:11:07 +00:00
Kumar Aditya
c7a9d06e06
gh-128002: optimistically remove tasks from linked list when finished (#129995) 2025-02-13 13:19:53 +05:30
Russell Keith-Magee
625470a7d2
gh-130025: Correct handling of symlinks during iOS testbed framework installation. (#130026)
Correct handling of symlinks during iOS testbed framework installation.
2025-02-13 14:03:43 +08:00
Filipe Laíns 🇵🇸
2a0256f588
GH-127432: add cross-build-linux as a required CI job (#129459) 2025-02-13 02:41:13 +00:00
Ammar Askar
f9a7d41bac
gh-96092: Fix traceback.walk_stack(None) skipping too many frames (#129330)
As it says in its documentation, walk_stack was meant to just
follow `f.f_back` like other functions in the traceback module.
Instead it was previously doing `f.f_back.f_back` and then this
changed to `f_back.f_back.f_back.f_back' in Python 3.11 breaking
its behavior for external users.

This happened because the walk_stack function never really had
any good direct tests and its only consumer in the traceback module was
`extract_stack` which passed the result into `StackSummary.extract`.
As a generator, it was previously capturing the state of the stack
when it was first iterated over, rather than the stack when `walk_stack`
was called. Meaning when called inside the two method deep
`extract` and `extract_stack` calls, two `f_back`s were needed.
When 3.11 modified the sequence of calls in `extract`, two more
`f_back`s were needed to make the tests happy.

This changes the generator to capture the stack when `walk_stack` is
called, rather than when it is first iterated over. Since this is
technically a breaking change in behavior, there is a versionchanged
to the documentation. In practice, this is unlikely to break anyone,
you would have been needing to store the result of `walk_stack` and
expecting it to change.
2025-02-13 01:43:09 +00:00
Pablo Galindo Salgado
6fb5138776
gh-88535: Improve syntax error for wrongly closed strings (#26633) 2025-02-13 01:30:20 +00:00
Pablo Galindo Salgado
56eda25633
gh-116042: Fix location for SyntaxErrors of invalid escapes in the tokenizer (#116049) 2025-02-13 01:07:37 +00:00
Pablo Galindo Salgado
49b11033bd
GH-91048: Correct error path in testexternalinspection (#129557) 2025-02-13 01:07:01 +00:00
Tomas R.
2dd018848c
gh-129693: Suppress SyntaxWarning in test_fstring (#129830)
Suppress SyntaxWarning in test_fstring
2025-02-13 00:38:28 +00:00
Sam Gross
e09442089e
gh-130030: Fix crash on 32-bit Linux with free threading (gh-130043)
The `gc_get_refs` assertion needs to be after we check the alive and
unreachable bits. Otherwise, `ob_tid` may store the actual thread id
instead of the computed `gc_refs`, which may trigger the assertion if
the `ob_tid` looks like a negative value.

Also fix a few type warnings on 32-bit systems.
2025-02-12 18:09:15 -05:00
Satyam Kumar
791cdfe141
gh-129912: Fix references to Py_TPFLAGS_MANAGED_DICT (gh-130044) 2025-02-12 17:48:14 -05:00
Sergey Miryanov
633853004c
gh-130050: Fix memory leaks in _testexternalinspection (#130051) 2025-02-12 21:12:07 +00:00
Ken Jin
1b27f36eb0
gh-129819: Allow tier2/JIT and tailcall (GH-129820) 2025-02-13 02:18:36 +08:00
Brandt Bucher
11bb08e4ec
GH-129715: Don't project traces that return to an unknown caller (GH-130024) 2025-02-12 10:16:43 -08:00
Mark Shannon
72f56654d0
GH-128682: Account for escapes in DECREF_INPUTS (GH-129953)
* Handle escapes in DECREF_INPUTS

* Mark a few more functions as escaping

* Replace DECREF_INPUTS with PyStackRef_CLOSE where possible
2025-02-12 17:44:59 +00:00
donBarbos
3e222e3a15
gh-109798: Normalize _datetime and datetime error messages (#127345)
Updates error messages in datetime and makes them consistent between Python and C.

---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2025-02-12 09:54:22 -05:00
Sam Gross
57f45ee2d8
gh-128759: Fix accesses to tp_version_tag. (GH-129750)
We should use a relaxed atomic load in the free threading build in
`PyType_Modified()` because that's called without the type lock held.
It's not necessary to use atomics in `type_modified_unlocked()`.

We should also use `FT_ATOMIC_STORE_UINT_RELAXED()` instead of the
`UINT32` variant because `tp_version_tag` is declared as `unsigned int`.
2025-02-12 09:34:40 -05:00
Tomasz Pytel
3cf68cdd3e
gh-129983: fix data race in compile_template in sre.c (#130015) 2025-02-12 18:34:44 +05:30
Andrew Svetlov
469d2e416c
gh-129889: Support context manager protocol by contextvars.Token (#129888) 2025-02-12 12:32:58 +01:00
Stefano Rivera
e1b38ea82e
Update manpage environment variables and command line arguments (#129623)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-12 13:00:35 +02:00
Stan Ulbrych
555ee43d92
gh-59149: Setup documentation for IDLE on Linux and add section in Editors (#130003)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-02-12 03:16:56 -05:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
b05fa90b21
gh-128446: Skip Windows CI for Unix build system changes (#128450)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-02-12 01:53:29 +00:00
Wulian233
06ac157c53
gh-125746: Delay deprecated zipimport.zipimporter.load_module removal time to 3.15 (#125748) 2025-02-11 23:59:09 +00:00
Sam Gross
a7427f2db9
gh-129967: Fix race condition in repr(set) (gh-129978)
The call to `PySequence_List()` could temporarily unlock and relock the
set, allowing the items to be cleared and return the incorrect
notation `{}` for a empty set (it should be `set()`).

Co-authored-by: T. Wouters <thomas@python.org>
2025-02-11 17:29:27 -05:00
Sam Gross
1f233f56d6
gh-128657: Skip test_get_builtin_constructor when running with --parallel-threads (GH-130018)
The test modifies sys.modules and is not thread-safe.
2025-02-11 16:59:36 -05:00
Sam Gross
1a8082a4bf
gh-117657: Add test_thread_local_bytecode to TSAN tests (gh-129753)
Skip `test_no_copies_if_tlbc_disabled` when run under TSAN for now
due to a data race on the adaptive counter (see gh-129752).
2025-02-11 16:54:32 -05:00
Sam Gross
f151d27159
gh-117657: Enable test_opcache under TSAN (GH-129831)
Fix a few thread-safety bugs to enable test_opcache when run with TSAN:

 * Use relaxed atomics when clearing `ht->_spec_cache.getitem`
   (gh-115999)
 * Add temporary suppression for type slot modifications (gh-127266)
 * Use atomic load when reading `*dictptr`
2025-02-11 16:53:08 -05:00
Sam Gross
ed816f1a70
Remove trailing whitespace in Lib/pydoc_data/topics.py (#130014) 2025-02-11 23:28:28 +02:00
Michael Droettboom
00ec781877
gh-129244: Only remove the workaround when MSVC has the bugfix (#130011) 2025-02-11 14:49:42 -05:00
Hugo van Kemenade
53e8e72dab Merge branch 'main' of https://github.com/python/cpython 2025-02-11 21:29:11 +02:00
Hugo van Kemenade
1c1190ac29 Post 3.14.0a5 2025-02-11 21:26:52 +02:00
Tomas R.
aa81a6f6e4
gh-97850: Update the deprecation warning of importlib.abc.Loader.load_module (GH-129855) 2025-02-11 11:04:16 -08:00
Hugo van Kemenade
3ae9101482 Python 3.14.0a5 v3.14.0a5 2025-02-11 19:16:29 +02:00