Skip to content

[stdlib] Mark constants as Final #14577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 15, 2025
Merged

[stdlib] Mark constants as Final #14577

merged 4 commits into from
Aug 15, 2025

Conversation

donBarbos
Copy link
Contributor

This PR doesn’t aim to be exhaustive; I intentionally kept the scope limited to avoid making it too large. I expect to follow up with another PR to mark the remaining constants as Final.
And I followed the strategy of adding values only for constants whose values are explicitly defined and not simply bindings from any C library.

@donBarbos donBarbos marked this pull request as draft August 15, 2025 10:30

This comment has been minimized.

@AlexWaygood
Copy link
Member

it wouldn't necessarily be a bad thing for that error to be emitted on spack FWIW. There's already a comment in the code there that notes that they probably shouldn't be monkeypatching the urllib internals; they're already aware that they should be put on the naughty step there: https://github.com/spack/spack/blob/95a332eb93f54edae63708db8225c625f203d86e/lib/spack/spack/util/url.py#L88-L96

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

spack (https://github.com/spack/spack)
+ lib/spack/spack/util/url.py:91: error: Cannot assign to final name "uses_netloc"  [misc]
+ lib/spack/spack/util/url.py:92: error: Cannot assign to final name "uses_relative"  [misc]
+ lib/spack/spack/util/url.py:95: error: Cannot assign to final name "uses_netloc"  [misc]
+ lib/spack/spack/util/url.py:96: error: Cannot assign to final name "uses_relative"  [misc]

@donBarbos donBarbos marked this pull request as ready for review August 15, 2025 11:15
@srittau srittau merged commit 85a787b into python:main Aug 15, 2025
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants