Skip to content

Set __file__ for the main source file (e.g. code.py, main.py) #1580

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 21, 2019

Conversation

cpforbes
Copy link

Fixes #1572
This is based on code from the unix port:

if (input_kind == MP_PARSE_FILE_INPUT) {
mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
}

@ladyada
Copy link
Member

ladyada commented Feb 21, 2019

wow! thanks - will try it :)

@tannewt tannewt self-assigned this Feb 21, 2019
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.

Works great! Thank you @cpforbes!

@tannewt tannewt merged commit 3e877e0 into adafruit:master Feb 21, 2019
@ladyada
Copy link
Member

ladyada commented Feb 24, 2019

tested and works great - thanks @cpforbes !!

@cpforbes cpforbes deleted the cpf-1572 branch March 8, 2019 15:13
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