Commit Graph

120553 Commits

Author SHA1 Message Date
Serhiy Storchaka b7688ef71e
gh-114685: Check flags in PyObject_GetBuffer() (GH-114707)
PyObject_GetBuffer() now raises a SystemError if called with
PyBUF_READ or PyBUF_WRITE as flags. These flags should
only be used with the PyMemoryView_* C API.
2024-01-31 13:11:35 +02:00
Skip Montanaro 7a93db4425
gh-101100: Fix class reference in library/test.rst (GH-114769)
The text clearly seems to be referencing `TestFuncAcceptsSequencesMixin`,
for which no target is available. Name the class properly and suppress
the dangling reference.
2024-01-31 11:33:10 +02:00
Daniel Hollas 5e390a0fc8
gh-109653: Speedup import of threading module (#114509)
Avoiding an import of functools leads to 50% speedup of import time.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-01-31 09:29:44 +00:00
Erlend E. Aasland c8cf5d7d14
Docs: mark up dbm.gnu.open() and dbm.ndbm.open() using param list (#114762) 2024-01-31 07:59:34 +01:00
Brett Cannon 2ed8f924ee
GH-114743: Set a low recursion limit for `test_main_recursion_error()` in `test_runpy` (GH-114772)
This can fail under a debug build of WASI when directly executing test.test_runpy.
2024-01-31 01:49:27 +00:00
Barney Gale 574291963f
pathlib ABCs: drop partial, broken, untested support for `bytes` paths. (#114777)
Methods like `full_match()`, `glob()`, etc, are difficult to make work with
byte paths, and it's not worth the effort. This patch makes `PurePathBase`
raise `TypeError` when given non-`str` path segments.
2024-01-31 00:59:33 +00:00
Barney Gale 1667c28686
pathlib ABCs: raise `UnsupportedOperation` directly. (#114776)
Raise `UnsupportedOperation` directly, rather than via an `_unsupported()`
helper, to give human readers and IDEs/typecheckers/etc a bigger hint that
these methods are abstract.
2024-01-31 00:38:01 +00:00
Diego Russo a06b606462
gh-110190: Fix ctypes structs with array on Windows ARM64 (GH-114753) 2024-01-30 23:53:04 +00:00
Serhiy Storchaka dc4cd2c9ba
gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761) 2024-01-30 22:15:33 +00:00
Brandt Bucher 348a72ce3f
GH-113464: Add aarch64-apple-darwin/clang to JIT CI (GH-114759) 2024-01-30 14:08:53 -08:00
Skip Montanaro 3911b42cc0
gh-101100: Fix references in csv docs (GH-114658)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-01-30 21:54:37 +00:00
Matt Prodani e5e186609f
gh-112606: Use pthread_cond_timedwait_relative_np() in parking_lot.c when available (#112616)
Add a configure define for HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP and
replaces pthread_cond_timedwait() with pthread_cond_timedwait_relative_np()
for relative time when supported in semaphore waiting logic.
2024-01-30 22:22:17 +01:00
Barney Gale fda7445ca5
GH-70303: Make `pathlib.Path.glob('**')` return both files and directories (#114684)
Return files and directories from `pathlib.Path.glob()` if the pattern ends
with `**`. This is more compatible with `PurePath.full_match()` and with
other glob implementations such as bash and `glob.glob()`. Users can add a
trailing slash to match only directories.

In my previous patch I added a `FutureWarning` with the intention of fixing
this in Python 3.15. Upon further reflection I think this was an
unnecessarily cautious remedy to a clear bug.
2024-01-30 19:52:53 +00:00
Kirill Podoprigora 6de8aa31f3
``importlib/_bootstrap.py``: Reduce size of ``_List`` instances (GH-114747)
Reduce size of _List instances
2024-01-30 10:44:09 -08:00
Terry Jan Reedy a1332a99cf
Clarify one-item tuple (#114745)
A 'single tuple' means 'one typle, of whatever length.
Remove the unneeded and slight distracting parenthetical 'singleton' comment.
2024-01-30 18:40:54 +00:00
Dino Viehland 0990d55725
gh-112075: refactor dictionary lookup functions for better re-usability (#114629)
Refactor dict lookup functions to use force inline helpers
2024-01-30 09:33:36 -08:00
Pablo Galindo Salgado 39d102c2ee
gh-113744: Add a new IncompleteInputError exception to improve incomplete input detection in the codeop module (#113745)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-01-30 16:21:30 +00:00
Eugene Toder 1f515e8a10
gh-112919: Speed-up datetime, date and time.replace() (GH-112921)
Use argument clinic and call new_* functions directly. This speeds up
these functions 6x to 7.5x when calling with keyword arguments.
2024-01-30 15:19:46 +00:00
Hugo van Kemenade 4287e8608b
gh-109975: Copyedit "What's New in Python 3.13" (#114401)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-30 17:12:11 +02:00
Barney Gale 809eed4805
GH-114610: Fix `pathlib._abc.PurePathBase.with_suffix('.ext')` handling of stems (#114613)
Raise `ValueError` if `with_suffix('.ext')` is called on a path without a
stem. Paths may only have a non-empty suffix if they also have a non-empty
stem.

ABC-only bugfix; no effect on public classes.
2024-01-30 14:25:16 +00:00
Vinay Sajip e21754d7f8
gh-114706: Allow QueueListener.stop() to be called more than once. (GH-114748) 2024-01-30 12:34:18 +00:00
Serhiy Storchaka ea30a28c3e
gh-113732: Fix support of QUOTE_NOTNULL and QUOTE_STRINGS in csv.reader (GH-113738) 2024-01-30 14:21:12 +02:00
Victor Stinner 58f883b91b
gh-103323: Remove current_fast_get() unused parameter (#114593)
The current_fast_get() static inline function doesn't use its
'runtime' parameter, so just remove it.
2024-01-30 11:47:58 +01:00
Sviatoslav Sydorenko (Святослав Сидоренко) 963904335e
GH-80789: Get rid of the ``ensurepip`` infra for many wheels (#109245)
Co-authored-by: vstinner@python.org
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-01-30 01:25:31 +00:00
Brandt Bucher 742ba6081c
GH-113464: Make Brandt a codeowner for JIT stuff (GH-114739) 2024-01-29 16:29:54 -08:00
Erlend E. Aasland 8612230c1c
gh-114569: Use PyMem_* APIs for non-PyObjects in compiler (#114587) 2024-01-30 00:04:34 +01:00
Hugo van Kemenade 3996cbdd33
Set `hosted_on` for Read the Docs builds (#114697) 2024-01-29 14:24:21 -07:00
Erlend E. Aasland 53d921ed96
gh-114569: Use PyMem_* APIs for non-PyObjects in unicodeobject.c (#114690) 2024-01-29 21:48:49 +01:00
Matan Perelman 29952c86f3
TaskGroup: Use explicit None check for cancellation error (#114708) 2024-01-29 11:12:33 -08:00
Serhiy Storchaka aa3402ad45
gh-114678: Fix incorrect deprecation warning for 'N' specifier in Decimal format (GH-114683)
Co-authored-by: Stefan Krah <skrah@bytereef.org>
2024-01-29 19:58:31 +02:00
Dino Viehland 0cd9bacb8a
gh-112075: Dictionary global version counter should use atomic increments (#114568)
Dictionary global version counter should use atomic increments
2024-01-29 09:47:54 -08:00
Dino Viehland 3d716655d2
gh-112075: Use PyMem_* for allocating dict keys objects (#114543)
Use PyMem_* for keys allocation
2024-01-29 09:38:03 -08:00
Steven Ward 2c089b09ac
gh-112240: Add option to calendar module CLI to specify the weekday to start each week (GH-112241) 2024-01-29 16:58:21 +00:00
Serhiy Storchaka 39c766b579
Fix more references to datetime and time classes (GH-114717)
They could be confused with references to datetime and time modules.
2024-01-29 18:20:13 +02:00
Soumendra Ganguly e351ca3c20
gh-85984: Add POSIX pseudo-terminal functions. (GH-102413)
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-01-29 16:10:28 +00:00
Steven Ward 0f54ee4c6c
Remove limit in calendar CLI help message for year arg (GH-114719)
The limit was removed in 66c88ce30c (GH-4109).
2024-01-29 18:00:15 +02:00
Petr Viktorin 15fe8cea17
gh-91325: Skip Stable ABI checks with Py_TRACE_REFS special build (GH-92046)
Skip Stable ABI checks with Py_TRACE_REFS special build

This build is not compatible with Py_LIMITED_API nor with
the stable ABI.
2024-01-29 16:45:31 +01:00
mpage c87233fd3f
gh-112050: Adapt collections.deque to Argument Clinic (#113963) 2024-01-29 15:08:23 +00:00
Skip Montanaro e8b8f5e9c2
gh-101100: Fix datetime reference warnings (GH-114661)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-29 16:43:44 +02:00
Hugo van Kemenade b7a12ab214
gh-101100: Fix Sphinx warnings in `whatsnew/2.2.rst` (#112366)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-01-29 13:12:19 +00:00
Nikita Sobolev 97fb2480e4
gh-101100: Fix sphinx warnings in `Doc/c-api/memoryview.rst` (GH-114669) 2024-01-29 11:56:11 +02:00
Shantanu 3b86891fd6
gh-110893: Improve the documentation for __future__ module (#114642)
nedbat took issue with the phrasing "real module". I'm actually fine
with that phrasing, but I do think the `__future__` page should be clear
about the way in which the `__future__` module is special. (Yes, there
was a footnote linking to the future statements part of the reference,
but there should be upfront discussion).

I'm sympathetic to nedbat's claim that no one really cares about
`__future__._Feature`, so I've moved the interesting table up to the
top.
2024-01-29 01:37:28 -08:00
Nikita Sobolev 1ac1b2f953
gh-114685: Fix incorrect use of PyBUF_READ in import.c (GH-114686) 2024-01-29 11:37:06 +02:00
Shantanu 2124a3ddcc
gh-109653: Improve import time of importlib.metadata / email.utils (#114664)
My criterion for delayed imports is that they're only worth it if the
majority of users of the module would benefit from it, otherwise you're
just moving latency around unpredictably.

mktime_tz is not used anywhere in the standard library and grep.app
indicates it's not got much use in the ecosystem either.

Distribution.files is not nearly as widely used as other
importlib.metadata APIs, so we defer the csv import.

Before:
```
λ hyperfine -w 8 './python -c "import importlib.metadata"'
Benchmark 1: ./python -c "import importlib.metadata"
  Time (mean ± σ):      65.1 ms ±   0.5 ms    [User: 55.3 ms, System: 9.8 ms]
  Range (min … max):    64.4 ms …  66.4 ms    44 runs
```

After:
```
λ hyperfine -w 8 './python -c "import importlib.metadata"'
Benchmark 1: ./python -c "import importlib.metadata"
  Time (mean ± σ):      62.0 ms ±   0.3 ms    [User: 52.5 ms, System: 9.6 ms]
  Range (min … max):    61.3 ms …  62.8 ms    46 runs
```

for about a 3ms saving with warm disk cache, maybe 7-11ms with cold disk
cache.
2024-01-29 01:30:22 -08:00
Stanley d7d0d13cd3
gh-89159: Add some TarFile attribute types (GH-114520)
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2024-01-29 09:19:22 +00:00
Brandt Bucher a16a9f978f
GH-113464: A JIT backend for tier 2 (GH-113465)
Add an option (--enable-experimental-jit for configure-based builds
or --experimental-jit for PCbuild-based ones) to build an
*experimental* just-in-time compiler, based on copy-and-patch
(https://fredrikbk.com/publications/copy-and-patch.pdf).

See Tools/jit/README.md for more information, including how to install the required build-time tooling. Merry JIT-mas! ;)
2024-01-28 18:52:58 -08:00
Brandt Bucher f6d9e5926b
GH-113464: Add a JIT backend for tier 2 (GH-113465)
Add an option (--enable-experimental-jit for configure-based builds
or --experimental-jit for PCbuild-based ones) to build an
*experimental* just-in-time compiler, based on copy-and-patch (https://fredrikbk.com/publications/copy-and-patch.pdf).

See Tools/jit/README.md for more information on how to install the required build-time tooling.
2024-01-28 18:48:48 -08:00
Furkan Onder f7c05d7ad3
gh-55664: Add warning when creating a type using a namespace dictionary with non-string keys. (GH-105338)
Co-authored-by: Daniel Urban <durban@users.noreply.github.com>
2024-01-29 01:05:29 +02:00
Hugo van Kemenade 3bb6912d88
gh-100734: Add 'Notable change in 3.11.x' to `whatsnew/3.11.rst` (#114657)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-28 20:28:25 +00:00
Bhushan Mohanraj d00fbed68f
Fix indentation in `__post_init__` documentation. (gh-114666) 2024-01-28 15:10:32 -05:00