gh-75988: Fix issues with autospec ignoring wrapped object (#115223)
* set default return value of functional types as _mock_return_value
* added test of wrapping child attributes
* added backward compatibility with explicit return
* added docs on the order of precedence
* added test to check default return_value
(cherry picked from commit 735fc2cbbc)
It is confusing, because libc is not imported from ctypes,
but defined in previous examples, which already contain the import.
(cherry picked from commit 744c077795)
Co-authored-by: jnchen <caojingchen@live.com>
GH-116218 Docs: Add availability information for the 'resource' module (GH-116256)
Add availability data to 'resource' module Docs
(cherry picked from commit 03f86b1b62)
Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
(cherry picked from commit 601f3a7b33)
Co-authored-by: Nicolas A. Oyarzabal <79150521+nicky-eng@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods:
- `xml.etree.ElementTree.XMLParser.flush`
- `xml.etree.ElementTree.XMLPullParser.flush`
- `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`
- `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`
- `xml.sax.expatreader.ExpatParser.flush`
Based on the "flush" idea from https://github.com/python/cpython/pull/115138#issuecomment-1932444270 .
- Please treat as a security fix related to CVE-2023-52425.
(cherry picked from commit 6a95676bb5)
(cherry picked from commit 73807eb634)
(cherry picked from commit eda2963378)
---------
Includes code suggested-by: Snild Dolkow <snild@sony.com>
and by core dev Serhiy Storchaka.
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Amend wording after gh-116019 was merged.
(cherry picked from commit e205c5cd8f)
Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
gh-116281: Remove wrong '\' from '\*' in some doc signatures (GH-116282)
(cherry picked from commit 4859ecb860)
Co-authored-by: HarryLHW <123lhw321@gmail.com>
This mostly restores information removed in c12240ed28 (GH-114749).
(cherry picked from commit 05b04903a1)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Fix rendering of null character in ast.rst (GH-116080)
(cherry picked from commit c04a981ff4)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
GH-115986 Reorder pprint docs and amend some references (GH-116019)
Introduce a new subsubsection, 'Functions', for module level functions,
and place it before the PrettyPrinter class reference.
Also:
- Fix pprint.pprint() references so they properly link to the module
level function.
- Add links to sys.stdout.
(cherry picked from commit 6c1c94dc51)
Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
doc: Use super() in subclassed JSONEncoder examples (GH-115565)
Replace calls to `json.JSONEncoder.default(self, obj)`
by `super().default(obj)` within the examples of the documentation.
(cherry picked from commit 647053fed1)
Co-authored-by: Jan Max Meyer <jmm@phorward.de>
Remove a left-over sentence that refers to an example that was present in Python 3.10 and was using ``Py_OptimizeFlag``.
(cherry picked from commit 915d7dd090)
Co-authored-by: Antti Haapala <antti.haapala@interjektio.fi>
* clean up fcntl module doc
* simplify
* a few changes, based on suggestion by CAM-Gerlach
* nitpick ignore for a couple other C functions mentioned in the fcntl module doc
* more changes, especially related to LOCK_* constants
* :data: back to :const:
* Apply suggestions from code review
---------
(cherry picked from commit 84a275c4a2)
Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.
(cherry picked from commit cb287d3421)
Co-authored-by: mauricelambert <50479118+mauricelambert@users.noreply.github.com>
Added to repr entry in Doc/library/functions.rst.
---------
(cherry picked from commit 5770006ffa)
Co-authored-by: Oh seungmin <tmdals179@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Thanks to Pedro Arthur Duarte (pedroarthur.jedi at gmail.com) for help with this bug.
(cherry picked from commit f7455864f2)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>