Commit Graph

122206 Commits

Author SHA1 Message Date
Miss Islington (bot) cd35e9d85a
[3.13] gh-117657: Fix missing atomic in dict_resize (GH-119312) (#119417)
gh-117657: Fix missing atomic in dict_resize (GH-119312)

Fix missing atomic in dict_resize
(cherry picked from commit 2b3fb767be)

Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2024-05-22 14:42:47 -07:00
Miss Islington (bot) a6ed7425d8
[3.13] gh-70795: Rework RLock documentation (GH-103853) (#119436)
gh-70795: Rework RLock documentation (GH-103853)

Attempted to simultaneously reduce verbosity, while more descriptively
describing behavior.

Fix links (RLock acquire/release previously linking to Lock
acquire/release, seems like bad copy pasta).

Add a seealso for with-locks.

Switch section to use bullet points.

---------

(cherry picked from commit 2fbea81d64)

Co-authored-by: uıɐɾ ʞ ʇɐɯɐs <_@skj.io>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2024-05-22 14:21:58 -07:00
Lysandros Nikolaou 9435124d4a
[3.13] gh-111201: auto-indentation in _pyrepl (GH-119348) (#119427)
(cherry picked from commit cd516cd1f5)

Co-authored-by: Arnon Yaari <wiggin15@yahoo.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 23:14:03 +02:00
Miss Islington (bot) 81440c5ba1
[3.13] Enable some stricter mypy settings on `Lib/_pyrepl` (GH-119077) (#119428)
(cherry picked from commit 0883fd22e6)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-22 23:13:47 +02:00
Miss Islington (bot) 6bc7fc08ae
[3.13] gh-113978: Ignore warnings on text completion inside REPL (GH-113979) (#119429)
(cherry picked from commit e03dde5a24)

Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
2024-05-22 23:13:32 +02:00
Lysandros Nikolaou e6e4efcc86
[3.13] gh-119357: Increase test coverage for keymap in _pyrepl (GH-119358) (#119414)
(cherry picked from commit 73ab83b27f)

Co-authored-by: Eugene Triguba <eugenetriguba@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 23:13:01 +02:00
Miss Islington (bot) 3e30a38561
gh-117505: Run ensurepip in isolated env in Windows installer (GH-118257)
ensurepip forks a subprocess to run pip itself, but that subprocess only inherits a -I isolated mode flag (see _run_pip() in Lib/ensurepip/__init__.py), not the "-E -s" flags that the installer has been using. This means that parts of ensurepip don't actually run in an isolated environment and can make incorrect decisions based on packages installed in the user site-packages.
(cherry picked from commit c9073eb1a9)

Co-authored-by: Michael Vincent <377567+Vynce@users.noreply.github.com>
2024-05-22 19:46:35 +00:00
Miss Islington (bot) 0bd7c879cf
[3.13] gh-112066: Fix versionadded in PyDict_SetDefaultRef docs (GH-118696) (#119430)
(cherry picked from commit 447edb6e98)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2024-05-22 15:36:35 -04:00
Miss Islington (bot) 08416065a7
[3.13] gh-119247: Add macros to use PySequence_Fast safely in free-threaded build (GH-119315) (#119419)
Add `Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST` and
`Py_END_CRITICAL_SECTION_SEQUENCE_FAST` macros and update `str.join` to use
them. Also add a regression test that would crash reliably without this
patch.
(cherry picked from commit baf347d916)

Co-authored-by: Josh {*()} Rosenberg <26495692+MojoVampire@users.noreply.github.com>
2024-05-22 19:24:02 +00:00
Miss Islington (bot) cd39da75af
[3.13] Improve `pyrepl` type-annotation coverage (GH-119081) (#119415)
(cherry picked from commit 033f5c87f1)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-22 18:38:32 +00:00
Miss Islington (bot) bfd9c3ea53
[3.13] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) (gh-119410)
_PyArg_Parser holds static global data generated for modules by Argument Clinic.  The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global.  In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters.  However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed.

This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes.  It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime.  The solution here is to temporarily switch to the main interpreter.  The alternative would be to always statically allocate the tuple.

This change also fixes a bug where only the most recent parser was added to the global linked list.

(cherry picked from commit 81865002ae)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-05-22 12:09:48 -06:00
Miss Islington (bot) a463cd8e45
[3.13] gh-118893: Evaluate all statements in the new REPL separately (GH-119318) (#119408)
(cherry picked from commit a3e4fec873)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 16:22:01 +00:00
Miss Islington (bot) eafd633fac
[3.13] gh-119205: Fix autocompletion bug in new repl (GH-119229) (#119407)
(cherry picked from commit 506b1a3ff6)

Co-authored-by: Koudai Aono <koxudaxi@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 16:07:38 +00:00
Miss Islington (bot) aefe2e626e
[3.13] gh-111201: Add append to screen method to avoid recalculation (GH-119274) (#119405)
(cherry picked from commit c886bece3b)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-22 16:03:04 +00:00
Lysandros Nikolaou ac9163637b
[3.13] gh-111201: Remove readline dependency from the PyREPL (GH-119262) (#119403)
(cherry picked from commit 561ff1fa71)
2024-05-22 11:45:11 -04:00
Lysandros Nikolaou 721459831a
[3.13] gh-119306: Break up _pyrepl tests (GH-119307) (#119362)
(cherry picked from commit f49df4f486)

Co-authored-by: Eugene Triguba <eugenetriguba@gmail.com>
2024-05-22 11:02:18 -04:00
Miss Islington (bot) 6892b400dc
[3.13] gh-118643: Fix AttributeError in the email module (GH-119099) (GH-119389)
Fix regression introduced in gh-100884: AttributeError when re-fold a long
address list.

Also fix more cases of incorrect encoding of the address separator in the
address list missed in gh-100884.
(cherry picked from commit 858b9e85fc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-22 14:07:38 +03:00
Miss Islington (bot) 414346e56d
[3.13] Fix version number in use_load_tests deprecation reference (GH-119151) (GH-119386)
Deprecation took place in d78742a260 (3.5)
(cherry picked from commit aee8f03abb)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2024-05-22 09:58:59 +00:00
Miss Islington (bot) 0e6198972a
[3.13] Fix typos in NEWS entries for 3.13 (GH-119374) (GH-119385)
(cherry picked from commit 904e256292)

Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
2024-05-22 09:47:49 +00:00
Miss Islington (bot) ec484b6862
[3.13] gh-119189: Add yet more tests for mixed Fraction arithmetic (GH-119298) (GH-119346)
(cherry picked from commit 10b1bd926a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-22 09:37:07 +00:00
Miss Islington (bot) f757996942
[3.13] Clarify that dklen is expected in bytes for the hashlib functions (GH-106624) (GH-119383)
(cherry picked from commit 5adf78f546)

Co-authored-by: Mathijs Mortimer <thiezn@users.noreply.github.com>
2024-05-22 09:10:02 +00:00
Miss Islington (bot) b5b0e3210d
[3.13] DOCS: fix error in exec namespace note (gh-119380)
When updating the new exec note added in gh-119235 as part of the
PEP 667 general docs PR, I suggested a workaround that isn't valid.

The first half of the note is still reasonable, so just omit the invalid text.

(cherry picked from commit 31d61a75c9)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-05-22 06:58:36 +00:00
Miss Islington (bot) 455b386234
[3.13] gh-110383: Align dict.get(), .fromkeys(), and .setdefault() docs with docstrings (GH-119330) (#119370)
(cherry picked from commit 0e3c8cda1f)

Co-authored-by: Landon Wood <landon@elkrange.com>
2024-05-22 01:31:56 +00:00
Miss Islington (bot) e992217810
[3.13] gh-118877: Fix AssertionError crash in pyrepl (GH-118936) (#119363)
(cherry picked from commit c0d81b2566)

Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
2024-05-22 01:28:24 +00:00
Miss Islington (bot) f15fbe9991
gh-118507 : Refactor `nt._path_is*` to improve applicability for other cases (GH-118755)
(cherry picked from commit b64182550f)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-22 00:29:34 +00:00
Miss Islington (bot) f371565169
[3.13] gh-119102: Fix REPL for dumb terminal (GH-119332) (#119359)
The site module gets the __main__ module to get _pyrepl.__main__.
(cherry picked from commit de8f530841)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-22 00:14:44 +00:00
Miss Islington (bot) 05820164ce
[3.13] Docs: Add central references to free-threading-related options (GH-119017) (#119367)
Docs: Add central references to free-threading-related options (GH-119017)
(cherry picked from commit 9fa206aaec)

Co-authored-by: Brett Simmers <swtaarrs@users.noreply.github.com>
2024-05-21 23:16:59 +00:00
Miss Islington (bot) fef202f97b
[3.13] Fix typos in documentation (GH-119295) (#119337)
Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
2024-05-21 22:07:20 +00:00
Miss Islington (bot) 8860f83e4b
[3.13] gh-119035: Add Ctrl+← and Ctrl+→ word-skipping keybindings to new repl (GH-119248) (#119323)
add word-skipping ctrl keybindings to new repl
(cherry picked from commit 0398d93392)

Co-authored-by: Alastair Stanley <alastairstanley@ntlworld.com>
2024-05-21 17:16:06 -04:00
Miss Islington (bot) 256b791fd6
[3.13] gh-110383: Document `socket.makefile()` accepts combined modes (GH-119150) (#119324)
The supported mode values are 'r', 'w', and 'b', or a combination of those.
(cherry picked from commit 62a29be5bb)

Co-authored-by: Daniel Williams <dann0a@gmail.com>
2024-05-21 18:44:53 +00:00
Miss Islington (bot) 11ca1d9d53
[3.13] GH-110383: Improve Tutorial for Input Ouput (GH-119230) (GH-119326)
GH-110383: Improve Tutorial for Input Ouput (GH-119230)

(cherry picked from commit 9db2fd7eda)

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: edson duarte <eduarte.uatach@gmail.com>
2024-05-21 19:54:26 +02:00
Miss Islington (bot) d93c4f9b1c
[3.13] GH-119292: Add job to JIT CI to build and test with --disable-gil (GH-119314)
(cherry picked from commit c4722cd057)
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-21 16:17:49 +00:00
Miss Islington (bot) dcb8030c53
[3.13] gh-119053: Implement the fast path for list.__getitem__ (gh-119112) (gh-119309)
gh-119053: Implement the fast path for list.__getitem__ (gh-119112)
(cherry picked from commit ab4263a82a)

Co-authored-by: Donghee Na <donghee.na@python.org>
2024-05-21 14:42:22 +00:00
Hugo van Kemenade 1929b7e2bf
[3.13] Docs: Ensure no warnings are found in the NEWS file before a given line number (GH-119221) (#119261) 2024-05-21 08:40:08 -06:00
Miss Islington (bot) f028451d95
[3.13] gh-119102: Fix REPL for dumb terminal (GH-119269) (#119308)
gh-119102: Fix REPL for dumb terminal (GH-119269)

Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide
if _pyrepl.write_history_file() can be used.
(cherry picked from commit 73f4a58d36)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-21 13:46:11 +00:00
Miss Islington (bot) 49ad4d077f
[3.13] Use `fail-fast: false` in `mypy.yml` (GH-119297) (#119304)
Use `fail-fast: false` in `mypy.yml` (GH-119297)

See docs about this setting: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actionsGH-jobsjob_idstrategyfail-fast
(cherry picked from commit b365332906)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-21 12:47:00 +00:00
Miss Islington (bot) db64dae745
[3.13] gh-74929: PEP 667 general docs update (gh-119291)
* expand on What's New entry for PEP 667 (including porting notes)
* define 'optimized scope' as a glossary term
* cover comprehensions and generator expressions in locals() docs
* review all mentions of "locals" in documentation (updating if needed)
* review all mentions of "f_locals" in documentation (updating if needed)

(cherry picked from commit e870c852c0)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-05-21 21:35:26 +10:00
Miss Islington (bot) f7303cd967
[3.13] gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (GH-119175) (#119289)
gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (GH-119175)

------

(cherry picked from commit 538ed5e481)

Co-authored-by: Wulian233 <71213467+Wulian233@users.noreply.github.com>
2024-05-21 03:53:29 +00:00
Miss Islington (bot) 24b0e8ddb4
[3.13] gh-118912: Remove description of issue fixed in 3.5 from autospeccing guide (GH-119232) (#119284)
gh-118912: Remove description of issue fixed in 3.5 from autospeccing guide (GH-119232)

* Remove description of issue fixed in 3.5 from autospeccing guide

* Make autospeccing note text more succint and lint whitespace

* Add linting changes (missed in last commit)

---------

(cherry picked from commit 7e57640c7e)

Co-authored-by: Shauna <shaunagm@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-05-20 23:50:23 +00:00
Miss Islington (bot) d8fbe5b64a
[3.13] gh-108267 Fix another dataclasses docs typo (GH-119277) (#119279)
gh-108267 Fix another dataclasses docs typo (GH-119277)
(cherry picked from commit 423bbcbbc4)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-20 22:53:32 +00:00
Miss Islington (bot) 42a8d11752
[3.13] gh-119050: Add XML support to libregrtest refleak checker (GH-119148) (#119270)
gh-119050: Add XML support to libregrtest refleak checker (GH-119148)

regrtest test runner: Add XML support to the refleak checker
(-R option).

* run_unittest() now stores XML elements as string, rather than
  objects, in support.junit_xml_list.
* runtest_refleak() now saves/restores XML strings before/after
  checking for reference leaks. Save XML into a temporary file.
(cherry picked from commit 9257731f5d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-20 22:50:20 +00:00
Miss Islington (bot) 071d996e13
[3.13] gh-119253: use ImportError in _ios_support (GH-119254) (#119265)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-05-20 22:21:28 +00:00
Miss Islington (bot) 572b0b0809
[3.13] gh-119189: Add more tests for mixed Fraction arithmetic (GH-119236) (GH-119255)
(cherry picked from commit fe67af1963)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-20 21:00:20 +00:00
Miss Islington (bot) b4462aaed6
[3.13] gh-118760: Restore the default value of tkinter.wantobjects to 1 (GH-118784) (GH-119251)
It was set to 2 in 65f5e586a1 (GH-98592).
(cherry picked from commit e188527c34)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-20 20:28:42 +00:00
Miss Islington (bot) 906f6cb656
[3.13] Use correct markup in unittest.mock.reset_mock documentation (GH-119207) (GH-119250)
Use correct markup in unittest.mock.reset_mock documentation (GH-119207)
(cherry picked from commit 6b80a5b20f)

Co-authored-by: Tialo <65392801+Tialo@users.noreply.github.com>
2024-05-20 22:12:38 +02:00
Miss Islington (bot) 054f1af811
[3.13] gh-92081: Fix for email.generator.Generator with whitespace between encoded words. (GH-92281) (#119245)
* Fix for email.generator.Generator with whitespace between encoded words.

email.generator.Generator currently does not handle whitespace between
encoded words correctly when the encoded words span multiple lines.  The
current generator will create an encoded word for each line.  If the end
of the line happens to correspond with the end real word in the
plaintext, the generator will place an unencoded space at the start of
the subsequent lines to represent the whitespace between the plaintext
words.

A compliant decoder will strip all the whitespace from between two
encoded words which leads to missing spaces in the round-tripped
output.

The fix for this is to make sure that whitespace between two encoded
words ends up inside of one or the other of the encoded words.  This
fix places the space inside of the second encoded word.

A second problem happens with continuation lines.  A continuation line that
starts with whitespace and is followed by a non-encoded word is fine because
the newline between such continuation lines is defined as condensing to
a single space character.  When the continuation line starts with whitespace
followed by an encoded word, however, the RFCs specify that the word is run
together with the encoded word on the previous line.  This is because normal
words are filded on syntactic breaks by encoded words are not.

The solution to this is to add the whitespace to the start of the encoded word
on the continuation line.

Test cases are from GH-92081

* Rename a variable so it's not confused with the final variable.
(cherry picked from commit a6fdb31b67)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2024-05-20 20:01:56 +00:00
Miss Islington (bot) d8c562af55
[3.13] gh-112844: Update CPE references for external dependencies (GH-118521) (#119237)
Co-authored-by: Seth Michael Larson <seth@python.org>
2024-05-20 13:32:38 -06:00
Miss Islington (bot) fda3291643
[3.13] DOCS: Suggest always calling exec with a globals argument and no locals argument (GH-119235) (#119239)
DOCS: Suggest always calling exec with a globals argument and no locals argument (GH-119235)

Many users think they want a locals argument for various reasons but they do not
understand that it makes code be treated as a class definition. They do not want
their code treated as a class definition and get surprised. The reason not
to pass locals specifically is that the following code raises a `NameError`:

```py
exec("""
def f():
    print("hi")

f()

def g():
    f()
g()
""", {}, {})
```

The reason not to leave out globals is as follows:

```py
def t():
    exec("""
def f():
    print("hi")

f()

def g():
    f()
g()
    """)
```
(cherry picked from commit 7e1a130b8f)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2024-05-20 18:15:25 +00:00
Miss Islington (bot) a6b873fb54
[3.13] GH-119146: Don't run JIT CI on unrelated changes (GH-119226)
(cherry picked from commit 5307f44fb9)
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-20 17:26:28 +00:00
Miss Islington (bot) e370b642ea
[3.13] gh-115119: Fall back to bundled libmpdec if system libmpdec is not found (GH-119196) (#119217)
(cherry picked from commit 642b25b9a8)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-05-20 16:10:21 +00:00