summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* bpo-39702: Relax grammar restrictions on decorators (PEP 614) (GH-18570)Brandt Bucher2020-03-033-15/+89
|
* bpo-35712: Make using NotImplemented in a boolean context issue a ↵MojoVampire2020-03-033-4/+18
| | | | deprecation warning (GH-13195)
* bpo-12915: Skip test_pkgutil.test_name_resolution() non-encodable filenames ↵Michael Felt2020-03-031-1/+5
| | | | | | (GH-18720) When filesystem encoding cannot encode the Unicode string used for a filename continue testing with the next example.
* bpo-38091: Import deadlock detection causes deadlock (GH-17518)Armin Rigo2020-03-031-0/+8
| | | Automerge-Triggered-By: @brettcannon
* bpo-39778: Don't traverse weak-reference lists OrderedDict's tp_traverse and ↵Pablo Galindo2020-03-021-0/+20
| | | | | | tp_clear (GH-18749) Objects do not own weak references to them directly through the __weakref__ list so these do not need to be traversed by the GC.
* bpo-38870: Add docstring support to ast.unparse (GH-17760)Batuhan Taşkaya2020-03-021-70/+126
| | | | | | Allow ast.unparse to detect docstrings in functions, modules and classes and produce nicely formatted unparsed output for said docstrings. Co-Authored-By: Pablo Galindo <Pablogsal@gmail.com>
* bpo-39764: Make Task.get_stack accept ag_frame (#18669)Lidi Zheng2020-03-021-0/+15
| | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-38971: Open file in codecs.open() closes if exception raised. (GH-17666)Chris A2020-03-021-0/+9
| | | | | | Open issue in the BPO indicated a desire to make the implementation of codecs.open() at parity with io.open(), which implements a try/except to assure file stream gets closed before an exception is raised.
* bpo-39495: Remove default value from C impl of TreeBuilder.start (GH-18275)Shantanu2020-03-021-0/+4
|
* bpo-39678: refactor queue manager thread (GH-18551)Thomas Moreau2020-03-011-8/+8
|
* bpo-38870: Implement a precedence algorithm in ast.unparse (GH-17377)Batuhan Taşkaya2020-03-012-1/+49
| | | | Implement a simple precedence algorithm for ast.unparse in order to avoid redundant parenthesis for nested structures in the final output.
* bpo-39520: Fix un-parsing of ext slices with no dimensions (GH-18304)Batuhan Taşkaya2020-03-011-0/+5
|
* bpo-39794: Add --without-decimal-contextvar (#18702)Stefan Krah2020-02-291-0/+1
|
* bpo-39667: Sync zipp 3.0 (GH-18540)Jason R. Coombs2020-02-291-1/+7
| | | | | | | | | | | | | | * bpo-39667: Improve pathlib.Path compatibility on zipfile.Path and correct performance degradation as found in zipp 3.0 * 📜🤖 Added by blurb_it. * Update docs for new zipfile.Path.open * Rely on dict, faster than OrderedDict. * Syntax edits on docs Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-37534: Allow adding Standalone Document Declaration when generating XML ↵Henry Harutyunyan2020-02-291-0/+16
| | | | documents (GH-14912)
* bpo-39769: Fix compileall ddir for subpkgs. (GH-18676)Gregory P. Smith2020-02-292-0/+52
| | | | | | | | | | Fix compileall.compile_dir() ddir= behavior on sub-packages. Fixes compileall.compile_dir's ddir parameter and compileall command line flag `-d` to no longer write the wrong pathname to the generated pyc file for submodules beneath the root of the directory tree being compiled. This fixes a regression introduced with Python 3.5. Also marks the _new_ in 3.9 from PR #16012 parameters to compile_dir as keyword only (as that is the only way they will be used) and fixes an omission of them in one place from the docs.
* bpo-12915: Improve Unicode support for package names and attributes. (GH-18517)Vinay Sajip2020-02-281-0/+32
|
* Suppress the hang (#18457)Andrew Svetlov2020-02-261-2/+9
|
* bpo-34788: Add support for scoped IPv6 addresses (GH-13772)opavlyuk2020-02-261-23/+444
| | | Automerge-Triggered-By: @asvetlov
* bpo-36144: Dictionary Union (PEP 584) (#12088)Brandt Bucher2020-02-251-0/+32
|
* bpo-30566: Fix IndexError when using punycode codec (GH-18632)Berker Peksag2020-02-251-0/+12
| | | | Trying to decode an invalid string with the punycode codec shoud raise UnicodeError.
* Give proper credit for figuring out and writing PEP-3118 tests. (#18644)Stefan Krah2020-02-241-0/+2
|
* bpo-39681: Fix C pickle regression with minimal file-like objects (#18592)Antoine Pitrou2020-02-231-4/+21
| | | | Fix a regression where the C pickle module wouldn't allow unpickling from a file-like object that doesn't expose a readinto() method.
* bpo-39648: Expand math.gcd() and math.lcm() to handle multiple arguments. ↵Serhiy Storchaka2020-02-231-25/+33
| | | | | | | | | | | | | | | | (GH-18604) * bpo-39648: Expand math.gcd() and math.lcm() to handle multiple arguments. * Simplify fast path. * Difine lcm() without arguments returning 1. * Apply suggestions from code review Co-Authored-By: Mark Dickinson <dickinsm@gmail.com> Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
* bpo-39382: Avoid dangling object use in abstract_issubclass() (GH-18530)Yonatan Goldschmidt2020-02-221-0/+21
| | | | | Hold reference of __bases__ tuple until tuple item is done with, because by dropping the reference the item may be destroyed.
* bpo-35950: Raise UnsupportedOperation in BufferedReader.truncate() (GH-18586)Berker Peksag2020-02-211-0/+11
| | | | | | | | | | | | | | | The truncate() method of io.BufferedReader() should raise UnsupportedOperation when it is called on a read-only io.BufferedReader() instance. https://bugs.python.org/issue35950 Automerge-Triggered-By: @methane
* bpo-35727: Use exit code 0 on sys.exit() in multiprocessing.Process. (GH-11538)Christopher Hunt2020-02-211-6/+15
|
* bpo-9495: avoid confusing chained exception in argparse test (GH-17120)alclarks2020-02-211-1/+2
|
* bpo-39576: Prevent memory error for overly optimistic precisions (GH-18581)Stefan Krah2020-02-211-0/+35
|
* bpo-39479:Add math.lcm() function: Least Common Multiple (#18547)ananthan-1232020-02-191-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update math.rst * Update math.rst * updated whats new * Update test_math.py * Update mathmodule.c * Update mathmodule.c.h * Update ACKS * 📜🤖 Added by blurb_it. * Update 3.9.rst * Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst * Update math.rst * Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst * Update test_math.py * Update ACKS * Update mathmodule.c.h * Update mathmodule.c * Update mathmodule.c.h * Update mathmodule.c.h Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-39546: argparse: Honor allow_abbrev=False for specified prefix_chars ↵Kyle Meyer2020-02-181-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | (GH-18337) When `allow_abbrev` was first added, disabling the abbreviation of long options broke the grouping of short flags ([bpo-26967](https://bugs.python.org/issue26967)). As a fix, b1e4d1b603 (contained in v3.8) ignores `allow_abbrev=False` for a given argument string if the string does _not_ start with "--" (i.e. it doesn't look like a long option). This fix, however, doesn't take into account that long options can start with alternative characters specified via `prefix_chars`, introducing a regression: `allow_abbrev=False` has no effect on long options that start with an alternative prefix character. The most minimal fix would be to replace the "starts with --" check with a "starts with two prefix_chars characters". But `_get_option_tuples` already distinguishes between long and short options, so let's instead piggyback off of that check by moving the `allow_abbrev` condition into `_get_option_tuples`. https://bugs.python.org/issue39546
* bpo-39104: Fix hanging ProcessPoolExecutor on shutdown nowait with pickling ↵Thomas Moreau2020-02-161-2/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | failure (GH-17670) As reported initially by @rad-pat in #6084, the following script causes a deadlock. ``` from concurrent.futures import ProcessPoolExecutor class ObjectWithPickleError(): """Triggers a RuntimeError when sending job to the workers""" def __reduce__(self): raise RuntimeError() if __name__ == "__main__": e = ProcessPoolExecutor() f = e.submit(id, ObjectWithPickleError()) e.shutdown(wait=False) f.result() # Deadlock on get ``` This is caused by the fact that the main process is closing communication channels that might be necessary to the `queue_management_thread` later. To avoid this, this PR let the `queue_management_thread` manage all the closing. https://bugs.python.org/issue39104 Automerge-Triggered-By: @pitrou
* bpo-12915: Add pkgutil.resolve_name (GH-18310)Vinay Sajip2020-02-141-0/+55
|
* bpo-39627: Fix TypedDict totality check for inherited keys (#18503)Vlad Emelianov2020-02-131-0/+32
| | | (Adapted from https://github.com/python/typing/pull/700)
* bpo-39606: allow closing async generators that are already closed (GH-18475)Nathaniel J. Smith2020-02-131-2/+28
| | | | | | | | | | | | | | The fix for [bpo-39386](https://bugs.python.org/issue39386) attempted to make it so you couldn't reuse a agen.aclose() coroutine object. It accidentally also prevented you from calling aclose() at all on an async generator that was already closed or exhausted. This commit fixes it so we're only blocking the actually illegal cases, while allowing the legal cases. The new tests failed before this patch. Also confirmed that this fixes the test failures we were seeing in Trio with Python dev builds: https://github.com/python-trio/trio/pull/1396 https://bugs.python.org/issue39606
* bpo-39474: Fix AST pos for expressions like (a)(b), (a)[b] and (a).b. (GH-18477)Serhiy Storchaka2020-02-121-0/+27
|
* bpo-18819: tarfile: only set device fields for device files (GH-18080)William Chargin2020-02-121-0/+46
| | | | | | The GNU docs describe the `devmajor` and `devminor` fields of the tar header struct only in the context of character and block special files, suggesting that in other cases they are not populated. Typical utilities behave accordingly; this patch teaches `tarfile` to do the same.
* bpo-32856: Optimize the assignment idiom in comprehensions. (GH-16814)Serhiy Storchaka2020-02-125-0/+79
| | | | | Now `for y in [expr]` in comprehensions is as fast as a simple assignment `y = expr`.
* bpo-39219: Fix SyntaxError attributes in the tokenizer. (GH-17828)Serhiy Storchaka2020-02-121-1/+13
| | | | * Always set the text attribute. * Correct the offset attribute for non-ascii sources.
* bpo-39595: Improve zipfile.Path performance (#18406)Jason R. Coombs2020-02-124-41/+166
| | | | | | | | | | | | | | | | | | * Improve zipfile.Path performance on zipfiles with a large number of entries. * 📜🤖 Added by blurb_it. * Add bpo to blurb * Sync with importlib_metadata 1.5 (6fe70ca) * Update blurb. * Remove compatibility code * Add stubs module, omitted from earlier commit Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of this patch was generated automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done old=_PyObject_FastCallDict new=PyObject_VectorcallDict git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g" and then cleaned up: - Revert changes to in docs & news - Revert changes to backcompat defines in headers - Nudge misaligned comments
* bpo-38325: Skip non-BMP tests of test_winconsoleio (GH-18448)Victor Stinner2020-02-101-0/+6
| | | Skip tests on non-BMP characters of test_winconsoleio.
* bpo-39590: make deque.__contains__ and deque.count hold strong references ↵sweeneyde2020-02-091-0/+12
| | | | (GH-18421)
* bpo-39579: Fix Attribute end_col_offset to point at the current node (GH-18405)Lysandros Nikolaou2020-02-071-0/+8
|
* bpo-39350: Fix fractions for int subclasses (GH-18375)Victor Stinner2020-02-071-0/+22
| | | | | | | Fix regression in fractions.Fraction if the numerator and/or the denominator is an int subclass. The math.gcd() function is now used to normalize the numerator and denominator. math.gcd() always return a int type. Previously, the GCD type depended on numerator and denominator.
* bpo-39274: Ensure Fraction.__bool__() returns a bool (GH-18017)Sebastian Berg2020-02-061-0/+37
| | | | | Some numerator types used (specifically NumPy) decides to not return a Python boolean for the "a != b" operation. Using the equivalent call to bool() guarantees a bool return also for such types.
* bpo-39488: Skip test_largefile tests if not enough disk space (GH-18261)Giampaolo Rodola2020-02-051-0/+18
|
* bpo-39491: Merge PEP 593 (typing.Annotated) support (#18260)Jakub Stasiak2020-02-051-0/+234
| | | | | | | | | | | | | | | | | | | | | | | | | * bpo-39491: Merge PEP 593 (typing.Annotated) support PEP 593 has been accepted some time ago. I got a green light for merging this from Till, so I went ahead and combined the code contributed to typing_extensions[1] and the documentation from the PEP 593 text[2]. My changes were limited to: * removing code designed for typing_extensions to run on older Python versions * removing some irrelevant parts of the PEP text when copying it over as documentation and otherwise changing few small bits to better serve the purpose * changing the get_type_hints signature to match reality (parameter names) I wasn't entirely sure how to go about crediting the authors but I used my best judgment, let me know if something needs changing in this regard. [1] https://github.com/python/typing/blob/8280de241fd8c8afe727c7860254b753e383b360/typing_extensions/src_py3/typing_extensions.py [2] https://github.com/python/peps/blob/17710b879882454d55f82c2d44596e8e9f8e4bff/pep-0593.rst
* closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH-18295)Philipp Gesang2020-02-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | When called on a closed object, readinto() segfaults on account of a write to a freed buffer: ==220553== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==220553== Access not within mapped region at address 0x2A ==220553== at 0x48408A0: memmove (vg_replace_strmem.c:1272) ==220553== by 0x58DB0C: _buffered_readinto_generic (bufferedio.c:972) ==220553== by 0x58DCBA: _io__Buffered_readinto_impl (bufferedio.c:1053) ==220553== by 0x58DCBA: _io__Buffered_readinto (bufferedio.c.h:253) Reproducer: reader = open ("/dev/zero", "rb") _void = reader.read (42) reader.close () reader.readinto (bytearray (42)) ### BANG! The problem exists since 2012 when commit dc469454ec added code to free the read buffer on close(). Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
* bpo-38076 Clear the interpreter state only after clearing module globals ↵Eddie Elizondo2020-02-043-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-18039) Currently, during runtime destruction, `_PyImport_Cleanup` is clearing the interpreter state before clearing out the modules themselves. This leads to a segfault on modules that rely on the module state to clear themselves up. For example, let's take the small snippet added in the issue by @DinoV : ``` import _struct class C: def __init__(self): self.pack = _struct.pack def __del__(self): self.pack('I', -42) _struct.x = C() ``` The module `_struct` uses the module state to run `pack`. Therefore, the module state has to be alive until after the module has been cleared out to successfully run `C.__del__`. This happens at line 606, when `_PyImport_Cleanup` calls `_PyModule_Clear`. In fact, the loop that calls `_PyModule_Clear` has in its comments: > Now, if there are any modules left alive, clear their globals to minimize potential leaks. All C extension modules actually end up here, since they are kept alive in the interpreter state. That means that we can't clear the module state (which is used by C Extensions) before we run that loop. Moving `_PyInterpreterState_ClearModules` until after it, fixes the segfault in the code snippet. Finally, this updates a test in `io` to correctly assert the error that it now throws (since it now finds the io module state). The test that uses this is: `test_create_at_shutdown_without_encoding`. Given this test is now working is a proof that the module state now stays alive even when `__del__` is called at module destruction time. Thus, I didn't add a new tests for this. https://bugs.python.org/issue38076