Skip to content
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

Prefer os.path.exists over os.stat try-catch #2463

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Jan 17, 2025

Makes checking the existence of a path more idiomatic.
Reduces use of try-catch for logical flow.
Simplifies some code.
Solves a few "possibly unbound/undefined" variables as seen by type-checkers.

@@ -18,13 +18,15 @@

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module has been marked as deprecated for the past 18 years. A comment set it for removal around "2009 or so".
Would it be better to just remove it?

However it is used by win32/scripts/regsetup.py (checks the registry after Python registration). I'm not sure about a modern use case for the regsetup.py script either.

Fixes a few reportPossiblyUnboundVariable and possibly-undefined
@Avasam Avasam force-pushed the os.path.exists-over-os.stat branch from fd951fb to 40caf46 Compare January 17, 2025 02:58
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.

1 participant