Commit Graph

124463 Commits

Author SHA1 Message Date
Sergey B Kirpichev 8477951a1c
gh-120026: soft deprecate Py_HUGE_VAL macro (#120027)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-11-01 22:04:31 +00:00
sobolevn 28b148fb32
gh-126220: Fix crash on calls to `_lsprof.Profiler` methods with 0 args (backportable) (#126271)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-11-02 00:53:29 +03:00
Cody Maloney 72dd4714f9
gh-120754: _io Ensure stat cache is cleared on fd change (#125166)
Performed an audit of `fileio.c` and `_pyio` and made sure anytime the
fd changes the stat result, if set, is also cleared/changed.

There's one case where it's not cleared, if code would clear it in
__init__, keep the memory allocated and just do another fstat with the
existing memory.
2024-11-01 22:50:49 +01:00
Savannah Ostrowski c84a136511
gh-125560: Pin JIT CI to ubuntu-22.04 (#125564) 2024-11-01 23:43:30 +02:00
Sergey B Kirpichev 51ef54abc4
gh-125916: Adapt functools.reduce() to Argument Clinic (#125999) 2024-11-01 21:15:39 +01:00
Joseph Martinot-Lagarde 74cf5967f3
Doc: Add a single table as summary to math documentation (GH-125810)
* Summary for math module with separate tables

* Forgot remainder description

* Single table

* data instead of func

* Add arguments in the table

* Fix inconsistencies in pow documentation

* Remove full stops from the table

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>

* Fix math.pow link

* Fix spacing

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-11-01 12:35:05 -07:00
Filip "Ret2Me" Poplewski ff257c7843
docs: add a more precise example in enum doc (GH-121015)
* docs: add a more precise example

Previous example used manual integer value assignment in class based declaration but in functional syntax has been used auto value assignment what could be confusing for the new users. Additionally documentation doesn't show how to declare new enum via functional syntax with usage of the manual value assignment.

* docs: remove whitespace characters

* refactor: change example

---------

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-11-01 12:28:50 -07:00
Barney Gale 37651cfbce
GH-125413: pathlib ABCs: use `scandir()` to speed up `walk()` (#126262)
Use the new `PathBase.scandir()` method in `PathBase.walk()`, which greatly
reduces the number of `PathBase.stat()` calls needed when walking.

There are no user-facing changes, because the pathlib ABCs are still
private and `Path.walk()` doesn't use the implementation in its superclass.
2024-11-01 18:52:00 +00:00
Barney Gale 68a51e0178
GH-125413: pathlib ABCs: use `scandir()` to speed up `glob()` (#126261)
Use the new `PathBase.scandir()` method in `PathBase.glob()`, which greatly
reduces the number of `PathBase.stat()` calls needed when globbing.

There are no user-facing changes, because the pathlib ABCs are still
private and `Path.glob()` doesn't use the implementation in its superclass.
2024-11-01 17:48:58 +00:00
Bénédikt Tran 464a7a91d0
gh-97850: remove ``find_loader`` and ``get_loader`` from ``pkgutil`` (#119656)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2024-11-01 18:35:22 +02:00
Bénédikt Tran 38a604fd90
gh-99108: Cleanup references to inexisting `Modules/_blake2`. (GH-126270)
* Remove references to `Modules/_blake2`.

* Remove `Modules/_blake2` entry from CODEOWNERS

The folder does not exist anymore.

* Remove `Modules/_blake2` entry from `Tools/c-analyzer/TODO`
2024-11-01 16:18:44 +00:00
mpage 821759d631
gh-126211: Exclude preprocessor directives from statements containing escaping calls (#126213)
The cases generator inserts code to save and restore the stack pointer around
statements that contain escaping calls. To find the beginning of such statements,
we would walk backwards from the escaping call until we encountered a token that
was treated as a statement terminator. This set of terminators should include
preprocessor directives.
2024-11-01 08:53:03 -07:00
Bénédikt Tran 32e07fd377
gh-111495: improve test coverage of codecs C API (GH-126030)
For now, skip some crashers (tracked in gh-123378).
2024-11-01 13:28:18 +00:00
Jun Komoda 6c67446a6e
gh-125783: Add more tests to prevent regressions with the combination of ctypes and metaclasses. (GH-126126) 2024-11-01 13:50:02 +01:00
Erlend E. Aasland 43447cb634
gh-126206: make clinic now forcefully regenerates clinic code (#126244) 2024-11-01 08:17:54 +00:00
sobolevn 295262c8ec
gh-126259: Fix "unclosed database" warning in sqlite3 doctest (#126260) 2024-11-01 08:17:05 +01:00
Barney Gale 260843df1b
GH-125413: Add `pathlib.Path.scandir()` method (#126060)
Add `pathlib.Path.scandir()` as a trivial wrapper of `os.scandir()`. This
will be used to implement several `PathBase` methods more efficiently,
including methods that provide `Path.copy()`.
2024-11-01 01:19:01 +00:00
Alperen Keleş d0abd0b826
gh-126256: Update time.rst to use the same clock as instead of the same clock than (#126257)
Update time.rst to use `the same clock as` instead of `the same clock than`

The time documentation uses the same clock than time.monotonic instead of the same clock as time.monotonic, which is grammatically false. This PR fixes changes two instances of `the same clock than` to `the same clock as`.
2024-10-31 21:44:34 +00:00
J. Nick Koston dd3c0fa3fd
gh-126156: Improve performance of creating `Morsel` objects (#126157)
Replaces the manually constructed loop with a call to `dict.update`
2024-10-31 12:05:40 -07:00
Bénédikt Tran 0e8665554b
gh-126080: fix UAF on `task->task_context` in `task_call_step_soon` due to an evil `loop.__getattribute__` (#126120) 2024-10-31 10:14:47 -07:00
Sergey B Kirpichev 3275cb1953
gh-101123: Adapt vararg functions in the math module to Argument Clinic (#126235)
This implicitly fixes the math.hypot signature, which was previously
incomprehensible to inspect.signature().
2024-10-31 14:37:47 +00:00
Bénédikt Tran 94639f6b71
gh-126240: handle `NULL` returned by `_Py_asdl_expr_seq_new` (#126241)
check return value of `_Py_asdl_expr_seq_new`
2024-10-31 17:24:07 +03:00
Peter Bierma 01415213d7
gh-126223: Propagate unicode errors in `_interpreters.create()` (#126224)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-31 17:14:37 +03:00
Sergey B Kirpichev 8c22eba877
gh-90370: Argument Clinic: avoid temporary tuple creation for varargs (#126064)
Avoid temporary tuple creation when all arguments either positional-only
or vararg.

Objects/setobject.c and Modules/gcmodule.c adapted. This fixes slight
performance regression for set methods, introduced by gh-115112.
2024-10-31 11:37:03 +01:00
Nico-Posada d07dcce693
gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (#126103) 2024-10-31 10:47:57 +03:00
RUANG (James Roy) d467d9246c
gh-125818: Fix incorrect signature of argument `skip_file_prefixes` in warnings docs (GH-125823)
Change documentation
2024-10-30 18:15:07 -07:00
Hood Chatham b3122aa613
gh-126178: NFC Separate Emscripten and WASI standard lib disables in configure (#126179)
Separate the Emscripten and WASI stdlib configuration in configure.
2024-10-31 08:51:11 +08:00
Russell Keith-Magee ac3a2c8abc
Add myself to CODEOWNERS for WASM/emscripten and Android (#126210)
Add RKM to CODEOWNERS for WASM/emscripten and Android.
2024-10-31 00:12:37 +00:00
Barney Gale 951cb2c369
GH-126205: Fix conversion of UNC paths to file URIs (#126208)
File URIs for Windows UNC paths should begin with two slashes, not four.
2024-10-30 22:56:58 +00:00
Johan Förberg 2b2d607095
gh-121267: Improve performance of tarfile (#121267) (#121269)
Tarfile in the default write mode spends much of its time resolving UIDs
into usernames and GIDs into group names. By caching these mappings, a
significant speedup can be achieved.

In my simple benchmark[1], this extra caching speeds up tarfile by 8x.

[1] https://gist.github.com/jforberg/86af759c796199740c31547ae828aef2

---------

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-10-30 15:08:30 -07:00
Richard Hansen 616468b87b
gh-125674: Doc: Fix type of `newfunc` first parameter (GH-125675)
* gh-125674: Doc: Fix type of `newfunc` first parameter

* fixup! gh-125674: Doc: Fix type of `newfunc` first parameter

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-30 13:27:37 -07:00
AN Long 5768fef355
gh-114990: Add missing mixin methods in collections.abc's document (GH-114991)
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-30 13:17:20 -07:00
Steve Dower 60c415bd53
gh-125315: Avoid crashing in _wmimodule due to slow WMI calls on some Windows machines (GH-126141) 2024-10-30 19:59:51 +00:00
Savannah Ostrowski c29bbe2101
GH-125498: Update JIT builds to use LLVM 19 and preserve_none (GH-125499) 2024-10-30 12:03:31 -07:00
Victor Wheeler 597d814334
gh-126055: Add omitted command (in docs [os.walk]) for code to fulfill `shutil.rmtree` algorithm (GH-126067)
* gh-126055:  Add omitted command (in docs [os.walk]) for code to fulfill `shutil.rmtree` algorithm.

Resolves #126055

* gh-126055:  Fix omitted code highlighting
2024-10-30 11:22:58 -07:00
Furkan Onder 4f826214b3
gh-60712: Include the "object" type in the lists of documented types (GH-103036)
* add test for the predefined object's attributes

* Include the "object" type in the lists of documented types

* remove 'or' from augment tuple

* 📜🤖 Added by blurb_it.

* Add cross-reference to news

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* Fix format for the function parameter

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* Add space

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* add reference for the 'object'

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* add reference for NotImplemented

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* Change ref:`string <textseq>`  as class:`str`

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* remove hyphen from `newly-created`

* Update Doc/reference/datamodel.rst

'dictionaries' to 'dict'

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* Update predefined attribute types in testPredefinedAttrs

* Change `universal type` as `top type`

* Don't mention about the top type

* Update the description of richcmpfuncs

* Update Doc/library/stdtypes.rst

Co-authored-by: Éric <merwok@netwok.org>

* Revert: Hierarchy Section in Data Model Documentation

* Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity.

* Update Doc/reference/datamodel.rst

Co-authored-by: Éric <merwok@netwok.org>

* Remove blank line

Co-authored-by: Éric <merwok@netwok.org>

* Use ref:`str <textseq>` instead of :class:`str

Co-authored-by: Éric <merwok@netwok.org>

* Revert changes the description of Other Built-in Types in stdtypes.rst

* Update Doc/reference/datamodel.rst

Co-authored-by: Éric <merwok@netwok.org>

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-30 11:20:02 -07:00
Rafael Fontenelle 6f512c6034
Fix incorrect indentation in importlib.metadata.rst (GH-126189) 2024-10-30 10:46:09 -07:00
amaajemyfren a3443c0e22
gh-85583: Add f-string index in tutorial/inputoutput.rst (GH-21681)
* bpo-41411 fstring index in tutorial/inputoutput

To assist in searching for fstrings I have added an index

* Add newline

---------

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-30 10:26:29 -07:00
Serhiy Storchaka cc9a183993
gh-126068: Fix exceptions in the argparse module (GH-126069)
* Only error messages for ArgumentError and ArgumentTypeError are now
  translated.
* ArgumentError is now only used for command line errors, not for logical
  errors in the program.
* TypeError is now raised instead of ValueError for some logical errors.
2024-10-30 18:14:27 +02:00
sobolevn 1f16df4bfe
gh-125669: Do not run `-ugui` tests by default on `make test` (#125730)
Adds `make ci` target for use in CI and keeping `make test` for the local development.
2024-10-30 17:14:22 +03:00
Jakub Kulík 1064141967
gh-91962: Fix `hstrerror` detection issues on Solaris (GH-91963) 2024-10-30 13:19:44 +01:00
Sergey B Kirpichev dcad8fecbd
gh-125206: Correct detection of complex numbers support in libffi (#126104) 2024-10-30 10:12:39 +01:00
Xuanteng Huang 35df4eb959
gh-126072: do not add `None` to `co_consts` if there is no docstring (GH-126101) 2024-10-30 09:01:09 +00:00
Serhiy Storchaka 2ab377a47c
gh-126071: Improve formatting of the argparse documentation (GH-126073)
* Use appropriate roles for ArgumentParser, Action, etc.
* Remove superfluous repeated links.
* Explicitly document signatures and add index entries for some methods
  and classes.
* Make it more clear that some parameters are keyword-only.
* Fix some minor errors.
2024-10-30 08:50:12 +00:00
Daniel Ruf 00e5ec0d35
gh-118633: Add warning regarding the unsafe usage of eval and exec (GH-118437)
* Add warning regarding the unsafe usage of eval

* Add warning regarding the unsafe usage of exec

* Move warning under parameters table

* Use suggested shorter text

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

* Use suggested shorter text

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

* Improve wording as suggested

---------

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-30 00:36:18 +00:00
Hugo van Kemenade d4b6d84cc8
gh-58032: Docs: Sort argparse alphabetically (GH-125871)
Sort argparse alphabetically
2024-10-29 17:13:11 -07:00
Pablo Galindo Salgado 2d37c719ed
gh-124855: Don't allow the JIT and perf support to be active at the same time (#124856) 2024-10-30 00:12:45 +00:00
Ned Batchelder 2d9d10179f
docs: restore an anchor to for/else (#126154) 2024-10-29 20:11:50 -04:00
Brian Schubert 224c370a36
gh-126139: Improve error message location for future statement with unknown feature (#126140) 2024-10-29 23:57:59 +00:00
Pablo Galindo Salgado 9dfef4e5f4
gh-125588: Teach the python PEG generator the new f-string tokens (#125589)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-10-29 23:40:12 +00:00