Avoid looking at __name__ attribute in black.linegen.run_transformer
#2432
Labels
C: cleanup
Refactoring and removing dust :)
C: maintenance
Related to project maintenance, e.g. CI, testing, policy changes, releases
Right the transformer code looks at the transformer's
__name__
attribute when deciding to return early:black/src/black/linegen.py
Lines 964 to 967 in ef7c45f
This is kinda hacky and becomes quite a problem when integrating mypyc since nested functions don't keep that attribute due a bug (mypyc/mypyc#884). The current workaround is to dynamtically create a wrapping class at runtime (via type() mind you 🙃) which do keep their
__name__
attribute. Let's avoid this entire situation if feasible ^^Additional context:
by @JelleZijlstra in #2431 (comment)
by @JelleZijlstra in #1621 (comment)
The text was updated successfully, but these errors were encountered: