Skip to content

Fix dir() for PyNode subclasses in Python 3 #442

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

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

Conversation

zewt
Copy link

@zewt zewt commented May 10, 2021

Python 3 has a dir on str, which means any class that subclasses it will show
wrong results for dir(). Work around this by removing str.dir from ProxyUnicode
so it uses the normal default behavior.

Before, the output of print(dir(pm.PyNode('persp'))) was the same as dir(''). This
brings it back to what it was in Python 2.

Python 3 has a __dir__ on str, which means any class that subclasses it will show
wrong results for dir().  Work around this by removing str.__dir__ from ProxyUnicode
so it uses the normal default behavior.

Before, the output of print(dir(pm.PyNode('persp'))) was the same as dir('').  This
brings it back to what it was in Python 2.
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.

1 participant