Commit Graph

116327 Commits

Author SHA1 Message Date
Barney Gale 3e60e0213e
GH-101362: Check pathlib.Path flavour compatibility at import time (GH-101664)
This saves a comparison in `pathlib.Path.__new__()` and reduces the time taken to run `Path()` by ~5%.

Automerge-Triggered-By: GH:AlexWaygood
2023-03-05 14:46:45 -08:00
Barney Gale 3572c861d8
GH-101362: Call join() only when >1 argument supplied to pathlib.PurePath() (#101665)
GH-101362: Call join() only when >1 argument supplied to pathlib.PurePath

This reduces the time taken to run `PurePath("foo")` by ~15%
2023-03-05 22:00:56 +00:00
Alex Waygood 96e1022929
gh-102444: Fix minor bugs in `test_typing` highlighted by pyflakes (#102445) 2023-03-05 21:37:29 +00:00
Partha P. Mukherjee 32220543e2
GH-102341: Improve the test function for pow (#102342)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-03-05 12:31:26 -05:00
JosephSBoyle 7894bbe94b
Fix unused classes in a typing test (GH-102437)
As part of investigation issue https://github.com/python/cpython/issues/102433, I discovered what I believe to be an error where two classes `CI` and `DI` are not being used. The assertions beneath them act on `C` and `D`, duplicating existing assertions in this test.

Automerge-Triggered-By: GH:AlexWaygood
2023-03-05 07:07:44 -08:00
Yeojin Kim 9a478be1a4
gh-101979: argparse: fix a bug where parentheses in metavar argument of add_argument() were dropped (#102318) 2023-03-05 06:54:33 -08:00
Marta Gómez Macías 66aa78cbe6
gh-102356: Add thrashcan macros to filter object dealloc (#102426)
Add thrashcan macros to the deallocator of the filter objects to protect against deeply nested destruction of chains of nested filters.
2023-03-05 12:00:41 +01:00
Sergey B Kirpichev 5da379ca7d
Move around example in to_bytes() to avoid confusion (#101595)
Moves an example to be closer to the sentence that refers to it.
2023-03-05 09:31:56 +00:00
Kumar Aditya a74cd3ba5d
GH-97546: fix flaky asyncio `test_wait_for_race_condition` test (#102421) 2023-03-05 12:15:22 +05:30
Matthias Görgens eff9f43924
gh-96821: Add config option `--with-strict-overflow` (#96823)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Shantanu <hauntsaninja@gmail.com>
2023-03-04 13:39:52 -08:00
Dustin Rodrigues e4609cbe4c
gh-101992: update pstlib module documentation (#102133) 2023-03-04 13:35:25 -08:00
Jaysinh Shukla 81763341ed
gh-63301: Set exit code when tabnanny CLI exits on error (#7699)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-03-04 13:32:13 -08:00
Byeongmin Choi 77a3196b7c
gh-101863: Fix wrong comments in EUC-KR codec (gh-102417) 2023-03-05 01:01:54 +09:00
Gouvernathor 90801e48fd
gh-102302 Micro-optimize `inspect.Parameter.__hash__` (#102303) 2023-03-04 15:08:57 +00:00
Alexey Izbyshev c2bd55d26f
gh-102179: Fix `os.dup2` error reporting for negative fds (#102180) 2023-03-04 19:54:08 +05:30
Raj 705487c655
gh-101892: Fix `SystemError` when a callable iterator call exhausts the iterator (#101896)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-03-04 19:51:29 +05:30
Mark Dickinson b022250e67
Remove unused internal macros (#102415)
Since #101826 was merged, the internal macro `_Py_InIntegralTypeRange` is unused, as are its supporting macros `_Py_IntegralTypeMax` and `_Py_IntegralTypeMin`. This PR removes them.

Note that `_Py_InIntegralTypeRange` doesn't actually work as advertised - it's not a safe way to avoid undefined behaviour in an integer to double conversion.
2023-03-04 12:20:14 +00:00
Jacob Bower 8de59c1bb9
gh-102021 : Allow multiple input files for interpreter loop generator (#102022)
The input files no longer use `-i`.
2023-03-03 20:59:21 -08:00
Wagner Alberto cb944d0be8
Add import of `unittest.mock.Mock` in documentation (#102346) 2023-03-03 22:55:31 +05:30
Nikita Sobolev 7b9132057d
gh-102383: [docs] Arguments of `PyObject_CopyData` are `PyObject *` (#102390) 2023-03-03 22:46:50 +05:30
Owain Davies 4e7c0cbf59
gh-101754: Document that Windows converts keys in `os.environ` to uppercase (GH-101840) 2023-03-03 10:51:32 +00:00
Nikita Sobolev 12011dd8ba
gh-102324: Improve tests of `typing.override` (#102325)
Fixes #101564
2023-03-02 19:59:05 -08:00
Irit Katriel 71db5dbcd7
gh-102371: move _Py_Mangle from compile.c to symtable.c (#102372) 2023-03-02 18:38:22 +00:00
Michael K 73250000ac
Fix typos in documentation and comments (GH-102374)
Found some duplicate `to`s in the documentation and some code comments and fixed them.


[Misc/NEWS.d/3.12.0a1.rst](ed55c69ebd/Misc/NEWS.d/3.12.0a1.rst) also contains two duplicate `to`s, but I wasn't sure if it's ok to touch that file.  Looks auto generated.  I'm happy to amend the PR if requested. :)

Automerge-Triggered-By: GH:AlexWaygood
2023-03-02 07:26:49 -08:00
Dong-hee Na ed55c69ebd
gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350) 2023-03-02 20:32:05 +09:00
Hyunkyun Moon 60597439ef
gh-95672: Update memory_watchdog to use test.support.get_pagesize (gh-102365) 2023-03-02 20:10:08 +09:00
Stefan Pochmann eaae563b68
gh-102088 Optimize iter_index itertools recipe (GH-102360) 2023-03-01 21:16:23 -06:00
Hyunkyun Moon 2f62a5da94
gh-95672 skip fcntl when pipesize is smaller than pagesize (gh-102163) 2023-03-01 23:56:19 +09:00
Max Bachmann c1748ed59d
gh-102344: Reimplement winreg QueryValue / SetValue using QueryValueEx / SetValueEx (GH-102345)
The newer APIs are more widely available than the old ones, and are called in a way to preserve functionality.
2023-03-01 14:50:38 +00:00
Max Bachmann d3d20743ee
gh-102336: Ensure CancelIoEx result is not ignored (GH-102347)
fix ignored return value
2023-03-01 12:01:39 +00:00
Irit Katriel f91846ba39
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in tkinter module (#102319) 2023-03-01 09:49:23 +00:00
Inada Naoki 7d1d663418
Doc: Fix minor error in ePub (GH-100614)
Fix issue reported https://mail.python.org/archives/list/docs@python.org/message/KE7OIAO53P4XRC4ZOWPDHA63ZQJCHEC3/
2023-03-01 09:48:15 +09:00
Max Bachmann 938e36f824
gh-102336: Remove code specifically for handling Windows 7 (GH-102337) 2023-03-01 00:31:21 +00:00
Anthony Sottile 360ef843d8
gh-99108: Add missing md5/sha1 defines to Modules/Setup (#102308) 2023-02-28 22:34:06 +01:00
Eric Snow 880437d4ec
gh-100227: Move _str_replace_inf to PyInterpreterState (gh-102333)
https://github.com/python/cpython/issues/100227
2023-02-28 14:16:39 -07:00
Eric Snow f300a1fa4c
gh-100227: Move the dtoa State to PyInterpreterState (gh-102331)
https://github.com/python/cpython/issues/100227
2023-02-28 13:14:40 -07:00
Guido van Rossum b5ff382433
GH-102305: Expand some macros in generated_cases.c.h (#102309)
* Emit straight stack_pointer[-i] instead of PEEK(i), POKE(i, ...)
* Expand JUMPBY() and NEXTOPARG(), and fix a perf bug
2023-02-28 08:49:35 -08:00
Ee Durbin e1a90ec75c
Migrate to new PSF mailgun account (#102284)
Our legacy mailgun account is associated with a parent rackspace account that I am trying to decomission.

The necessary secret has been added to the GitHub Actions Secrets already, so this is ready to go on approval.
2023-02-28 08:23:39 -05:00
Irit Katriel 4c87537efb
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives (in Python/) (#102193) 2023-02-28 11:50:52 +00:00
Furkan Onder 85b1fc1fc5
GH-90744: Fix erroneous doc links in the sys module (#101319)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-02-28 13:43:00 +02:00
Irit Katriel 9f799ab020
gh-87092: Make jump target label equal to the offset of the target in the instructions sequence (#102093) 2023-02-28 11:29:32 +00:00
Petr Viktorin 6b2d7c0ddb
gh-101101: Unstable C API tier (PEP 689) (GH-101102) 2023-02-28 09:31:01 +01:00
JosephSBoyle c41af812c9
IDLE: Simplify DynOptionsMenu __init__code (#101371)
Refactor DynOptionMenu's initializer to not copy  kwargs dict and use subscripting;
improve its htest.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-02-28 01:11:52 -05:00
Steven Troxler 0f89acf6cc
gh-101561: Add typing.override decorator (#101564)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-02-27 13:16:11 -08:00
Sergey B Kirpichev 4624987b29
gh-101825: Clarify that as_integer_ratio() output is always normalized (#101843)
Make docstrings for `as_integer_ratio` consistent across types, and document that
the returned pair is always normalized (coprime integers, with positive denominator).

---------

Co-authored-by: Owain Davies <116417456+OTheDev@users.noreply.github.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2023-02-27 19:11:28 +00:00
Sergey B Kirpichev 4f3786b761
gh-101773: Optimize creation of Fractions in private methods (#101780)
This PR adds a private `Fraction._from_coprime_ints` classmethod for internal creations of `Fraction` objects, replacing the use of `_normalize=False` in the existing constructor. This speeds up creation of `Fraction` objects arising from calculations. The `_normalize` argument to the `Fraction` constructor has been removed.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2023-02-27 18:53:22 +00:00
Eric Snow bb0cf8fd60
gh-102251: Updates to test_imp Toward Fixing Some Refleaks (gh-102254)
This is related to fixing the refleaks introduced by commit 096d009.  I haven't been able to find the leak yet, but these changes are a consequence of that effort.  This includes some cleanup, some tweaks to the existing tests, and a bunch of new test cases.  The only change here that might have impact outside the tests in question is in imp.py, where I update imp.load_dynamic() to use spec_from_file_location() instead of creating a ModuleSpec directly.

Also note that I've updated the tests to only skip if we're checking for refleaks (regrtest's --huntrleaks), whereas in gh-101969 I had skipped the tests entirely.  The tests will be useful for some upcoming work and I'd rather the refleaks not hold that up.  (It isn't clear how quickly we'll be able to fix the leaking code, though it will certainly be done in the short term.)

https://github.com/python/cpython/issues/102251
2023-02-27 09:21:18 -07:00
Gouvernathor 0db6f44259
gh-102296 Document that inspect.Parameter kinds support ordering (GH-102297)
Automerge-Triggered-By: GH:AlexWaygood
2023-02-27 07:13:18 -08:00
Dennis Sweeney e3c3f9fec0
gh-102250: Fix double-decref in COMPARE_AND_BRANCH error case (GH-102287) 2023-02-27 10:46:40 +00:00
Nikita Sobolev 101a12c576
gh-101100: Fix sphinx warnings in `types` module (#102274)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-02-27 07:26:21 +00:00