summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40692: Run more test_concurrent_futures tests (GH-20239)Asheesh Laroia2021-02-082-5/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of multiprocessing.synchronize() being missing, the test_concurrent_futures test suite now skips only the tests that require multiprocessing.synchronize(). Validate that multiprocessing.synchronize exists as part of _check_system_limits(), allowing ProcessPoolExecutor to raise NotImplementedError during __init__, rather than crashing with ImportError during __init__ when creating a lock imported from multiprocessing.synchronize. Use _check_system_limits() to disable tests of ProcessPoolExecutor on systems without multiprocessing.synchronize. Running the test suite without multiprocessing.synchronize reveals that Lib/compileall.py crashes when it uses a ProcessPoolExecutor. Therefore, change Lib/compileall.py to call _check_system_limits() before creating the ProcessPoolExecutor. Note that both Lib/compileall.py and Lib/test/test_compileall.py were attempting to sanity-check ProcessPoolExecutor by expecting ImportError. In multiprocessing.resource_tracker, sem_unlink() is also absent on platforms where POSIX semaphores aren't available. Avoid using sem_unlink() if it, too, does not exist. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-43149: Improve error message for exception group without parentheses ↵Pablo Galindo2021-02-071-0/+33
| | | | (GH-24467)
* bpo-43102: Set namedtuple __new__'s internal builtins to a dict. (GH-24439)Raymond Hettinger2021-02-041-0/+5
|
* bpo-43121: Fix incorrect SyntaxError message for missing comma (GH-24436)Pablo Galindo2021-02-031-2/+18
|
* bpo-41149: Fix a bug in threading that causes fals-y threads callables to ↵BarneyStratford2021-02-021-0/+20
| | | | fail to start. (GH-21201)
* bpo-42997: Improve error message for missing : before suites (GH-24292)Pablo Galindo2021-02-021-3/+104
| | | | | | | | * Add to the peg generator a new directive ('&&') that allows to expect a token and hard fail the parsing if the token is not found. This allows to quickly emmit syntax errors for missing tokens. * Use the new grammar element to hard-fail if the ':' is missing before suites.
* Only eliminate jumps to successor block if jump is unconditional. (GH-24417)Mark Shannon2021-02-021-0/+16
| | | | * Prevents elimination of the sole test of a value in statements like: if x or True: ...
* bpo-41748: Handles unquoted attributes with commas (#24072)Karl Dubost2021-02-011-36/+56
| | | | | | | | | | | | | | | | | | * bpo-41748: Adds tests for unquoted attributes with comma * bpo-41748: Handles unquoted attributes with comma * bpo-41748: Addresses review comments * bpo-41748: Addresses review comments * Adds more test cases * Simplifies the regex for handling spaces * bpo-41748: Moves attributes tests under the right class * bpo-41748: Addresses review about duplicate attributes * bpo-41748: Adds NEWS.d entry for this patch
* bpo-38307: Add end_lineno attribute to pyclbr Objects (GH-24348)Aviral Srivastava2021-02-011-11/+11
| | | | | | | | For back-compatibility, make the new constructor parameter for public classes Function and Class keyword-only with a default of None. Co-authored-by: Aviral Srivastava <aviralsrivastava@Avirals-MacBook-Air.local Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-42504: Ensure that get_config_var('MACOSX_DEPLOYMENT_TARGET') is a ↵Ronald Oussoren2021-02-011-1/+1
| | | | | string (GH-24341) * bpo-42504: Ensure that get_config_var('MACOSX_DEPLOYMENT_TARGET') is a string
* bpo-43017: Improve error message for unparenthesised tuples in ↵Pablo Galindo2021-01-312-1/+17
| | | | comprehensions (GH24314)
* bpo-42986: Fix parser crash when reporting syntax errors in f-string with ↵Pablo Galindo2021-01-311-0/+3
| | | | newlines (GH-24279)
* bpo-43016: Fix test_curses on platform without cursesw (GH-24405)Serhiy Storchaka2021-01-311-5/+23
|
* bpo-43016: Rewrite tests for curses (GH-24312)Serhiy Storchaka2021-01-311-215/+787
|
* bpo-42990: Introduce 'frame constructor' struct to simplify API for ↵Mark Shannon2021-01-291-1/+1
| | | | | | | PyEval_CodeEval and friends (GH-24298) * Introduce 'frame constructor' to simplify API for frame creation * Embed struct using a macro to conform to PEP 7
* bpo-42979: Enhance abstract.c assertions checking slot result (GH-24352)Victor Stinner2021-01-271-32/+65
| | | | | | | | * bpo-42979: Enhance abstract.c assertions checking slot result Add _Py_CheckSlotResult() function which fails with a fatal error if a slot function succeeded with an exception set or failed with no exception set: write the slot name, the type name and the current exception (if an exception is set).
* bpo-38250: [Enum] only include .rst test if file available (GH-24342)Ethan Furman2021-01-261-4/+6
| | | | | | | * [Enum] only include .rst test if file available In order to ensure the ReST documentation is up to date for Enum, use doctest to check it -- but only if the .rst files have not been stripped.
* bpo-38250: [Enum] single-bit flags are canonical (GH-24215)Ethan Furman2021-01-252-72/+252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Flag members are now divided by one-bit verses multi-bit, with multi-bit being treated as aliases. Iterating over a flag only returns the contained single-bit flags. Iterating, repr(), and str() show members in definition order. When constructing combined-member flags, any extra integer values are either discarded (CONFORM), turned into ints (EJECT) or treated as errors (STRICT). Flag classes can specify which of those three behaviors is desired: >>> class Test(Flag, boundary=CONFORM): ... ONE = 1 ... TWO = 2 ... >>> Test(5) <Test.ONE: 1> Besides the three above behaviors, there is also KEEP, which should not be used unless necessary -- for example, _convert_ specifies KEEP as there are flag sets in the stdlib that are incomplete and/or inconsistent (e.g. ssl.Options). KEEP will, as the name suggests, keep all bits; however, iterating over a flag with extra bits will only return the canonical flags contained, not the extra bits. Iteration is now in member definition order. If member definition order matches increasing value order, then a more efficient method of flag decomposition is used; otherwise, sort() is called on the results of that method to get definition order. ``re`` module: repr() has been modified to support as closely as possible its previous output; the big difference is that inverted flags cannot be output as before because the inversion operation now always returns the comparable positive result; i.e. re.A|re.I|re.M|re.S is ~(re.L|re.U|re.S|re.T|re.DEBUG) in both of the above terms, the ``value`` is 282. re's tests have been updated to reflect the modifications to repr().
* bpo-42955: Rename module_names to sys.stdlib_module_names (GH-24332)Victor Stinner2021-01-253-4/+4
| | | | * Rename _Py_module_names to _Py_stdlib_module_names. * Rename Python/module_names.h to Python/stdlib_module_names.h.
* bpo-42383: pdb: do not fail to restart the target if the current directory ↵Andrey Bienkowski2021-01-251-0/+23
| | | | | changed (#23412) This commit only adds tests and a news entry. The actual bug was fixed in the earlier commit.
* bpo-37319: Improve documentation, code and tests of randrange. (GH-19112)Serhiy Storchaka2021-01-251-3/+16
|
* bpo-42955: Add sys.modules_names (GH-24238)Victor Stinner2021-01-253-6/+24
| | | | Add sys.module_names, containing the list of the standard library module names.
* bpo-27772: Make preceding width with 0 valid in string format. (GH-11270)Serhiy Storchaka2021-01-251-0/+6
| | | | Previously it was an error with confusing error message.
* bpo-42384: pdb: correctly populate sys.path[0] (GH-23338)Andrey Bienkowski2021-01-221-0/+42
| | | Automerge-Triggered-By: GH:gvanrossum
* bpo-40176: Improve error messages for unclosed string literals (GH-19346)Batuhan Taskaya2021-01-203-14/+16
| | | Automerge-Triggered-By: GH:isidentical
* bpo-42856: Add --with-wheel-pkg-dir=PATH configure option (GH-24210)Victor Stinner2021-01-201-9/+60
| | | | | | | | | | | | | Add --with-wheel-pkg-dir=PATH option to the ./configure script. If specified, the ensurepip module looks for setuptools and pip wheel packages in this directory: if both are present, these wheel packages are used instead of ensurepip bundled wheel packages. Some Linux distribution packaging policies recommend against bundling dependencies. For example, Fedora installs wheel packages in the /usr/share/python-wheels/ directory and don't install the ensurepip._bundled package. ensurepip: Remove unused runpy import.
* bpo-42780: Fix set_inheritable() for O_PATH file descriptors on Linux (GH-24172)cptpcrd2021-01-201-0/+27
|
* bpo-42864: Improve error messages regarding unclosed parentheses (GH-24161)Pablo Galindo2021-01-194-4/+11
|
* bpo-42923: _Py_DumpExtensionModules() ignores stdlib ext (GH-24254)Victor Stinner2021-01-192-12/+21
|
* bpo-41818: Close file descriptors in test_openpty (#GH-24119)Petr Viktorin2021-01-191-10/+10
| | | | | | | | When stdin is a TTY, the test added in commit c13d89955d9a2942c6355d6839d7096323244136 is expected to fail. However, when it failed, it did not close its file descriptors. This is flagged by the refleak tests (but only when stdin is a TTY, which doesn't seem to be the case on CI).
* bpo-42923: Dump extension modules on fatal error (GH-24207)Victor Stinner2021-01-182-0/+29
| | | | | | | The Py_FatalError() function and the faulthandler module now dump the list of extension modules on a fatal error. Add _Py_DumpExtensionModules() and _PyModule_IsExtension() internal functions.
* bpo-42944 Fix Random.sample when counts is not None (GH-24235)jonanifranco2021-01-181-27/+27
|
* bpo-42923: Add Py_FatalError() test in test_capi (GH-24240)Victor Stinner2021-01-182-16/+23
| | | Move faulthandler._fatal_error() to _testcapi.fatal_error().
* Mark instructions at end of class scope as artificial. (GH-24222)Mark Shannon2021-01-151-0/+18
|
* bpo-42877: add the 'compact' param to TracebackException's __init__ (#24179)Irit Katriel2021-01-151-0/+40
| | | Use it to reduce the time and memory taken up by several of traceback's module-level functions.
* bpo-42827: Fix crash on SyntaxError in multiline expressions (GH-24140)Lysandros Nikolaou2021-01-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | When trying to extract the error line for the error message there are two distinct cases: 1. The input comes from a file, which means that we can extract the error line by using `PyErr_ProgramTextObject` and which we already do. 2. The input does not come from a file, at which point we need to get the source code from the tokenizer: * If the tokenizer's current line number is the same with the line of the error, we get the line from `tok->buf` and we're ready. * Else, we can extract the error line from the source code in the following two ways: * If the input comes from a string we have all the input in `tok->str` and we can extract the error line from it. * If the input comes from stdin, i.e. the interactive prompt, we do not have access to the previous line. That's why a new field `tok->stdin_content` is added which holds the whole input for the current (multiline) statement or expression. We can then extract the error line from `tok->stdin_content` like we do in the string case above. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-42924: Fix incorrect copy in bytearray_repeat (GH-24208)Tobias Holl2021-01-131-0/+10
| | | | Before, using the * operator to repeat a bytearray would copy data from the start of the internal buffer (ob_bytes) and not from the start of the actual data (ob_start).
* bpo-42908: Mark cleanup code at end of try-except and with artificial (#24202)Mark Shannon2021-01-132-1/+41
| | | | | | | | | * Mark bytecodes at end of try-except as artificial. * Make sure that the CFG is consistent throughout optimiization. * Extend line-number propagation logic so that implicit returns after 'try-except' or 'with' have the correct line numbers. * Update importlib
* bpo-42901: [Enum] move member creation to `__set_name__` (GH-24196)Ethan Furman2021-01-131-2/+13
| | | | | | | | | | | `type.__new__` calls `__set_name__` and `__init_subclass__`, which means that any work metaclasses do after calling `super().__new__()` will not be available to those two methods. In particular, `Enum` classes that want to make use of `__init_subclass__` will not see any members. Almost all customization is therefore moved to before the `type.__new__()` call, including changing all members to a proto member descriptor with a `__set_name__` that will do the final conversion of a member to be an instance of the `Enum` class.
* bpo-42848: remove recursion from TracebackException (GH-24158)Irit Katriel2021-01-121-0/+25
|
* bpo-42882: Add test_embed.test_unicode_id_init() (GH-24198)Victor Stinner2021-01-121-0/+6
| | | | Test that _PyUnicode_FromId() works when Python is initialized multiples times.
* bpo-42802: Remove distutils bdist_wininst command (GH-24043)Victor Stinner2021-01-081-1/+0
| | | | | | | | | | The distutils bdist_wininst command deprecated in Python 3.8 has been removed. The distutils bidst_wheel command is now recommended to distribute binary packages on Windows. * Remove Lib/distutils/command/bdist_wininst.py * Remove PC/bdist_wininst/ project * Remove Lib/distutils/command/wininst-*.exe programs * Remove all references to bdist_wininst
* bpo-42846: Convert CJK codec extensions to multiphase init (GH-24157)Victor Stinner2021-01-071-2/+24
| | | | | | | | | | | Convert the 6 CJK codec extension modules (_codecs_cn, _codecs_hk, _codecs_iso2022, _codecs_jp, _codecs_kr and _codecs_tw) to the multiphase initialization API (PEP 489). Remove getmultibytecodec() local cache: always import _multibytecodec. It should be uncommon to get a codec. For example, this function is only called once per CJK codec module. Fix a reference leak in register_maps() error path.
* bpo-42851: [Enum] remove brittle __init_subclass__ support (GH-24154)Ethan Furman2021-01-071-45/+0
| | | Solution to support calls to `__init_subclass__` with members defined is too brittle and breaks with certain mixins.
* bpo-42823: Fix frame lineno when frame.f_trace is set (GH-24099)Mark Shannon2021-01-051-0/+21
| | | | | | | | | * Add test for frame.f_lineno with/without tracing. * Make sure that frame.f_lineno is correct regardless of whether frame.f_trace is set. * Update importlib * Add NEWS
* bpo-42681: Fix test_curses failures related to color pairs (GH-24089)Serhiy Storchaka2021-01-051-12/+41
| | | | | | | On ncurses 6.1 pair numbers are limited by SHORT_MAX-1, even with extended color support. Improve error reporting and tests for color functions.
* bpo-40636: Remove overly-strict zip pickling tests (GH-24109)Brandt Bucher2021-01-051-42/+0
|
* bpo-42810: Mark jumps at end of if and try statements as artificial. (GH-24091)Mark Shannon2021-01-041-0/+42
| | | | | | | * Mark jumps at end of if and try statements as artificial. * Update importlib * Add comment explaining the purpose of ADDOP_JUMP_NOLINE.
* bpo-42789: Enable using /dev/tty in test_curses. (GH-24085)Serhiy Storchaka2021-01-041-1/+1
| | | It was temporary disabled for debugging.
* bpo-42681: Fix range checks for color and pair numbers in curses (GH-23874)Serhiy Storchaka2021-01-031-26/+107
|