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

Fix for issue #136 #137

Merged
merged 6 commits into from
May 12, 2019
Merged

Fix for issue #136 #137

merged 6 commits into from
May 12, 2019

Conversation

esupoff
Copy link
Contributor

@esupoff esupoff commented May 10, 2019

Fixes #136

@esupoff esupoff changed the title Fix fox issue #136 Fix for issue #136 May 10, 2019
Copy link
Owner

@berkerpeksag berkerpeksag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for improving astor!

I don't see anything wrong with this change. Could you please add a release note and a simple test?

Also, do you still have some output from the debugging session? I'm curious to see how this breaks your workflow.

@esupoff
Copy link
Contributor Author

esupoff commented May 11, 2019

Hmm... capturing a PyCharm debugging session would be a bit tedious... I hope a simpler example would suffice:

$ pip3.7 install astor
Collecting astor
  Using cached https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Installing collected packages: astor
Successfully installed astor-0.7.1

$ python3.7
Python 3.7.2 (default, Feb 13 2019, 02:55:09)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import astor
>>> x = astor.TreeWalk()
>>> x.__dict__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: descriptor '__dict__' for 'MetaFlatten' objects doesn't apply to 'TreeWalk' object

$ pip3.7 install --upgrade git+https://github.com/esupoff/astor.git@0.7.1-z
Collecting git+https://github.com/esupoff/astor.git@0.7.1-z
  Cloning https://github.com/esupoff/astor.git (to revision 0.7.1-z) to /tmp/pip-req-build-by761dee
  Running command git clone -q https://github.com/esupoff/astor.git /tmp/pip-req-build-by761dee
Installing collected packages: astor
  Found existing installation: astor 0.7.1
    Uninstalling astor-0.7.1:
      Successfully uninstalled astor-0.7.1
  Running setup.py install for astor ... done
Successfully installed astor-0.7.1

$ python3.7
python3.7
Python 3.7.2 (default, Feb 13 2019, 02:55:09)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import astor
>>> x = astor.TreeWalk()
>>> x.__dict__
{'nodestack': [], 'pre_handlers': {}, 'post_handlers': {}}

Also, without this patch in IPython you couldn't do this:

Python 3.7.2 (default, Feb 13 2019, 02:55:09)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import astor

In [2]: x = astor.TreeWalk()

In [3]: x.   # <- hit Tab here
           nodestack     parent_name   pre_handlers  setup()
           parent        post_handlers replace()     walk()

@berkerpeksag berkerpeksag merged commit c5d5b3c into berkerpeksag:master May 12, 2019
@berkerpeksag
Copy link
Owner

Thank you!

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.

TypeError: descriptor '__dict__' for 'MetaFlatten' objects doesn't apply to 'TreeWalk' object
2 participants