Commit Graph

117448 Commits

Author SHA1 Message Date
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
Victor Stinner 6c54e5d721
gh-105376: Remove logging.Logger.warn() method (#105377) 2023-06-06 18:35:51 +00:00
Victor Stinner 221d703498
gh-104783: locale.getlocale() calls sys.getfilesystemencoding() (#105401)
locale.getlocale() always calls sys.getfilesystemencoding(), instead
of calling it only once.
2023-06-06 18:19:40 +00:00
Victor Stinner 2b8e6e5712
gh-94172: Update keyfile removal documentation (#105392)
Remove the "deprecated:: 3.6" markup, since the parameters (like
keyfile and certfile) got removed in Python 3.12.
2023-06-06 20:14:06 +02:00
Nikita Sobolev 3907de12b5
gh-92658: Fix typo in docs and tests for `HV_GUID_PARENT` (GH-105267) 2023-06-06 17:11:19 +01:00
Victor Stinner b1a91d26c6
gh-104783: locale.getencoding() fallback uses FS encoding (#105381)
The locale.getencoding() function now uses
sys.getfilesystemencoding() if _locale.getencoding() is missing,
instead of calling locale.getdefaultlocale().
2023-06-06 16:55:21 +02:00
Victor Stinner 3a975b5e92
gh-102304: Document Py_INCREF() change in What's New in Python 3.12 (#105389)
Not in Python 3.13.
2023-06-06 16:50:58 +02:00
Victor Stinner 04181965cf
gh-105156: Update Unicode C API: remove deprecation (#105379)
_PyUnicode_ToLowercase(), _PyUnicode_ToUppercase(),
_PyUnicode_ToTitlecase() are no longer deprecated in the
documentation. It's no longer needed since they now use Py_UCS4 type,
rather than the deprecated Py_UNICODE type.
2023-06-06 16:42:49 +02:00
Victor Stinner 0cb6b9b0db
gh-104783: Remove locale.resetlocale() function (#104784) 2023-06-06 14:55:50 +02:00
Victor Stinner c7bf74bacd
gh-105268: Add _Py_FROM_GC() function to pycore_gc.h (#105362)
* gcmodule.c reuses _Py_AS_GC(op) for AS_GC()
* Move gcmodule.c FROM_GC() implementation to a new _Py_FROM_GC()
  static inline function in pycore_gc.h.
* _PyObject_IS_GC(): only get the type once
* gc_is_finalized(à) and PyObject_GC_IsFinalized() use
  _PyGC_FINALIZED(), instead of _PyGCHead_FINALIZED().
* Remove _Py_CAST() in pycore_gc.h: this header file is not built
  with C++.
2023-06-06 14:44:48 +02:00
dependabot[bot] 963099ebd9
build(deps): bump requests from 2.29.0 to 2.31.0 in /Doc (#105368)
Bumps [requests](https://github.com/psf/requests) from 2.29.0 to 2.31.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.29.0...v2.31.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-06 14:35:51 +02:00
Pablo Galindo Salgado c0a6ed3934
gh-105259: Ensure we don't show newline characters for trailing NEWLINE tokens (#105364) 2023-06-06 12:52:16 +01:00
Victor Stinner 0202aa002e
gh-102304: Fix up Simple ABI doc (GH-105351) 2023-06-06 13:03:51 +02:00
Christopher Chavez 2c49c759e8
gh-104411: Update test_getint for Tcl 9.0 (GH-104412) 2023-06-06 13:01:22 +03:00
Victor Stinner 8ddf0dd264
gh-105268: Remove _PyGC_FINALIZED() macro (#105350)
Remove the old private, undocumented and untested _PyGC_FINALIZED()
macro which was kept for backward compatibility with Python 3.8 and
older.
2023-06-06 11:54:23 +02:00
Petr Viktorin 49fe2e4af7
Add myself as codeowner for Limited API/Stable ABI, remove from *import* (GH-105349)
This should set up more relevant notifications for me.
2023-06-06 09:33:40 +00:00
Erlend E. Aasland e01c4de35d
gh-90005: Don't link with libbsd if not needed (#105236)
The regression was introduced with commit 5b946cada.
Restore pre gh-29696 behaviour.
2023-06-06 09:33:01 +00:00