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

Capitalized Types not handled properly #126

Closed
Bhargavasomu opened this issue Mar 23, 2019 · 3 comments · Fixed by #127
Closed

Capitalized Types not handled properly #126

Bhargavasomu opened this issue Mar 23, 2019 · 3 comments · Fixed by #127

Comments

@Bhargavasomu
Copy link

What was wrong?

If the type is given as capital letter, then the code is not working (some grammar error). Please see the following code.

from eth_abi.grammar import parse
obj = parse("person[2]")
obj1 = parse("Person[2]")
---------------------------------------------------------------------------
ParseError                                Traceback (most recent call last)
~/ethereum/eth-account/venv/lib/python3.6/site-packages/eth_abi/grammar.py in parse(self, type_str)
    122         try:
--> 123             return super().parse(type_str)
    124         except parsimonious.ParseError as e:

~/ethereum/eth-account/venv/lib/python3.6/site-packages/parsimonious/nodes.py in parse(self, text, pos)
    253         """
--> 254         return self._parse_or_match(text, pos, 'parse')
    255 

~/ethereum/eth-account/venv/lib/python3.6/site-packages/parsimonious/nodes.py in _parse_or_match(self, text, pos, method_name)
    288                     method=method_name))
--> 289         return self.visit(getattr(self.grammar, method_name)(text, pos=pos))
    290 

~/ethereum/eth-account/venv/lib/python3.6/site-packages/parsimonious/grammar.py in parse(self, text, pos)
    114         self._check_default_rule()
--> 115         return self.default_rule.parse(text, pos=pos)
    116 

~/ethereum/eth-account/venv/lib/python3.6/site-packages/parsimonious/expressions.py in parse(self, text, pos)
    119         """
--> 120         node = self.match(text, pos=pos)
    121         if node.end < len(text):

~/ethereum/eth-account/venv/lib/python3.6/site-packages/parsimonious/expressions.py in match(self, text, pos)
    136         if node is None:
--> 137             raise error
    138         return node

ParseError: Rule 'type' didn't match at 'Person[]' (line 1, column 1).

During handling of the above exception, another exception occurred:

ParseError                                Traceback (most recent call last)
<ipython-input-6-ed74617bc5cf> in <module>
----> 1 obj = parse("Person[]")

~/ethereum/eth-account/venv/lib/python3.6/site-packages/eth_abi/grammar.py in parse(self, type_str)
    123             return super().parse(type_str)
    124         except parsimonious.ParseError as e:
--> 125             raise ParseError(e.text, e.pos, e.expr)
    126 
    127 

How can it be fixed?

Fill this section in if you know how this could or should be fixed.

@Bhargavasomu
Copy link
Author

cc @pipermerriam @davesque

@davesque
Copy link
Contributor

Made the above PR to address this. Thanks for pointing it out.

@davesque
Copy link
Contributor

I can cut a new beta release once we get this sorted out.

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 a pull request may close this issue.

2 participants