Ref. [SQLite 3.7.15 changelog](https://sqlite.org/changes.htmlGH-version_3_7_15):
_"Avoid invoking the sqlite3_trace() callback multiple times when a statement is automatically reprepared due to SQLITE_SCHEMA errors."_
(cherry picked from commit f7f0ed59bc)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Unexpected errors in calling the __iter__ method are no longer
masked by TypeError in csv.reader(), csv.writer.writerow() and
csv.writer.writerows().
(cherry picked from commit c88239f864)
There was a race condition in base64 in lazy initialization of multiple globals.
(cherry picked from commit 9655434cca)
Co-authored-by: Brandon Stansbury <brandonrstansbury@gmail.com>
When the modern text= spelling of the universal_newlines= parameter was added
for Python 3.7, check_output's special case around input=None was overlooked.
So it behaved differently with universal_newlines=True vs text=True. This
reconciles the behavior to be consistent and adds a test to guarantee it.
Also clarifies the existing check_output documentation.
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
(cherry picked from commit 64abf37344)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
On Fedora 31 gdb is using python 3.7.9, calling `proxyval` on an instance with a dictionary fails because of the `dict.iteritems` usage. This PR changes the code to be compatible with py2 and py3.
This changed seemed small enough to not need an issue and news blurb, if one is required please let me know.
Automerge-Triggered-By: GH:benjaminp
(cherry picked from commit b57ada98da)
Co-authored-by: Augusto Hack <hack.augusto@gmail.com>
In Python 2, it was possible to use `except` with a nested tuple, and occasionally natural. For example, `zope.formlib.interfaces.InputErrors` is a tuple of several exception classes, and one might reasonably think to do something like this:
try:
self.getInputValue()
return True
except (InputErrors, SomethingElse):
return False
As of Python 3.0, this raises `TypeError: catching classes that do not inherit from BaseException is not allowed` instead: one must instead either break it up into multiple `except` clauses or flatten the tuple. However, the reference documentation was never updated to match this new restriction. Make it clear that the definition is no longer recursive.
Automerge-Triggered-By: GH:ericvsmith
(cherry picked from commit c95f8bc270)
Co-authored-by: Colin Watson <cjwatson@debian.org>
Co-authored-by: Colin Watson <cjwatson@debian.org>
Now all platforms use a value for the "EXT_SUFFIX" build variable derived
from SOABI (for instance in FreeBSD, "EXT_SUFFIX" is now ".cpython-310d.so"
instead of ".so"). Previously only Linux, Mac and VxWorks were using a value
for "EXT_SUFFIX" that included "SOABI".
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
(cherry picked from commit a44ce6c9f7)
Co-authored-by: Matti Picus <matti.picus@gmail.com>
* Tkinter functions and constructors which need a default root window
raise now RuntimeError with descriptive message instead of obscure
AttributeError or NameError if it is not created yet or cannot
be created automatically.
* Add tests for all functions which use default root window.
* Fix import in the pynche script.
(cherry picked from commit 3d569fd6dc)
Up until now, the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.
(cherry picked from commit 84ebcf271a)
Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
Fix freeze.py tool to use the prope config and library directories.
(cherry picked from commit 1c653f17cb)
Co-authored-by: Victor Stinner <vstinner@python.org>
Same as FreeBSD, file descriptors in /dev/fd id from 0 to 63.
(cherry picked from commit 13b865f0e1)
Co-authored-by: David CARLIER <devnexen@gmail.com>
Co-authored-by: David CARLIER <devnexen@gmail.com>
* bpo-42644: Validate values in logging.disable()
Technically make the value of manager a property that checks and convert
values assigned to it properly. This has the side effect of making
`logging.disable` also accept strings representing the various level of
warnings.
We want to validate the type of the disable attribute at assignment
time, as it is later compared to other levels when emitting warnings and
would generate a `TypeError: '>=' not supported between ....` in a
different part of the code base, which can make it difficult to track
down.
When assigned an incorrect value; it will raise a TypeError when the
wrong type, or ValueError if an invalid str.
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit b32d8b4f9b)
Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Add positional only args support to lib2to3 pgen2.
This adds 3.8's PEP-570 support to lib2to3's pgen2. lib2to3, while
being deprecated is still used by things to parse all versions of Python
code today. We need it to support parsing modern 3.8 and 3.9 constructs.
Also add tests for complex *expr and **expr's.
(cherry picked from commit 42c9f0fd0a)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
This is invalid in C99 and later and is an error with some compilers
(e.g. clang in Xcode 12), and can thus cause configure checks to
produce incorrect results.
(cherry picked from commit 674fa0a740)
Co-authored-by: Joshua Root <jmr@macports.org>
Fix encoding name when running a ".pyc" file on Windows:
PyRun_SimpleFileExFlags() now uses the correct encoding to decode the
filename.
* Add pyrun_file() subfunction.
* Add pyrun_simple_file() subfunction.
* PyRun_SimpleFileExFlags() now calls _Py_fopen_obj() rather than
_Py_fopen().
(cherry picked from commit b6d98c10ff)
(cherry picked from commit f0e42ae03c)
Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector:
- collections.OrderedDict.items
- dict.items
- enumerate
- functools.reduce
- itertools.combinations
- itertools.combinations_with_replacement
- itertools.permutations
- itertools.product
- itertools.zip_longest
- zip
Previously, they could have become untracked by a prior garbage collection.
(cherry picked from commit 226a012d1c)
This can happen when a file was edited after it was imported.
(cherry picked from commit 2e0760bb2e)
Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
Fix test_asyncio.test_call_later() race condition: don't measure
asyncio performance in the call_later() unit test. The test failed
randomly on the CI.
(cherry picked from commit 7e5e13d113)
Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-42406: Fix whichmodule() with multiprocessing
Signed-off-by: Renato L. de F. Cunha <renatoc@br.ibm.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
(cherry picked from commit 86684319d3)
Co-authored-by: Renato Cunha <renatocunha@acm.org>
The function accepts now the representation of the default state as
empty sequence (as returned by Style.map()).
The structure of the result is now the same on all platform
and does not depend on the value of wantobjects.
(cherry picked from commit dd844a2916)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
As [bpo-38443]() says the error message from configure when specifying --enable-universalsdk with a set of architectures that is not supported by the compiler is not very helpful. This PR explicitly checks if the compiler works and bails out if it doesn't.
(cherry picked from commit 0f20bd9042)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
* bpo-40791: Make compare_digest more constant-time.
The existing volatile `left`/`right` pointers guarantee that the reads will all occur, but does not guarantee that they will be _used_. So a compiler can still short-circuit the loop, saving e.g. the overhead of doing the xors and especially the overhead of the data dependency between `result` and the reads. That would change performance depending on where the first unequal byte occurs. This change removes that optimization.
(This is change GH-1 from https://bugs.python.org/issue40791 .)
(cherry picked from commit 31729366e2)
Co-authored-by: Devin Jeanpierre <jeanpierreda@google.com>
Inspect.getdoc(ob) sometimes gets docstrings when ob.__doc__ is None.
(cherry picked from commit 7ddbaa7a1b)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Fix a race condition in "make regen-all" when make -jN option is used
to run jobs in parallel. The clinic.py script now only use atomic
write to write files. Moveover, generated files are now left
unchanged if the content does not change, to not change the file
modification time.
The "make regen-all" command runs "make clinic" and "make
regen-importlib" targets:
* "make regen-importlib" builds object files (ex: Modules/_weakref.o)
from source files (ex: Modules/_weakref.c) and clinic files (ex:
Modules/clinic/_weakref.c.h)
* "make clinic" always rewrites all clinic files
(ex: Modules/clinic/_weakref.c.h)
Since there is no dependency between "clinic" and "regen-importlib"
Makefile targets, these two targets can be run in parallel. Moreover,
half of clinic.py file writes are not atomic and so there is a race
condition when "make regen-all" runs jobs in parallel using make -jN
option (which can be passed in MAKEFLAGS environment variable).
Fix clinic.py to make all file writes atomic:
* Add write_file() function to ensure that all file writes are
atomic: write into a temporary file and then use os.replace().
* Moreover, write_file() doesn't recreate or modify the file if the
content does not change to avoid modifying the file modification
file.
* Update test_clinic to verify these assertions with a functional
test.
* Remove Clinic.force attribute which was no longer used, whereas
Clinic.verify remains useful.
(cherry picked from commit 8fba9523cf)
(cherry picked from commit c53c3f4000)
Co-authored-by: Victor Stinner <vstinner@python.org>
skip test_min_max_version_mismatch when TLS 1.0 is not available
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit ce04e7105b)
Co-authored-by: Christian Heimes <christian@python.org>
bpo-41686, bpo-41713: On Windows, the SIGINT event,
_PyOS_SigintEvent(), is now created even if Python is configured to
not install signal handlers (PyConfig.install_signal_handlers=0 or
Py_InitializeEx(0)).
(cherry picked from commit 05a5d697f4)