GeezerVison is showing github.com — Add Python 3.15 argparse ast and runtime updates by JelleZijlstra · Pull Request #15736 · python/typeshed
Conversation
Summary
Add Python 3.15 stdlib updates for argparse, array, ast, faulthandler, re, shelve, tarfile, unittest, warnings, and wave.
Relevant report entries
- Added
argparse suggest_on_error and color parameters, changed the 3.15 suggest_on_error default, removed HelpFormatter(color=...), and added formatter parameters to ArgumentParser.format_usage(), format_help(), and _get_formatter() (CPython PR: gh-140448: Default suggest_on_error to True in argparse.ArgumentParser cpython#140450; source: https://github.com/python/cpython/blob/e81025e6d2e01e38c5a5b656af5739ac9df5ff55/Lib/argparse.py)
- Added
array typecodes for half-precision and complex arrays and widened array.typecodes (CPython PRs: Support half-floats in the array module cpython#146238, Add support for numpy buffer format Zf and Zd cpython#148675; source: https://github.com/python/cpython/blob/main/Modules/arraymodule.c)
- Added
ast.dump(color=...) (CPython PR: Add colour to ast.dump output cpython#148981; source: https://github.com/python/cpython/blob/main/Lib/ast.py)
- Added
ast.Import.is_lazy and ast.ImportFrom.is_lazy for lazy imports (CPython source: https://github.com/python/cpython/blob/e81025e6d2e01e38c5a5b656af5739ac9df5ff55/Parser/Python.asdl)
- Added
faulthandler max_threads parameters (CPython PR: faulthandler: make per-call thread dump cap configurable cpython#149085; source: https://github.com/python/cpython/blob/main/Modules/faulthandler.c)
- Added
dbm.dumb._Database.reorganize, dbm.sqlite3.REORGANIZE, dbm.sqlite3._Database.reorganize, shelve.ShelveError, and shelve serializer/deserializer keyword-only parameters (CPython PRs: DBM Module Vacuuming cpython#134004, Custom unpickler and pickler for the shelve module cpython#99631; sources: https://github.com/python/cpython/blob/main/Lib/dbm/dumb.py, https://github.com/python/cpython/blob/e81025e6d2e01e38c5a5b656af5739ac9df5ff55/Lib/dbm/sqlite3.py, https://github.com/python/cpython/blob/e81025e6d2e01e38c5a5b656af5739ac9df5ff55/Lib/shelve.py)
- Added
re.prefixmatch and Pattern.prefixmatch (CPython PR: Proposal: re.prefixmatch method (alias for re.match) cpython#86519; source: https://github.com/python/cpython/blob/main/Lib/re/__init__.py)
- Added
tarfile.TarFile.__init__(mtime=...) (CPython source: https://github.com/python/cpython/blob/e81025e6d2e01e38c5a5b656af5739ac9df5ff55/Lib/tarfile.py)
- Added
unittest.TestCase.assertLogs(formatter=...) (CPython PR: Expose log format to users in assertLogs cpython#134567; source: https://github.com/python/cpython/blob/main/Lib/unittest/case.py)
- Added
warnings.WarningMessage(module=...) and .module attribute (CPython source: https://github.com/python/cpython/blob/e81025e6d2e01e38c5a5b656af5739ac9df5ff55/Lib/_py_warnings.py)
- Added
wave.WAVE_FORMAT_IEEE_FLOAT, getformat, setformat, and 7-field params; removed marker methods for 3.15 (CPython PRs: wave file module does not support 32bit float format cpython#60729, Remove deprecated mark interface for wave.Wave_{read,write} classes cpython#133873; source: https://github.com/python/cpython/blob/main/Lib/wave.py)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
|
|
__match_args__ = ("key", "value", "generators")
|
|
|
key: expr
|
|
|
value: expr
|
|
|
if sys.version_info >= (3, 15):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
|
|
self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize
|
|
|
) -> Match[bytes] | None: ...
|
|
|
@overload
|
|
|
def prefixmatch(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> Match[AnyStr] | None: ...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm suspicious about this last overload, I think it allows some wrong calls through. But we already have the same for match(), so I'll leave it like this for now.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we just do prefixmatch = match? that's basically the impl
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
|
|
|
|
|
if sys.version_info >= (3, 15):
|
|
|
pass
|
|
|
elif sys.version_info >= (3, 13):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we usually "backport" deprecations? wondering if this can just be a single if sys.version_info <= (3, 13) branch (similar thing above as well)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|