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 bug, check for dunder #1303

Closed
wants to merge 1 commit into from
Closed

Fix bug, check for dunder #1303

wants to merge 1 commit into from

Conversation

offlinemark
Copy link
Contributor

@offlinemark offlinemark commented Dec 13, 2018

allow sol funcs with 1 underscore, which is consistent with the above check in add_function


This change is Reviewable

allow sol funcs with 1 underscore, which is consistent with the above check in add_function
@disconnect3d
Copy link
Member

For some reason travis hung :(
Can we also add a test for it?

@disconnect3d
Copy link
Member

disconnect3d commented Dec 17, 2018

I restarted the build and it still hangs.

Can it be that we fall in some infinite recursion here?

@@ -102,7 +102,7 @@ def __getattribute__(self, name):
contract_account.add(1000)

"""
if not name.startswith('_'):
if not name.startswith('__'):
Copy link
Member

@disconnect3d disconnect3d Dec 17, 2018

Choose a reason for hiding this comment

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

This check is wrong - the __private attributes are a syntax sugar for _CLS__private where CLS is the name of the class where a method that uses __private is defined.

In [9]: class A:
   ...:     def foo_invoker(self):
   ...:         print("A.foo_invoker")
   ...:         self.__foo()
   ...:
   ...:     def __foo(self):
   ...:         print("A.foo")
   ...:
   ...:     def __getattribute__(self, attr):
   ...:         print(f"Getting {attr}")
   ...:         return object.__getattribute__(self, attr)
   ...:

In [10]: A().foo_invoker()
Getting foo_invoker
A.foo_invoker
Getting _A__foo
A.foo

Copy link
Member

@disconnect3d disconnect3d Dec 17, 2018

Choose a reason for hiding this comment

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

On the other hand, this would still need to check for all protected attributes (the one starting with _) that the EVMAccount/EVMContract defines.

I've proposed a better fix for the issue we want to fix in #1306.

@offlinemark offlinemark deleted the dev-acc-under branch December 17, 2018 18:27
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.

2 participants