Skip to content

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

Open
zewt wants to merge 1 commit intoLumaPictures:masterfrom
zewt:fix-dir-from-string
Open

Fix dir() for PyNode subclasses in Python 3#442
zewt wants to merge 1 commit intoLumaPictures:masterfrom
zewt:fix-dir-from-string

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

Comments