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

__class__ is replaced with the name of the class in the AST #723

Closed
slozier opened this issue Jan 14, 2020 · 1 comment
Closed

__class__ is replaced with the name of the class in the AST #723

slozier opened this issue Jan 14, 2020 · 1 comment

Comments

@slozier
Copy link
Contributor

slozier commented Jan 14, 2020

#721 replaces __class__ with the name of the class in the AST.

import ast
x = """
class test(object):
    def test(self):
        return __class__
"""
a = compile(x, "", "exec", flags=0x400)
assert a.body[0].body[0].body[0].value.id == "__class__"

Related to #722

@slozier
Copy link
Contributor Author

slozier commented Mar 6, 2021

Resolved by #1087

@slozier slozier closed this as completed Mar 6, 2021
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 a pull request may close this issue.

1 participant