-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Adapt to removed stdlib APIs in Python 3.12. #2170
Adapt to removed stdlib APIs in Python 3.12. #2170
Conversation
This was proved out in my Python 3.12 branch here: #2168 |
pex/pex_builder.py
Outdated
from importlib.abc import Loader | ||
if isinstance(__loader__, Loader): | ||
__entry_point__ = __entry_point_from_filename__(__loader__.get_filename()) | ||
except ImportError: |
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.
This order is a bit better since it stresses the code now as well as getting rid of warnings under newer Pythons. It penalizes existing Python 2.7 users with a small speed bump for the cold cache case in the ~ms range though.
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.
Alright - took the feedback but went further given the prompt to think.
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.
Thank you for splitting this out. It may be worth a comment in the new code explaining which branch corresponds to which Python versions.
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.
Agree with Eric re documenting the control flow
…3.12/deprecated-api-use-prep
if hasattr(__loader__, 'archive'): | ||
__entry_point__ = __loader__.archive | ||
elif isinstance(__loader__, ImpLoader): | ||
elif hasattr(__loader__, 'get_filename'): |
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.
Closes #2137