gh-141004: Document C APIs for dictionary keys, values, and items (GH-141009)
(cherry picked from commit f72768f30e)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Split existing tests on smaller methods and move them to separate class.
Rename variable "content" to "it".
Use BytesIO instead of StringIO.
Add few more tests.
(cherry picked from commit 2fbd396666)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-140260: fix data race in `_struct` module initialization with subinterpreters (GH-140909)
(cherry picked from commit 63548b3699)
Co-authored-by: Shamil <ashm.tech@proton.me>
Xcode concatenates the test argument array, losing quoting in the process.
(cherry picked from commit 558936bec1)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
The endpoint used for demonstrating reading URLs is no longer
stable. This change substitutes a target over which we have more
control.
(cherry picked from commit fbcac79951)
Co-authored-by: Bob Kline <bkline@users.noreply.github.com>
gh-132657: add regression test for `PySet_Contains` with unhashable type (GH-141411)
(cherry picked from commit 2ac738d325)
Co-authored-by: M Bussonnier <bussonniermatthias@gmail.com>
Fix error in assertion which causes failure if pos is equal to PY_SSIZE_T_MAX.
Fix undefined behavior in read() and readinto() if pos is larger that the size
of the underlying buffer.
(cherry picked from commit 7d54374f9c)
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
gh-138621: Increase test coverage for csv.DictReader and csv.Sniffer (GH-138622)
* Increase test coverage for csv.DictReader and csv.Sniffer
Previously there were no tests for the DictReader fieldnames
setter, the case where a StopIteration was encountered when trying
to determine the fieldnames from the content or the case where
Sniffer could not find a delimiter.
* Revert whitespace change to comment
* Add a test that csv.Sniffer.has_header checks up to 20 rows
* Replace name and age with letter and offset
* Address review comment
---------
(cherry picked from commit 0e88be6f55)
Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
gh-137952: update `csv.Sniffer().has_header()` docs to describe the actual off-by-onish behavior (GH-137953)
* checks 21, not 20
* Say "header" instead of "first row" to disambiguate per review.
---------
(cherry picked from commit 0d7b48a8f5)
Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
gh-141004: Document `PyFile_OpenCode` and `PyFile_OpenCodeObject` (GH-141413)
(cherry picked from commit 2befce86e6)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
gh-140193: Forward port test_exec_set_nomemory_hang from 3.13 (GH-140187)
* chore: test_exec_set_nomemory_hang from 3.13
* fix: apply comments
* Update Lib/test/test_exceptions.py
* Update Lib/test/test_exceptions.py
* fix: windows too long name 60 times is enough
---------
(cherry picked from commit 0f09bda643)
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
gh-139533: fix refs to code without proper markups on turtledemo doc (GH-139534)
(cherry picked from commit c903d76832)
gh-139533: fix refs to code without proper markups on turtledemo documentation
Co-authored-by: Marco Barbosa <aureliobarbosa@gmail.com>
gh-140379: add hyperlinks to list and set (GH-140399)
add hyperlinks to list and set
(cherry picked from commit 92741c59f8)
Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
gh-140578: Doc: Remove sencence implying that concurrent.futures.ThreadPoolExecutor does not exist (GH-140689)
* Doc: Remove sencence implying that concurrent.futures.ThreadPoolExecutor does not exist
Closes GH-140578
* Add NEWS.d entry for gh-140578
---------
(cherry picked from commit 46b58e1bb9)
Co-authored-by: Louis <paternal@users.noreply.github.com>
Co-authored-by: Louis Paternault <spalax@gresille.org>
gh-141174: Improve `annotationlib._Stringifier` test coverage (GH-141220)
* Test `_Stringifier.__convert_to_ast()` for containers
* Test partial evaluation of `ForwardRef`s in `_Stringifier`
(cherry picked from commit 55ea132313)
Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
gh-141174: Improve `ForwardRef` test coverage (GH-141175)
* Test unsupported format in ForwardRef.evaluate()
* Test dict cell closure with multiple variables
* Test all options in ForwardRef repr
* Test ForwardRef being a final class
(cherry picked from commit 19b573025e)
Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
gh-141174: Improve `annotationlib.call_annotate_function()` test coverage (GH-141176)
* Test passing unsupported Format values to call_annotate_function()
* Test call_evaluate_function with fake globals that raise errors
* Fix typo and comparison in test_fake_global_evaluation
(cherry picked from commit 1110e8f6a4)
Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
gh-141174: Improve `annotationlib.get_annotations()` test coverage (GH-141286)
* Test `get_annotations(format=Format.VALUE)` for stringized annotations on custom objects
* Test `get_annotations(format=Format.VALUE)` for stringized annotations on wrapped partial functions
* Update test_stringized_annotations_with_star_unpack() to actually test stringized annotations
* Test __annotate__ returning a non-dict
* Test passing globals and locals to stringized `get_annotations()`
(cherry picked from commit 06b62282c7)
Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
(cherry picked from commit d2ce6d708a)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Author: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Karina Souza <97332018+KarinaS0uza@users.noreply.github.com>
Co-authored-by: Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
gh-62480: De-personalize "Partial mocking" section in `unittest.mock` examples (GH-141321)
* Refine some wording in unittest partial mock doc
Some of the descriptions were addressed in first person,
but have now been changed to address the user reading the documentation instead.
(cherry picked from commit b618731781)
Co-authored-by: KarnbirKhera <166065758+KarnbirKhera@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>