Drop Python 2 compatibility code from bundled decorator module#1196
Open
shekhargit1912 wants to merge 1 commit into
Open
Drop Python 2 compatibility code from bundled decorator module#1196shekhargit1912 wants to merge 1 commit into
shekhargit1912 wants to merge 1 commit into
Conversation
The vendored decorator.py still carried Python 2/3 branching (a getfullargspec shim, formatargspec-based signature building, and the py2-only get_init variant) even though the project now requires Python >= 3.9. Removing the dead Python 2 paths leaves the Python 3 behavior unchanged. Fixes prometheus#1107 Signed-off-by: shekhargit1912 <shekharchaugule302@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Removes the Python 2/3 compatibility branching from the vendored
prometheus_client/decorator.py: thegetfullargspecshim class, theformatargspec-based signature-building path, and the Python 2-onlyget_initvariant.Why
pyproject.tomlrequirespython_requires = ">=3.9", so these Python 2 code paths have been dead for years. This addresses the "at least upgrade it" part of #1107 by cleaning up the vendored copy in place. A full unbundle to an externaldecoratordependency is a separate call for maintainers to make, so this PR doesn't attempt that.Testing
tox -e flake8passestox -e py310: 379 passed, 35 failed, 12 skipped, 6 errors -- identical to the pre-change baseline (remaining failures are pre-existing and Windows-specific, intest_multiprocess.py/test_wsgi.py, unrelated to this change)Fixes #1107