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>
restart_subprocess is a method of self, the pyshell.InteractiveInterpreter instance. The latter does not have an interp attribute redundantly referring to itself. (The PyShell instance does have an interp attribute, referring to the InteractiveInterpreter instance.)
(cherry picked from commit e41bfd15dd)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Instead of using wait_visibility() which waits event <VisibilityNotify> in dead loop
use update() which should proceed all queued events.
(cherry picked from commit 6cc2c419f6)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* 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>
* Improve description of 'e', 'f' and 'g' presentation types
* Drop the 'E' from Scientific 'E' notation; remove >= 0 qualifications
* Fix false statement that the alternate form is valid for Decimal
* Nitpick: remove the Harvard/Oxford comma
* Add note that the decimal point is also removed if no digits follow it, except in alternate form
(cherry picked from commit c642374b3e)
Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
See https: //github.com/python/core-workflow/issues/380
Signed-off-by: Filipe Laíns <lains@archlinux.org>
(cherry picked from commit d20b7ed9c1)
Co-authored-by: Filipe Laíns <lains@archlinux.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>
Removing 'evaluate' makes it more consistent with other assertX entries.
(cherry picked from commit bd8c22e1fa)
Co-authored-by: Ram Rachum <ram@rachum.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>
I believe this is a mistake. SIGCHLD is only available on Unix systems, not Windows.
(cherry picked from commit 4c24b08cd3)
Co-authored-by: Zhang Maiyun <myzhang1029@hotmail.com>
Co-authored-by: Zhang Maiyun <myzhang1029@hotmail.com>
* There were leaks if Py_tp_bases is used more than once or if some call is
failed before setting tp_bases.
* There was a crash if the bases argument or the Py_tp_bases slot is not a tuple.
* The documentation was not accurate.
(cherry picked from commit 1db76394ea)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.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>