Commit graph

119701 commits

Author SHA1 Message Date
Miss Islington (bot)
aae371bda4
[3.12] GH-89727: Fix os.fwalk() recursion error on deep trees (GH-119638) (#119765)
GH-89727: Fix `os.fwalk()` recursion error on deep trees (GH-119638)

Implement `os.fwalk()` using a list as a stack to avoid emitting recursion
errors on deeply nested trees.
(cherry picked from commit 3c890b503c)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-30 03:32:14 +00:00
Miss Islington (bot)
681d7da144
[3.12] gh-119260: Clarify is_dataclass Behavior for Subclasses in Documentation and Tests (GH-119480) (#119761)
gh-119260: Clarify is_dataclass Behavior for Subclasses in Documentation and Tests (GH-119480)
(cherry picked from commit bf4ff3ad2e)

Co-authored-by: Aditya Borikar <adityaborikar2@gmail.com>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-05-30 03:24:50 +00:00
Barney Gale
45587df8d0
[3.12] GH-89727: Partially fix shutil.rmtree() recursion error on deep trees (GH-119634) (#119749)
* GH-89727: Partially fix `shutil.rmtree()` recursion error on deep trees (#119634)

Make `shutil._rmtree_unsafe()` call `os.walk()`, which is implemented
without recursion.

`shutil._rmtree_safe_fd()` is not affected and can still raise a recursion
error.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit a150679f90)
2024-05-29 21:53:08 +01:00
Steve Dower
e902503980
gh-119070: Avoid test crash due to Unicode in stderr output (GH-119747) 2024-05-29 20:51:30 +00:00
Steve Dower
bc01c5d225
gh-119070: Fix py.exe handling of /usr/bin/env commands missing extension (GH-119426) 2024-05-29 20:12:55 +01:00
Miss Islington (bot)
a62681c405
[3.12] gh-119704: Fix reference leak in the `Python/Python-tokenize.c` (GH-119705) (#119708) 2024-05-29 07:18:04 +00:00
Miss Islington (bot)
46a37a1a92
[3.12] gh-119538: Add missing expat build dependencies (GH-119647) (#119686)
xmltok_impl.c and xmltok_ns.c are _included_ in xmltok.c by the C
pre-processor.

(cherry picked from commit 606be66362)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-05-28 22:10:49 +00:00
Miss Islington (bot)
4a0af0cfdc
[3.12] gh-119118: Fix performance regression in tokenize module (GH-119615) (#119683)
- Cache line object to avoid creating a Unicode object
  for all of the tokens in the same line.
- Speed up byte offset to column offset conversion by using the
  smallest buffer possible to measure the difference.

(cherry picked from commit d87b015106)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2024-05-28 22:49:02 +02:00
Jelle Zijlstra
7f06cd335e
[3.12] gh-119011: type.__type_params__ now return an empty tuple (GH-119296) (#119681)
(cherry picked from commit 6b240c2308)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-28 19:54:47 +00:00
Miss Islington (bot)
08636c1a7d
[3.12] gh-119581: Add a test of InitVar with name shadowing (GH-119582) (#119673)
gh-119581: Add a test of InitVar with name shadowing (GH-119582)
(cherry picked from commit 6ec371223d)

Co-authored-by: Steven Troxler <steven.troxler@gmail.com>
2024-05-28 17:42:01 +00:00
Miss Islington (bot)
3af9b75df5
[3.12] Clarify base64.a85encode docs: *wrapcols* doesn't count the newline (GH-119409) (GH-119482)
Clarify base64.a85encode docs: *wrapcols* doesn't count the newline (GH-119409)
(cherry picked from commit ffa24aab10)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-28 16:55:43 +02:00
Miss Islington (bot)
5cca0419cf
[3.12] [doc] Clarify the nature of the root logger in the logging documentation (GH-119440) (GH-119652)
(cherry picked from commit b407ad38fb)
2024-05-28 15:04:19 +01:00
Miss Islington (bot)
6ffbd934aa
[3.12] Re-order imports to align with zipp 3.18.2 (GH-119587) (#119590)
Re-order imports to align with zipp 3.18.2 (GH-119587)
(cherry picked from commit 5482a939ac)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-05-28 08:49:38 -04:00
Nice Zombies
09a85eaa4c
gh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule (GH-119608) 2024-05-28 11:13:01 +01:00
Miss Islington (bot)
ab9b605efa
[3.12] gh-116860: Remove outdated test_parserhack from test_future (GH-116861) (#119648)
gh-116860: Remove outdated `test_parserhack` from `test_future` (GH-116861)
(cherry picked from commit 669175bf8e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-28 09:50:26 +00:00
Raymond Hettinger
8fb48542d3
[3.12] Misc cleanups and wording improvements for the itertools docs (gh-119631) 2024-05-27 13:43:08 -05:00
Miss Islington (bot)
823c66a789
[3.12] gh-119580: Improve version added section for convenience variable (GH-119583) (#119625)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-05-27 19:04:01 +01:00
Miss Islington (bot)
e658d87ad4
[3.12] Docs: Only install sphinx-autobuild for make htmllive (GH-119607) (#119622)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-27 17:35:57 +00:00
Miss Islington (bot)
8d7e54af0d
[3.12] gh-119467: Fix Py_buffer.format type and correct documentation typo (GH-119475) (#119603)
gh-119467: Fix Py_buffer.format type and correct documentation typo (GH-119475)
(cherry picked from commit 3b26cd8ca0)

Co-authored-by: Aditya Borikar <adityaborikar2@gmail.com>
2024-05-27 12:22:23 +00:00
Miss Islington (bot)
53843c22e5
[3.12] Fix typos in HISTORY documentation (GH-119453) (#119598)
Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
2024-05-27 08:04:05 +00:00
Hugo van Kemenade
7f86c769db
[3.12] docs: fix a few typos identified by codespell (GH-119516) (#119571)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2024-05-26 08:15:57 +00:00
Miss Islington (bot)
d4e382ba31
[3.12] FAQ: Add reference to Python version numbering scheme (GH-119225) (#119545)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-25 14:19:35 +00:00
Raymond Hettinger
2d700670ad
[3.12] Misc improvements to the docs for itertools (gh-119532) 2024-05-24 17:35:38 -05:00
Miss Islington (bot)
30679a65ac
[3.12] Regen `Doc/requirements-oldest-sphinx.txt` (GH-119520) (#119523)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-05-24 14:01:53 -06:00
Miss Islington (bot)
4c0bc69238
[3.12] GH-119496: accept UTF-8 BOM in .pth files (GH-119509)
`Out-File -Encoding utf8` and similar commands in Windows Powershell 5.1 emit
UTF-8 with a BOM marker, which the regular `utf-8` codec decodes incorrectly.

`utf-8-sig` accepts a BOM, but also works correctly without one.

This change also makes .pth files match the way Python source files are handled.

(cherry picked from commit bf5b6467f8)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2024-05-24 14:52:09 +00:00
Victor Stinner
078da88ad1
[3.12] gh-69214: Fix fcntl.ioctl() request type (#119498) (#119505)
gh-69214: Fix fcntl.ioctl() request type (#119498)

Use an 'unsigned long' instead of an 'unsigned int' for the request
parameter of fcntl.ioctl() to support requests larger than UINT_MAX.

(cherry picked from commit 92fab3356f)
2024-05-24 12:53:41 +00:00
Miss Islington (bot)
2b091b9aa9
[3.12] gh-119317: findall instead of traverse for docutils nodes (GH-119319) (#119487)
gh-119317: findall instead of traverse for docutils nodes (GH-119319)
(cherry picked from commit 0867bce457)

Co-authored-by: Carlos Meza <hire@carlosmeza.com>
2024-05-24 02:12:23 +00:00
Miss Islington (bot)
122dd4f48a
[3.12] [3.13] gh-119461: Fix ThreadedVSOCKSocketStreamTest (GH-119465) (GH-119479) (#119484)
[3.13] gh-119461: Fix ThreadedVSOCKSocketStreamTest (GH-119465) (GH-119479)

gh-119461: Fix ThreadedVSOCKSocketStreamTest (GH-119465)

Fix ThreadedVSOCKSocketStreamTest: if get_cid() returns the host
address or the "any" address, use the local communication address
(loopback): VMADDR_CID_LOCAL.

On Linux 6.9, apparently, the /dev/vsock device is now available but
get_cid() returns VMADDR_CID_ANY (-1).

(cherry picked from commit c750061047)

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit e94dbe4ed8)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-23 23:23:55 +00:00
Miss Islington (bot)
ddaed629f4
[3.12] gh-90562: Mention slots pitfall in dataclass docs (GH-107391) (#119351)
Co-authored-by: Josh Cannon <joshdcannon@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-23 00:16:23 -06:00
Eric Snow
0d5fe2c7b4
[3.12] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) (gh-119425)
_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)
2024-05-22 22:26:58 +00:00
Miss Islington (bot)
7eb59cd95b
[3.12] gh-70795: Rework RLock documentation (GH-103853) (#119437)
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 20:21:42 +00:00
Nice Zombies
874a4f7d08
gh-118507 : Refactor ntpath native functions (gh-119381)
This refactoring will make future backports easier without changing behaviours,
apart from correcting a bug when passing a pipe to `ntpath.isfile`.
2024-05-22 15:49:26 +01:00
Miss Islington (bot)
8c96850161
[3.12] gh-118643: Fix AttributeError in the email module (GH-119099) (GH-119390)
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:08:05 +03:00
Miss Islington (bot)
2c7e9de98b
[3.12] Fix version number in use_load_tests deprecation reference (GH-119151) (GH-119387)
Deprecation took place in d78742a260 (3.5)
(cherry picked from commit aee8f03abb)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2024-05-22 09:49:41 +00:00
Miss Islington (bot)
9bd9879ca7
[3.12] Clarify that dklen is expected in bytes for the hashlib functions (GH-106624) (GH-119384)
(cherry picked from commit 5adf78f546)

Co-authored-by: Mathijs Mortimer <thiezn@users.noreply.github.com>
2024-05-22 08:58:03 +00:00
Miss Islington (bot)
9801fbad67
[3.12] gh-110383: Align dict.get(), .fromkeys(), and .setdefault() docs with docstrings (GH-119330) (#119371)
(cherry picked from commit 0e3c8cda1f)

Co-authored-by: Landon Wood <landon@elkrange.com>
2024-05-22 01:22:05 +00:00
Miss Islington (bot)
47b09d2e4c
[3.12] gh-119189: Add yet more tests for mixed Fraction arithmetic (GH-119298) (GH-119347)
(cherry picked from commit 10b1bd926a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-21 22:49:16 +00:00
Miss Islington (bot)
f31ce5e364
[3.12] Fix typos in documentation (GH-119295) (#119338)
Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
2024-05-21 22:33:32 +00:00
Miss Islington (bot)
a1c20529e2
[3.12] gh-110383: Document socket.makefile() accepts combined modes (GH-119150) (#119325)
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:52:56 +00:00
Miss Islington (bot)
4dfba854ec
[3.12] GH-110383: Improve Tutorial for Input Ouput (GH-119230) (GH-119327)
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:20 +02:00
Hugo van Kemenade
22bef96237
[3.12] Docs: Ensure no warnings are found in the NEWS file before a given line number (GH-119221) (#119266) 2024-05-21 08:40:16 -06:00
Miss Islington (bot)
8b6175c261
[3.12] gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (GH-119175) (#119290)
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 04:09:30 +00:00
Miss Islington (bot)
d8981abb1c
[3.12] gh-118912: Remove description of issue fixed in 3.5 from autospeccing guide (GH-119232) (#119283)
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:40:17 +00:00
Victor Stinner
ec5743b5f2
[3.12] gh-119050: Add XML support to libregrtest refleak checker (#119148) (#119272)
gh-119050: Add XML support to libregrtest refleak checker (#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)
2024-05-20 22:56:34 +00:00
Miss Islington (bot)
cdccafb2d4
[3.12] gh-108267 Fix another dataclasses docs typo (GH-119277) (#119280)
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 18:48:54 -04:00
Miss Islington (bot)
f489911f2c
[3.12] gh-119189: Add more tests for mixed Fraction arithmetic (GH-119236) (GH-119256)
(cherry picked from commit fe67af1963)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-20 20:58:40 +00:00
Miss Islington (bot)
17389446c6
[3.12] Use correct markup in unittest.mock.reset_mock documentation (GH-119207) (GH-119249)
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:29 +02:00
Miss Islington (bot)
ffe9ba0477
[3.12] gh-92081: Fix for email.generator.Generator with whitespace between encoded words. (GH-92281) (#119246)
* 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:10:49 +00:00
Miss Islington (bot)
386e49259c
[3.12] gh-112844: Update CPE references for external dependencies (GH-118521) (#119238)
Co-authored-by: Seth Michael Larson <seth@python.org>
2024-05-20 13:32:51 -06:00
Miss Islington (bot)
a50f0651ee
[3.12] DOCS: Suggest always calling exec with a globals argument and no locals argument (GH-119235) (#119240)
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:11:36 +00:00