if it is called with a sequence or set, but not list or tuple.
(cherry picked from commit f572cbf1fa)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Fix incorrect handling of exceptions when interpreting dialect objects in
the csv module. Not clearing exceptions between calls to
PyObject_GetAttrString() causes assertion failures in pydebug mode (or with
assertions enabled).
Add a minimal test that would've caught this (passing None as dialect, or
any object that isn't a csv.Dialect subclass, which the csv module allows
and caters to, even though it is not documented.) In pydebug mode, the test
triggers the assertion failure in the old code.
Contributed-By: T. Wouters [Google]
(cherry picked from commit 0093876328)
Co-authored-by: T. Wouters <thomas@python.org>
Add testcleanup section to configparser and bz2 documentation which
removes temporary files created in the filesystem when 'make doctest'
is run.
(cherry picked from commit 48a5aa7f12)
Co-authored-by: Kevin Follstad <kfollstad@gmail.com>
Making the description of `InspectLoader.is_package` aligned with the current implementation.
Automerge-Triggered-By: GH:jaraco
(cherry picked from commit 8b9310d902)
Co-authored-by: Junnosuke Kuroda <Isa-rentacs@users.noreply.github.com>
Fixes the misleading IsADirectoryError to be FileNotFoundError.
(cherry picked from commit 248173cc04)
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
Automerge-Triggered-By: GH:gpshead
In debug build failed tee.fromiterable() corrupted the linked list of all GC objects.
(cherry picked from commit f64de53ff0)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit d33943a6c3)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Py_RunMain() now resets PyImport_Inittab to its initial value at
exit. It must be possible to call PyImport_AppendInittab() or
PyImport_ExtendInittab() at each Python initialization.
(cherry picked from commit 489699ca05)
It defaults to None and is positional only.
(cherry picked from commit d1ae57027f)
Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
No longer use len() to get the length of the input data. For some buffer protocol objects, the length obtained by using len() is wrong.
Co-authored-by: Marco Ribeiro <marcoffee@users.noreply.github.com>
Fix asyncio test_popen() of test_windows_utils by using a longer
timeout. Use military grade battle-tested test.support.SHORT_TIMEOUT
timeout rather than a hardcoded timeout of 10 seconds: it's 30
seconds by default, but it is made longer on slow buildbots.
WaitForMultipleObjects() timeout argument is in milliseconds.
(cherry picked from commit be1cb3214d)
Co-authored-by: Victor Stinner <vstinner@python.org>
Put entry in Design FAQ after a question about a context manager for assignment.
Original patch by Aidan Lowe.
(cherry picked from commit 51f45d085d)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
_thread.start_new_thread() no longer calls PyThread_exit_thread()
explicitly at the thread exit, the call was redundant.
On Linux with the glibc, pthread_cancel() loads dynamically the
libgcc_s.so.1 library. dlopen() can fail if there is no more
available file descriptor to open the file. In this case, the process
aborts with the error message:
"libgcc_s.so.1 must be installed for pthread_cancel to work"
pthread_cancel() unwinds back to the thread's wrapping function that
calls the thread entry point.
The unwind function is dynamically loaded from the libgcc_s library
since it is tightly coupled to the C compiler (GCC). The unwinder
depends on DWARF, the compiler generates DWARF, so the unwinder
belongs to the compiler.
Thanks Florian Weimer and Carlos O'Donell for their help on
investigating this issue.
(cherry picked from commit 45a78f906d)
Test for execution of the body was null. It would pass
even if the code which should be skipped was executed.
(cherry picked from commit 5d2b3a0d68)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The threading.enumerate() function now uses a reentrant lock to
prevent a hang on reentrant call.
(cherry picked from commit 243fd01047)
Co-authored-by: Victor Stinner <vstinner@python.org>