Commit graph

119312 commits

Author SHA1 Message Date
Miss Islington (bot)
045be7729e
[3.12] gh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions field. (GH-119364) (#119870)
gh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions field. (GH-119364)
(cherry picked from commit 015b1fdd0a)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-05-31 18:24:11 +01:00
Sam Gross
738cf21609
[3.12] gh-119585: Fix crash involving PyGILState_Release() and PyThreadState_Clear() (GH-119753) (#119861)
Make sure that `gilstate_counter` is not zero in when calling
`PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may
call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If
`gilstate_counter` is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.
(cherry picked from commit bcc1be39cb)
2024-05-31 15:42:09 +00:00
Serhiy Storchaka
d4680b9e17
[3.12] gh-103194: Fix Tkinter’s Tcl value type handling for Tcl 8.7/9.0 (GH-103846) (GH-119831)
Some of standard Tcl types were renamed, removed, or no longer
registered in Tcl 8.7/9.0. This change fixes automatic conversion of Tcl
values to Python values to avoid returning a Tcl_Obj where the primary
Python types (int, bool, str, bytes) were returned in older Tcl.
(cherry picked from commit 94e9585e99)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
2024-05-31 09:15:53 +00:00
Miss Islington (bot)
bd0d97ce34
[3.12] gh-107262: Update Tkinter tests for Tcl/Tk 8.6.14 (GH-119322) (GH-119807)
(cherry picked from commit 9732ed5ca9)

Co-authored-by: James De Bias <81095953+DBJim@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-30 21:23:38 +00:00
Serhiy Storchaka
207d1b032f
[3.12] gh-109218: Improve documentation for the complex() constructor (GH-119687) (ПР-119805)
* Remove the equivalence with real+imag*1j which can be incorrect in corner
  cases (non-finite numbers, the sign of zeroes).
* Separately document the three roles of the constructor: parsing a string,
  converting a number, and constructing a complex from components.
* Document positional-only parameters of complex(), float(), int() and bool()
  as positional-only.
* Add examples for complex() and int().
* Specify the grammar of the string for complex().
* Improve the grammar of the string for float().
* Describe more explicitly the behavior when real and/or imag arguments are
  complex numbers. (This will be deprecated in future.)
(cherry picked from commit ec1ba26460)
2024-05-30 20:52:44 +00:00
Miss Islington (bot)
2e31e5695d
[3.12] gh-109218: Refactor tests for the complex() constructor (GH-119635) (GH-119796)
* Share common classes.
* Use exactly representable floats and exact tests.
* Check the sign of zero components.
* Remove duplicated tests (mostly left after merging int and long).
* Reorder tests in more consistent way.
* Test more error messages.
* Add tests for missed cases.
(cherry picked from commit bf098d4157)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-30 18:05:38 +00:00
Miss Islington (bot)
863da7291c
[3.12] gh-119779: Fix pyporting howto docs (GH-119785) (#119789)
gh-119779: Fix pyporting howto docs (GH-119785)
(cherry picked from commit 6fb191be15)

Co-authored-by: Awbert <119314310+SweetyAngel@users.noreply.github.com>
2024-05-30 15:57:36 +00:00
Steve Dower
e85e813bf1
gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717)
Also backports a minor improvement to test_audit.
2024-05-30 15:40:23 +01:00
Miss Islington (bot)
fae9c92ba7
[3.12] gh-118055: Update the finder glossary entry (GH-118278) (GH-119774)
gh-118055: Update the finder glossary entry (GH-118278)
(cherry picked from commit db009348b4)

Co-authored-by: Lincoln <71312724+Lincoln-developer@users.noreply.github.com>
2024-05-30 08:57:36 +00:00
Miss Islington (bot)
e408059711
[3.12] subprocess docs: Fix semantically important typo (GH-119752) (#119758)
subprocess docs: Fix semantically important typo (GH-119752)

GH-25416 accidentally replaced a reference to the *stderr* argument of
`subprocess.run` with a reference to the *stdin* argument.  *stdin* is
not affected by the `check_output` option.
(cherry picked from commit 2cc3502f98)

Co-authored-by: Zachary Ware <zach@python.org>
2024-05-30 08:50:23 +01:00
Miss Islington (bot)
d4a146d567
[3.12] GH-89727: Fix FD leak on os.fwalk() generator finalization. (GH-119766) (#119768)
GH-89727: Fix FD leak on `os.fwalk()` generator finalization. (GH-119766)

Follow-up to 3c890b50. Ensure we `os.close()` open file descriptors when
the `os.fwalk()` generator is finalized.
(cherry picked from commit a5fef800d3)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-30 05:30:37 +01:00
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