gh-116281: Remove wrong '\' from '\*' in some doc signatures (GH-116282)
(cherry picked from commit 4859ecb860)
Co-authored-by: HarryLHW <123lhw321@gmail.com>
Improve algorithm for computing which rolled-over log files to delete
in logging.TimedRotatingFileHandler. It is now reliable for handlers
without namer and with arbitrary deterministic namer that leaves
the datetime part in the file name unmodified.
(cherry picked from commit 87faec28c7)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-115978: Disable `*readv()` and `*writev()` on WASI (GH-116228)
Wasmtime doesn't implement these functions in a way to pass test_posix (https://github.com/bytecodealliance/wasmtime/issues/7830).
(cherry picked from commit 5dc8c84d39)
Co-authored-by: Brett Cannon <brett@python.org>
This mostly restores information removed in c12240ed28 (GH-114749).
(cherry picked from commit 05b04903a1)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Do not overwrite already rolled over files. It happened at midnight or
during the DST change and caused the loss of data.
* computeRollover() now always return the timestamp larger than the
specified time.
* Fix computation of the rollover time during the DST change.
(cherry picked from commit fee86fd9a4)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Support callables with the __call__() method and types with
__new__() and __init__() methods set to class methods, static
methods, bound methods, partial functions, and other types of
methods and descriptors.
Add tests for numerous types of callables and descriptors.
(cherry picked from commit 59167c962e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-87115: Set `__main__.__spec__` to `None` in pdb (#116141)
(cherry picked from commit ccfc042bbf)
* [3.12] gh-87115: Set `__main__.__spec__` to `None` in pdb (GH-116141)
(cherry picked from commit ccfc042bbf)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.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-116103: Prevent error in WindowsLoadTracker.__del__ on permission error (GH-116105)
(cherry picked from commit 186fa93876)
gh-116103: Prevent error in WindowsLoadTracker.__del__ if there was a permission error
Co-authored-by: Petr Viktorin <encukou@gmail.com>
gh-114572: Fix locking in cert_store_stats and get_ca_certs (GH-114573)
* gh-114572: Fix locking in cert_store_stats and get_ca_certs
cert_store_stats and get_ca_certs query the SSLContext's X509_STORE with
X509_STORE_get0_objects, but reading the result requires a lock. See
https://github.com/openssl/openssl/pull/23224 for details.
Instead, use X509_STORE_get1_objects, newly added in that PR.
X509_STORE_get1_objects does not exist in current OpenSSLs, but we can
polyfill it with X509_STORE_lock and X509_STORE_unlock.
* Work around const-correctness problem
* Add missing X509_STORE_get1_objects failure check
* Add blurb
(cherry picked from commit bce693111b)
Co-authored-by: David Benjamin <davidben@google.com>
gh-115197: Stop resolving host in urllib.request proxy bypass (GH-115210)
Use of a proxy is intended to defer DNS for the hosts to the proxy itself, rather than a potential for information leak of the host doing DNS resolution itself for any reason. Proxy bypass lists are strictly name based. Most implementations of proxy support agree.
(cherry picked from commit c43b26d02e)
Co-authored-by: Weii Wang <weii.wang@canonical.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>
* Increase coverage for compressed file-like objects initialized with a
file name, an open file object, a file object opened by file
descriptor, and a file-like object without name and mode attributes
(io.BytesIO)
* Increase coverage for name, fileno(), mode, readable(), writable(),
seekable() in different modes and states
* No longer skip tests with bytes names
* Test objects implementing the path protocol, not just pathlib.Path.
(cherry picked from commit e72576c48b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Listener.accept() no longer hangs when authkey is an empty bytes object.
(cherry picked from commit 686ec17f50)
Co-authored-by: Miguel Brito <5544985+miguendes@users.noreply.github.com>
gh-114763: Protect lazy loading modules from attribute access races (GH-114781)
Setting the __class__ attribute of a lazy-loading module to ModuleType enables other threads to attempt to access attributes before the loading is complete. Now that is protected by a lock.
(cherry picked from commit 200271c61d)
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
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>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* 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>
shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
(cherry picked from commit 79811ededd)