Commit Graph

115623 Commits

Author SHA1 Message Date
Guy Yagev ad3c99e521
gh-92446: Improve argparse choices docs; revert bad change to lzma docs (#94627)
Based on the definition of the collections.abc classes, it is more accurate to use "sequence" instead of "container" when describing argparse choices.

A previous attempt at fixing this in #92450 was mistaken; this PR reverts that change.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-26 00:22:53 -06:00
Ilya Kulakov dbc1e696eb
gh-99308: Clarify re docs for byte pattern group names (#99311) 2022-12-25 12:25:27 +05:30
Glyph b9aa14a484
gh-100519: simplification to `eff_request_host` in cookiejar.py (#99588)
`IPV4_RE` includes a `.`, and the `.find(".") == -1` included here is already testing to make sure there's no dot, so this part of the expression is tautological. Instead use more modern `in` syntax to make it clear what the check is doing here. The simplified implementation more clearly matches the wording in RFC 2965.

Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
2022-12-24 18:14:51 -06:00
Shantanu 046cbc2080
gh-100472: Fix docs claim that compileall parameters could be bytes (#100473) 2022-12-24 14:22:49 -06:00
Bart Broere efccd04b9e
[Minor PR] Quotes in documentation changed into code blocks (#99536)
Minor formatting fix in documentation

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-24 12:17:39 -08:00
Shantanu 2e1a9ce989
gh-100428: Make float documentation more accurate (#100437)
Previously, the grammar did not accept `float("10")`.
Also implement mdickinson's suggestion of removing the indirection.
2022-12-24 14:09:31 -06:00
MonadChains f5b7b19bf1
gh-99535: Add test for inheritance of annotations and update documentation (#99990) 2022-12-24 12:07:14 -08:00
Shantanu e4b43ebb3a
gh-100287: Fix unittest.mock.seal with AsyncMock (#100496) 2022-12-24 19:39:39 +00:00
James Frost 46e6a28308
gh-100474: Fix handling of dirs named index.html in http.server (GH-100475)
If you had a directory called index.html or index.htm within a directory, it would cause http.server to return a 404 Not Found error instead of the directory listing. This came about due to not checking that the index was a regular file.

I have also added a test case for this situation.

Automerge-Triggered-By: GH:merwok
2022-12-24 10:28:59 -08:00
JosephSBoyle 00afa5066b
gh-99908: Tutorial: Modernize the 'data-record class' example (#100499)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-12-24 15:23:24 +00:00
Nikita Sobolev c6dac12861
Remove wrong comment about `repr` in `test_unicode` (#100495) 2022-12-24 06:48:43 -08:00
Nikita Sobolev bdfb694386
gh-100357: Convert several functions in `bltinsmodule` to AC (#100358) 2022-12-24 06:45:47 -08:00
Raymond Hettinger 0769f95751
Misc Itertools recipe tweaks (GH-100493) 2022-12-24 00:21:30 -08:00
Kumar Aditya 2eea9598e3
GH-91166: Implement zero copy writes for `SelectorSocketTransport` in asyncio (#31871)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2022-12-24 11:21:48 +05:30
Kumar Aditya c122390a55
GH-91166: Implement zero copy writes for `SelectorSocketTransport` in asyncio (#31871)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2022-12-24 11:21:11 +05:30
Stanley 0f6420640c
gh-77771: Add enterabs example in sched (#92716)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-23 23:21:52 -06:00
Shantanu 3e46f9fe05
gh-100268: Add is_integer method to int (#100439)
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.
2022-12-23 18:30:27 -08:00
Illia Volochii a23cb72ac8
gh-100454: Start running SSL tests with OpenSSL 3.1.0-beta1 (#100456) 2022-12-23 18:04:20 -08:00
Nikita Sobolev 7ca45e5ddd
gh-94808: improve test coverage of number formatting (#99472) 2022-12-23 18:03:31 -06:00
Raymond Hettinger f89de679ff
Add "strict" to dotproduct(). Add docstring. Factor-out common code. (GH-100480) 2022-12-23 15:52:16 -08:00
Sebastian Berg 474220e3a5
gh-99947: Ensure unreported errors are chained for SystemError during import (GH-99946) 2022-12-23 15:43:19 -08:00
Barney Gale a68e585c8b
gh-68320, gh-88302 - Allow for private `pathlib.Path` subclassing (GH-31691)
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>
2022-12-23 14:52:23 -08:00
Raymond Hettinger 5d84966cce
GH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426) 2022-12-23 14:35:58 -08:00
Filipe Laíns 1ecfd1ebf1
bpo-40447: accept all path-like objects in compileall.compile_file (#19883)
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>
2022-12-23 14:19:16 -06:00
Nikita Sobolev 745545b5bb
gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484) 2022-12-23 14:17:24 -06:00
Carl Meyer c5726b727e
gh-83076: 3.8x speed improvement in (Async)Mock instantiation (#100252) 2022-12-23 19:41:37 +00:00
Dennis Sweeney a98d9ea56e
gh-94155: Reduce hash collisions for code objects (#100183)
* 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).
2022-12-23 13:15:47 -05:00
Ken Jin 36d358348d
Revert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)" (#100468)
This reverts commit c3c7848a48.
2022-12-24 01:48:43 +08:00
Ken Jin c3c7848a48
gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289) 2022-12-24 00:26:42 +08:00
Pieter Eendebak 7fc7909677
gh-92216: improve performance of `hasattr` for type objects (GH-99979) 2022-12-23 23:23:36 +08:00
Petr Viktorin 49f6ff719c
gh-98712: Clarify "readonly bytes-like object" semantics in C arg-parsing docs (#98710) 2022-12-23 07:00:21 -08:00
Bill Fisher 88d565f32a
gh-99110: Initialize `frame->previous` in init_frame to fix segmentation fault when accessing `frame.f_back` (#100182) 2022-12-23 20:15:53 +05:30
Irit Katriel 2659036c75
GH-100459: fix copy-paste errors in specialization stats (GH-100460) 2022-12-23 14:42:24 +00:00
Eric Wieser 84bc6a4f25
gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576)
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.
2022-12-23 08:23:19 +00:00
Shantanu 73c08eeaff
Fix typo in 3.12 What's New (#100449) 2022-12-23 00:22:31 -06:00
Stanley f3db68e6e6
gh-48496: Added example and link to faq for UnboundLocalError in reference (#93068) 2022-12-22 17:23:25 -06:00
Shantanu ad23da0e77
gh-57762: fix misleading tkinter.Tk docstring (#98837)
Mentioned as a desired change by terryjreedy on the corresponding issue,
since Tk is not a subclass of Toplevel.
2022-12-22 16:35:32 -06:00
Alex Waygood 9cdb642997
gh-85432: Harmonise parameter names between C and pure-Python implementations of `datetime.time.strftime`, `datetime.datetime.fromtimestamp` (#99993) 2022-12-22 15:57:18 -06:00
Brandt Bucher 09edde95f4
GH-99554: Trim trailing whitespace (GH-100435)
Automerge-Triggered-By: GH:brandtbucher
2022-12-22 12:13:51 -08:00
Itamar Ostricher 4cc63e0d4e
gh-100344: Add C implementation for `asyncio.current_task` (#100345)
Co-authored-by: pranavtbhat
2022-12-22 19:08:12 +05:30
Eli Schwartz aa878f086b
gh-78997: fix bad rebase of moved test file (#100424) 2022-12-22 13:28:25 +00:00
penguin_wwy a02161286a
GH-99770: Make the correct call specialization fail kind show up in the stats (GH-99771) 2022-12-22 12:44:59 +00:00
Pieter Eendebak 2b82c36f17
gh-99761: Add `_PyLong_IsPositiveSingleDigit` function to check for single digit integers (#100064) 2022-12-22 17:00:18 +05:30
david-why 68981578ec
Correct typo in typing.py (#100423)
In the docstring of `ParamSpec`, the name of `P = ParamSpec('P')` was
mistakenly written as `'T'`.
2022-12-22 11:20:52 +00:00
Brandt Bucher 3c033a2e6f
GH-99554: Pack location tables more effectively (GH-99556) 2022-12-21 16:41:18 -08:00
amaajemyfren bbf4a66a18
GH-69564: Clarify use of octal format of mode argument in help(os.chmod) (#20621)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-12-21 23:18:25 +05:30
Hai Shi d713c54ac8
gh-78878: Fix crash when creating an instance of `_ctypes.CField` (#14837) 2022-12-21 23:01:17 +05:30
Nikita Sobolev e0b4d966a8
Remove unused variable from `dis._find_imports` (#100396) 2022-12-21 22:25:02 +05:30
Serhiy Storchaka b98d2d31bf
gh-100129: Add tests for pickling all builtin types and functions (GH-100142) 2022-12-21 16:31:22 +02:00
Dominic Socular 12be23cf3c
gh-100374: Fixed a bug in socket.getfqdn() (gh-100375) 2022-12-21 22:25:04 +09:00