Skip to content

Restore setting __file__ in parse_compile_execute #8921

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 1 commit into from
Feb 15, 2024

Conversation

jepler
Copy link

@jepler jepler commented Feb 14, 2024

This seems to have been lost, possibly in a merge.

Closes: #8881

This seems to have been lost, possibly in a merge.

Closes: adafruit#8881
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thank you!

@jepler
Copy link
Author

jepler commented Feb 14, 2024

I tested with this in code.py and an empty sub.py:

print("file", __file__, "name", __name__)
import sub
print("file", sub.__file__, "name", sub.__name__)

prints:

code.py output:
file code.py name __main__
file sub.py name sub

@dhalbert dhalbert merged commit 5adffa2 into adafruit:main Feb 15, 2024
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.

AttributeError: 'module' object has no attribute '__file__'
3 participants