read() returns bytes for a file opened in binary mode,
so b'' should be used as a sentinel instead of ''.
Otherwise the loop will be infinite.
(cherry picked from commit 11fa0e48a9)
Co-authored-by: Cristian Ciupitu <cristian.ciupitu@yahoo.com>
Fix test_ssl for strict OpenSSL configuration like RHEL8 strict crypto policy.
Use older TLS version for minimum TLS version of the server SSL context if
needed, to test TLS version older than default minimum TLS version.
(cherry picked from commit 3ef6344ee5)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
`object.__new__` and `object.__init__` do take one argument each,
they just don't take extra user supplied arguments.
Patch by Sanyam Khurana.
(cherry picked from commit 5105483acb)
Co-authored-by: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>
Fix C implementation of pickle.loads to use importlib's locking mechanisms, and thereby avoid using partially-loaded modules.
(cherry picked from commit 4371c0a9c0)
Co-authored-by: tjb900 <ozburgess@gmail.com>
Need to reset capturing groups between two SRE(match) callings in loops, this fixes wrong capturing groups in rare cases.
Also add a missing index in re.rst.
(cherry picked from commit 4a7f44a2ed)
Co-authored-by: animalize <animalize@users.noreply.github.com>
The error message emitted when returning invalid types from __fspath__ in interfaces that allow passing PathLike objects has been improved and now it does explain the origin of the error.
(cherry picked from commit 09fbcd6085)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Not using `__class_getitem__()` fallback if there is a non-subcriptable metaclass was caused by a certain asymmetry between how `PySequenceMethods` and `PyMappingMethods` are used in `PyObject_GetItem`. This PR removes this asymmetry. No tests failed, so I assume it was not intentional.
(cherry picked from commit ac28147e78)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
Previously, `debug print(` would cause the interpreter to exit on a SyntaxError whereas `print(` would properly display the error and return to the pdb prompt.
This patch fixes this by pre-compiling the code before passing it to `Pdb.run`.
https://bugs.python.org/issue35931
(cherry picked from commit 4327705cfa)
Co-authored-by: Daniel Hahler <github@thequod.de>
Based on reviewer feedback from Allen Downey, convert ``lambda`` to ``def``.
(cherry picked from commit 9abb725cea)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Documentation of sys.stdin/out/err update to reflect change in 3.6 on Windows to use UTF-8.
Wording by Eryk Sun and Paul Moore.
https://bugs.python.org/issue30410
(cherry picked from commit 5723263a3a)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
[bpo-35633](https://bugs.python.org/issue35633): Fix a test regression introduced with [bpo-35189](https://bugs.python.org/issue35189) (PEP 475: fnctl functions are not retried if interrupted (EINTR)).
Not only a blocking IO error needs to be ignored - permission errors also need to be ignored.
p.s. - iirc as a "test" only correction a NEWS item is not required. If this is not correct - just mention, and I'll add a NEWS blurb.
https://bugs.python.org/issue35633
(cherry picked from commit b94d4bed67)
Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
Fix a crash in slice_richcompare(): use strong references rather than
stolen references for the two temporary internal tuples.
The crash (or assertion error) occurred if a garbage collection
occurred during slice_richcompare(), especially while calling
PyObject_RichCompare(t1, t2, op).
(cherry picked from commit dcb68f47f7)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Make test_imap4_host_default_value independent on whether the
local IMAP server is running.
(cherry picked from commit 3dc67d0316)
Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
Keeping references to processes and managers between tests makes them count as dangling processes.
(cherry picked from commit 613f729e5d)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Protect dict iterations by wrapping them with _IterationGuard in the
following methods:
- WeakValueDictionary.copy()
- WeakValueDictionary.__deepcopy__()
- WeakKeyDictionary.copy()
- WeakKeyDictionary.__deepcopy__()
(cherry picked from commit 96d37dbcd2)
Co-authored-by: Fish <ltfish@users.noreply.github.com>
multiprocessing: provide unittests for manager classes and shareable types.
(cherry picked from commit 2848d9d299)
Co-authored-by: Giampaolo Rodola <g.rodola@gmail.com>
This module is built by _asyncio.vcxproj and does not need to be included in pythoncore.
(cherry picked from commit fbf50683b3)
Co-authored-by: Gregory Szorc <gregory.szorc@gmail.com>
Make sure that failure paths call CloseHandle outside of the function that failed
(cherry picked from commit b82bfac436)
Co-authored-by: Mark Becwar <mark@thebecwar.com>
Add one char to MsiSummaryInfoGetProperty() output
Based on the patch in bpo-1104 by Anthony Tuininga (atuining) and Mark McMahon (markm).
(cherry picked from commit 2de576e16d)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>