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

Make __init__.py depend on __file__ conditionally. #1382

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

Conversation

zhxchen17
Copy link

According to https://docs.python.org/3/reference/import.html#__file__ , __file__ is an optional module attribute, and the its availability is decided by the import system. In the edge case where tensorrt is imported as a frozen module (https://docs.python.org/3/c-api/import.html#c.PyImport_ImportFrozenModuleObject), there seems no suitable __file__ attribute to be assigned therefore in this case it's probably better to skip the library loading process.

Signed-off-by: zhxchen17 zhxchen17@fb.com

According to https://docs.python.org/3/reference/import.html#__file__ , `__file__` is an optional module attribute, and the its availability is decided by the import system. In the edge case where tensorrt is imported as a frozen module (https://docs.python.org/3/c-api/import.html#c.PyImport_ImportFrozenModuleObject), there seems no suitable `__file__` attribute to be assigned therefore in this case it's probably better to skip the library loading process.

Signed-off-by: zhxchen17 <zhxchen17@fb.com>
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.

None yet

2 participants