aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test
Commit message (Collapse)AuthorAge
...
* Remove wrong comment about `repr` in `test_unicode` (#100495)Nikita Sobolev2022-12-24
|
* GH-91166: Implement zero copy writes for `SelectorSocketTransport` in ↵Kumar Aditya2022-12-24
| | | | | asyncio (#31871) Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
* gh-100268: Add is_integer method to int (#100439)Shantanu2022-12-23
| | | This improves the lives of type annotation users of `float` - which type checkers implicitly treat as `int|float` because that is what most code actually wants. Before this change a `.is_integer()` method could not be assumed to exist on things annotated as `: float` due to the method not existing on both types.
* gh-94808: improve test coverage of number formatting (#99472)Nikita Sobolev2022-12-23
|
* gh-99947: Ensure unreported errors are chained for SystemError during import ↵Sebastian Berg2022-12-23
| | | | (GH-99946)
* gh-68320, gh-88302 - Allow for private `pathlib.Path` subclassing (GH-31691)Barney Gale2022-12-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Users may wish to define subclasses of `pathlib.Path` to add or modify existing methods. Before this change, attempting to instantiate a subclass raised an exception like: AttributeError: type object 'PPath' has no attribute '_flavour' Previously the `_flavour` attribute was assigned as follows: PurePath._flavour = xxx not set!! xxx PurePosixPath._flavour = _PosixFlavour() PureWindowsPath._flavour = _WindowsFlavour() This change replaces it with a `_pathmod` attribute, set as follows: PurePath._pathmod = os.path PurePosixPath._pathmod = posixpath PureWindowsPath._pathmod = ntpath Functionality from `_PosixFlavour` and `_WindowsFlavour` is moved into `PurePath` as underscored-prefixed classmethods. Flavours are removed. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Eryk Sun <eryksun@gmail.com>
* GH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426)Raymond Hettinger2022-12-23
|
* bpo-40447: accept all path-like objects in compileall.compile_file (#19883)Filipe Laíns2022-12-23
| | | | | | Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Filipe Laíns <lains@riseup.net> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)Nikita Sobolev2022-12-23
|
* gh-83076: 3.8x speed improvement in (Async)Mock instantiation (#100252)Carl Meyer2022-12-23
|
* gh-94155: Reduce hash collisions for code objects (#100183)Dennis Sweeney2022-12-23
| | | | | | | * Uses a better hashing algorithm to get better dispersion and remove commutativity. * Incorporates `co_firstlineno`, `Py_SIZE(co)`, and bytecode instructions. * This is now the entire set of criteria used in `code_richcompare`, except for `_PyCode_ConstantKey` (which would incorporate the types of `co_consts` rather than just their values).
* gh-99110: Initialize `frame->previous` in init_frame to fix segmentation ↵Bill Fisher2022-12-23
| | | | fault when accessing `frame.f_back` (#100182)
* gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576)Eric Wieser2022-12-23
| | | | The itemsize returned in a memoryview of a ctypes array is now computed from the item type, instead of dividing the total size by the length and assuming that the length is not zero.
* gh-85432: Harmonise parameter names between C and pure-Python ↵Alex Waygood2022-12-22
| | | | implementations of `datetime.time.strftime`, `datetime.datetime.fromtimestamp` (#99993)
* gh-100344: Add C implementation for `asyncio.current_task` (#100345)Itamar Ostricher2022-12-22
| | | Co-authored-by: pranavtbhat
* gh-78997: fix bad rebase of moved test file (#100424)Eli Schwartz2022-12-22
|
* gh-78878: Fix crash when creating an instance of `_ctypes.CField` (#14837)Hai Shi2022-12-21
|
* gh-100129: Add tests for pickling all builtin types and functions (GH-100142)Serhiy Storchaka2022-12-21
|
* gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)Dominic Socular2022-12-21
|
* GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output ↵Kumar Aditya2022-12-21
| | | | (#100154)
* gh-85267: Improvements to inspect.signature __text_signature__ handling (#98796)Shantanu2022-12-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes a couple related changes to inspect.signature's behaviour when parsing a signature from `__text_signature__`. First, `inspect.signature` is documented as only raising ValueError or TypeError. However, in some cases, we could raise RuntimeError. This PR changes that, thereby fixing #83685. (Note that the new ValueErrors in RewriteSymbolics are caught and then reraised with a message) Second, `inspect.signature` could randomly drop parameters that it didn't understand (corresponding to `return None` in the `p` function). This is the core issue in #85267. I think this is very surprising behaviour and it seems better to fail outright. Third, adding this new failure broke a couple tests. To fix them (and to e.g. allow `inspect.signature(select.epoll.register)` as in #85267), I add constant folding of a couple binary operations to RewriteSymbolics. (There's some discussion of making signature expression evaluation arbitrary powerful in #68155. I think that's out of scope. The additional constant folding here is pretty straightforward, useful, and not much of a slippery slope) Fourth, while #85267 is incorrect about the cause of the issue, it turns out if you had consecutive newlines in __text_signature__, you'd get `tokenize.TokenError`. Finally, the `if name is invalid:` code path was dead, since `parse_name` never returned `invalid`.
* gh-99576: Fix cookiejar file that was not truncated for some classes (GH-99616)Nikita Sobolev2022-12-20
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-99925: Fix inconsistency in `json.dumps()` error messages (GH-99926)František Nesveda2022-12-20
|
* gh-89051: Add ssl.OP_LEGACY_SERVER_CONNECT (#93927)Thomas Grainger2022-12-20
| | | | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Fixes https://github.com/python/cpython/issues/89051
* gh-89727: Fix os.walk RecursionError on deep trees (#99803)Jon Burdo2022-12-19
| | | | | Use a stack to implement os.walk iteratively instead of recursively to avoid hitting recursion limits on deeply nested trees.
* gh-94912: Added marker for non-standard coroutine function detection (#99247)Carlton Gibson2022-12-18
| | | | | This introduces a new decorator `@inspect.markcoroutinefunction`, which, applied to a sync function, makes it appear async to `inspect.iscoroutinefunction()`.
* gh-100272: Fix JSON serialization of OrderedDict (GH-100273)Serhiy Storchaka2022-12-17
| | | | It now preserves the order of keys.
* gh-93649: Split tracemalloc tests from _testcapimodule.c (#99551)Erlend E. Aasland2022-12-17
|
* gh-99240: Reset pointer to NULL when the pointed memory is freed in argument ↵colorfulappl2022-12-17
| | | | | | parsing (#99890) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-78707: deprecate passing >1 argument to `PurePath.[is_]relative_to()` ↵Barney Gale2022-12-16
| | | | | | | (GH-94469) This brings `relative_to()` and `is_relative_to()` more in line with other pathlib methods like `rename()` and `symlink_to()`. Resolves #78707.
* gh-100039: enhance __signature__ to work with str and callables (GH-100168)Ethan Furman2022-12-16
| | | | | Callables should be either class- or static-methods. Enum now uses the classmethod version to greatly improve the help given for enums and flags.
* GH-100234: Set a default value for random.expovariate() (GH-100235)Raymond Hettinger2022-12-15
|
* gh-99688: Fix outdated tests in test_unary (#99712)Yesung(Isaac) Lee2022-12-11
| | | | * Remove duplicates from "L" suffix removal * test_invert now tests `~`.
* gh-88500: Reduce memory use of `urllib.unquote` (#96763)Gregory P. Smith2022-12-10
| | | | | | | | | | | `urllib.unquote_to_bytes` and `urllib.unquote` could both potentially generate `O(len(string))` intermediate `bytes` or `str` objects while computing the unquoted final result depending on the input provided. As Python objects are relatively large, this could consume a lot of ram. This switches the implementation to using an expanding `bytearray` and a generator internally instead of precomputed `split()` style operations. Microbenchmarks with some antagonistic inputs like `mess = "\u0141%%%20a%fe"*1000` show this is 10-20% slower for unquote and unquote_to_bytes and no different for typical inputs that are short or lack much unicode or % escaping. But the functions are already quite fast anyways so not a big deal. The slowdown scales consistently linear with input size as expected. Memory usage observed manually using `/usr/bin/time -v` on `python -m timeit` runs of larger inputs. Unittesting memory consumption is difficult and does not seem worthwhile. Observed memory usage is ~1/2 for `unquote()` and <1/3 for `unquote_to_bytes()` using `python -m timeit -s 'from urllib.parse import unquote, unquote_to_bytes; v="\u0141%01\u0161%20"*500_000' 'unquote_to_bytes(v)'` as a test.
* gh-99941: Ensure that asyncio.Protocol.data_received receives immutable ↵DarioDaF2022-12-10
| | | | bytes (#100053)
* Fix potential flakiness in `test_run_until_complete_baseexception` (#100148)Fantix King2022-12-10
|
* bpo-44512: Fix handling of extrasactions arg to csv.DictWriter with mixed or ↵andrei kulakov2022-12-09
| | | | upper case (#26924)
* bpo-43984: Allow winreg.SetValueEx to set -1 without treating it as an error ↵Shreyan Avigyan2022-12-09
| | | | (GH-25775)
* GH-100113: remove remaining `yield from` usage from `asyncio` tests (#100114)Kumar Aditya2022-12-09
|
* gh-81057: Move OS-Related Globals to _PyRuntimeState (gh-100082)Eric Snow2022-12-08
| | | https://github.com/python/cpython/issues/81057
* GH-98363: Have batched() return tuples (GH-100118)Raymond Hettinger2022-12-08
|
* test_ast uses infinite_recursion() to prevent crash (#100104)Victor Stinner2022-12-08
| | | | | | | test.test_ast_recursion_limit() now uses infinite_recursion() of test.support to prevent crashes on debug builds. Before this change, the test crashed on ARM64 Windows 3.x buildbot worker which builds Python in debug mode.
* Fix `test_run_until_complete_baseexception` test to check for ↵Fantix King2022-12-08
| | | | `KeyboardInterrupt` in asyncio (#24477)
* gh-100098: [Enum] insist on actual tuples, no subclasses, for auto (GH-100099)Ethan Furman2022-12-07
| | | | | | When checking for auto() instances, only top-level usage is supported, which means either alone or as part of a regular tuple. Other containers, such as lists, dicts, or namedtuples, will not have auto() transformed into a value.
* gh-98778: Update HTTPError to initialize properly even if fp is None (gh-99966)Dong-hee Na2022-12-08
|
* gh-100086: Add build info to test.libregrtest (#100093)Victor Stinner2022-12-08
| | | | The Python test runner (libregrtest) now logs Python build information like "debug" vs "release" build, or LTO and PGO optimizations.
* gh-100077: make test_code.test_invalid_bytecode more robust and maintainable ↵Irit Katriel2022-12-07
| | | | (#100078)
* gh-83035: handle decorator with nested parens in inspect.getsource (#99654)Carl Meyer2022-12-07
|
* gh-93018: Fix for the compatibility problems with expat (gh-93900)Matěj Cepl2022-12-07
|
* [Enum] Remove unused code from `test_enum.py` (GH-96986)Nikita Sobolev2022-12-06
|