Commit graph

119014 commits

Author SHA1 Message Date
Victor Stinner
7ba0fd9f87
gh-102304: Fix Py_INCREF() for limited C API 3.9 (#105550)
When Python is built in debug mode (Py_REF_DEBUG macro), Py_INCREF()
and Py_DECREF() of the limited C API 3.9 (and older) now call
Py_IncRef() and Py_DecRef(), since _Py_IncRef() and _Py_DecRef() were
added to Python 3.10.
2023-06-09 09:30:41 +00:00
Nikita Sobolev
947ec7ab02
gh-105545: Remove deprecated MacOSXOSAScript._name (gh-105546) 2023-06-09 08:52:58 +00:00
Victor Stinner
3e525d2212
gh-105396: Deprecate PyImport_ImportModuleNoBlock() function (#105397)
Deprecate the PyImport_ImportModuleNoBlock() function which is just
an alias to PyImport_ImportModule() since Python 3.3.
2023-06-09 10:30:57 +02:00
Erlend E. Aasland
a5f23d4110
CI: Configure macOS build as per updated devguide recommendations (#105533) 2023-06-08 22:26:03 +00:00
Terry Jan Reedy
bb3454c1a7
gh-102832: IDLE - update stackviewer open (#105528)
Use 'last_exc' instead of 'last_value' in 3.12/3.
2023-06-08 17:59:55 -04:00
Irit Katriel
3ee921d84f
gh-102832: IDLE - remove use of deprecated sys.last_xyzs for stackviewer (#103339) 2023-06-08 21:19:05 +01:00
Eric Snow
68dfa49627
gh-100227: Lock Around Modification of the Global Allocators State (gh-105516)
The risk of a race with this state is relatively low, but we play it safe anyway. We do avoid using the lock in performance-sensitive cases where the risk of a race is very, very low.
2023-06-08 14:06:54 -06:00
Nikita Sobolev
4ff5690e59
gh-105332: [Enum] Fix unpickling flags in edge-cases (GH-105348)
* revert enum pickling from by-name to by-value

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-06-08 11:40:15 -07:00
Eric Snow
e822a676f1
gh-100227: Lock Around Adding Global Audit Hooks (gh-105515)
The risk of a race with this state is relatively low, but we play it safe anyway.
2023-06-08 18:38:15 +00:00
Eric Snow
34c63b86d3
gh-104310: Rename the New Function in importlib.util (gh-105255)
The original name wasn't as clear as it could have been. This change includes the following:

* rename the function
* change the default value for "disable_check" to False
* add clues to the docstring that folks should probably not use the function

---------

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2023-06-08 18:19:58 +00:00
Eric Snow
7799c8e678
gh-100227: Lock Around Use of the Global "atexit" State (gh-105514)
The risk of a race with this state is relatively low, but we play it safe anyway.
2023-06-08 18:08:28 +00:00
Pablo Galindo Salgado
6a8b862357
Revert "Move observability-relevant structure fields to the top" (#105512) 2023-06-08 15:59:38 +00:00
Jelle Zijlstra
a8eb7372ee
test_types: Replace raw assert statements (#105500) 2023-06-08 07:46:33 -07:00
Alex Waygood
d213c2990f
Further improve docs for typing.Annotated (#105498) 2023-06-08 14:36:30 +00:00
Mark Shannon
e830289c52
GH-105229: Remove remaining two-codeunit superinstructions (GH-105326)
* Remove LOAD_CONST__LOAD_FAST and LOAD_FAST__LOAD_CONST superinstructions.
2023-06-08 12:35:34 +01:00
Gabriele N. Tornetta
410c2f13e5
Move observability-relevant structure fields to the top (#105271) 2023-06-08 11:41:24 +01:00
Nikita Sobolev
9d35a71a76
gh-105431: Remove unused stuff from test_typing.NewTypeTests (#105432) 2023-06-08 07:30:42 +01:00
Dong-hee Na
aa5b762bd3
gh-104635: Eliminate redundant STORE_FAST instructions in the compiler (gh-105320) 2023-06-08 08:39:56 +09:00
Barney Gale
ffeaec7e60
GH-104996: Defer joining of pathlib.PurePath() arguments. (GH-104999)
Joining of arguments is moved to `_load_parts`, which is called when a
normalized path is needed.
2023-06-07 23:27:06 +01:00
Alex Waygood
f5df347fcf
gh-103171: Forward-port new tests for runtime-checkable protocols dec orated with @final (#105473)
Forward-port of the tests that were added to the 3.11 branch in #105445
2023-06-07 22:25:17 +00:00
Kirill Podoprigora
264a0110ff
gh-105390: Add explicit type cast (#105466) 2023-06-07 20:20:43 +00:00
neonene
5394bf92aa
gh-94673: Ensure subtypes are readied only once in math.trunc() (gh-105465)
Fixes a typo in d2e2e53.
2023-06-07 13:46:00 -06:00
Alex Waygood
fbdee000de
gh-90015: Document that PEP-604 unions do not support forward references (#105366) 2023-06-07 18:26:23 +01:00
Guido van Rossum
c85be33acc
gh-104610: Stop looking for PREDICT() in the cases generator (#105459)
We no longer use `PREDICT()`, it doesn't have any benefits.
2023-06-07 17:00:10 +00:00
Raymond Hettinger
f339ec5ddf
Fix grammar and improve clarity for an deprecation message. (GH-105457) 2023-06-07 11:29:04 -05:00
Mark Shannon
064de0e3fc
GH-104610: Remove the use of PREDICT macros. (GH-104651) 2023-06-07 17:04:53 +01:00
Alex Waygood
d63a7c3694
typing: Improve documentation of generic classes and aliases (#105369) 2023-06-07 14:02:40 +00:00
Nikita Sobolev
76883af6bf
gh-105437: Improve tests of type params names for PEP 695 (#105438) 2023-06-07 06:44:47 -07:00
Nikita Sobolev
18309ad94b
gh-105430: Remove typing._Immutable unused internal helper (#105434) 2023-06-07 06:43:00 -07:00
Alex Waygood
e26d296984
gh-97797: Improve documentation for typing.Annotated (#105365) 2023-06-07 06:35:34 -07:00
Alex Waygood
c5ec51ec8f
Improve docs for typing.TypeAlias (#105372) 2023-06-07 06:31:02 -07:00
Pablo Galindo Salgado
7279fb6408
gh-105435: Fix spurious NEWLINE token if file ends with comment without a newline (#105442) 2023-06-07 13:31:48 +01:00
Erlend E. Aasland
a24a780d93
gh-105375: Improve error handling in sqlite3 collation callback (#105412)
Check for error after each call to PyUnicode_FromStringAndSize().
2023-06-07 13:10:28 +02:00
Pablo Galindo Salgado
ffd2654550
gh-105390: Correctly raise TokenError instead of SyntaxError for tokenize errors (#105399) 2023-06-07 12:04:40 +01:00
Erlend E. Aasland
27c68a6d8f
gh-89886: Use Autoconf quadrigraphs where appropriate (#105226) 2023-06-07 09:11:44 +02:00
Jeffery To
990cb3676c
gh-104692: Include commoninstall as a prerequisite for bininstall (#104693)
This ensures that `commoninstall` is completed before `bininstall` is
started when parallel builds are used (`make -j install`), and so the
`python3` symlink is only installed after all standard library modules
are installed.

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2023-06-07 08:59:56 +02:00
Alex Waygood
81c81328a4
Improve code examples in typing.rst (#105346) 2023-06-07 07:47:11 +01:00
Alex Waygood
d7645124f5
typing docs: Make the PEPs list an expandable section, hidden by default (#105353)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-06-07 07:37:02 +01:00
achhina
3e7316d7e8
GH-95088: Clarify rules for parsing an item key for format strings (#103779)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-06-06 19:01:36 -07:00
Alex Waygood
9a89f1bf1e
gh-105286: Further improvements to typing.py docstrings (#105363) 2023-06-06 17:21:16 -07:00
Alex Waygood
5f65ff0370
typing.NewType docs: the future performance improvements are now in the past (#105354) 2023-06-06 17:18:09 -07:00
Barney Gale
24af45172f
GH-102613: Fast recursive globbing in pathlib.Path.glob() (GH-104512)
This commit introduces a 'walk-and-match' strategy for handling glob patterns that include a non-terminal `**` wildcard, such as `**/*.py`. For this example, the previous implementation recursively walked directories using `os.scandir()` when it expanded the `**` component, and then **scanned those same directories again** when expanded the `*.py` component. This is wasteful.

In the new implementation, any components following a `**` wildcard are used to build a `re.Pattern` object, which is used to filter the results of the recursive walk. A pattern like `**/*.py` uses half the number of `os.scandir()` calls; a pattern like `**/*/*.py` a third, etc.

This new algorithm does not apply if either:

1. The *follow_symlinks* argument is set to `None` (its default), or
2. The pattern contains `..` components.

In these cases we fall back to the old implementation.

This commit also replaces selector classes with selector functions. These generators directly yield results rather calling through to their successors. A new internal `Path._glob()` method takes care to chain these generators together, which simplifies the lazy algorithm and slightly improves performance. It should also be easier to understand and maintain.
2023-06-06 23:50:36 +01:00
Victor Stinner
2587b9f64e
gh-105382: Remove urllib.request cafile parameter (#105384)
Remove cafile, capath and cadefault parameters of the
urllib.request.urlopen() function, deprecated in Python 3.6.
2023-06-06 21:17:45 +00:00
Victor Stinner
94d5f9827d
gh-105407: Remove unused imports in the stdlib (#105411) 2023-06-06 21:13:24 +00:00
Victor Stinner
d1b0015ea8
gh-105407: Remove unused imports in Tools/c-analyzer/ (#105410) 2023-06-06 21:08:48 +00:00
Victor Stinner
b8c79b2b98
gh-105407: Remove unused imports in tools (#105409) 2023-06-06 22:51:26 +02:00
Victor Stinner
ae319e4b43
gh-105407: Remove unused imports in tests (#105408) 2023-06-06 22:50:43 +02:00
Victor Stinner
d3a0eacbf3
gh-82180: Update math.factorial(float) doc for Python 3.10 (#105385) 2023-06-06 21:47:57 +02:00
Victor Stinner
dfe9fc1904
gh-105373: Fix decimal documentation formatting (#105395)
The deprecation is on decimal.HAVE_THREADS, not on the whole module.
2023-06-06 21:43:35 +02:00
Raymond Hettinger
423459be2f
sliding_window() recipe: Raise ValueError for non-positive window sizes. Add more tests. (GH-105403) 2023-06-06 13:44:45 -05:00