Skip to content
This repository was archived by the owner on Jun 24, 2026. It is now read-only.

Fix bug, check for dunder#1303

Closed
offlinemark wants to merge 1 commit into
masterfrom
dev-acc-under
Closed

Fix bug, check for dunder#1303
offlinemark wants to merge 1 commit into
masterfrom
dev-acc-under

Conversation

@offlinemark

@offlinemark offlinemark commented Dec 13, 2018

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

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

@disconnect3d

disconnect3d commented Dec 17, 2018

Copy link
Copy Markdown
Member

I restarted the build and it still hangs.

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


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

@disconnect3d disconnect3d Dec 17, 2018

Copy link
Copy Markdown
Member

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

@disconnect3d disconnect3d Dec 17, 2018

Copy link
Copy Markdown
Member

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants