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

ensure parser has opc attribute #417

Closed
wants to merge 1 commit into from

Conversation

jameshilliard
Copy link
Contributor

Note sure if this is correct fix but seems to fix:

uncompyle6/parsers/reducecheck/while1stmt.py", line 45, in while1stmt
    if self.opc.opmap.get(token.kind, "LOAD_CONST") in self.opc.JUMP_OPS:
AttributeError: 'Python36Parser' object has no attribute 'opc'

@rocky
Copy link
Owner

rocky commented Nov 5, 2022

207dc0b should address this. opc is a field off of the token, not the parse object.

@rocky rocky closed this Nov 5, 2022
@jameshilliard
Copy link
Contributor Author

207dc0b should address this. opc is a field off of the token, not the parse object

Still seeing an error:

uncompyle6/parsers/reducecheck/while1stmt.py", line 45, in while1stmt
    if token.opc.opmap.get(token.kind, "LOAD_CONST") in self.opc.JUMP_OPS:
AttributeError: 'Python36Parser' object has no attribute 'opc'

@jameshilliard
Copy link
Contributor Author

Maybe needs?:

diff --git a/uncompyle6/parsers/reducecheck/while1stmt.py b/uncompyle6/parsers/reducecheck/while1stmt.py
index 1570f1bb..3ad43307 100644
--- a/uncompyle6/parsers/reducecheck/while1stmt.py
+++ b/uncompyle6/parsers/reducecheck/while1stmt.py
@@ -42,7 +42,7 @@ def while1stmt(self, lhs, n, rule, ast, tokens, first, last):
         # token could be a pseudo-op like "LOAD_STR", which is not in
         # self.opc.  We will replace that with LOAD_CONST as an
         # example of an instruction that is not in self.opc.JUMP_OPS
-        if token.opc.opmap.get(token.kind, "LOAD_CONST") in self.opc.JUMP_OPS:
+        if token.opc.opmap.get(token.kind, "LOAD_CONST") in token.opc.JUMP_OPS:
             if token.attr >= loop_end_offset:
                 return True

@rocky
Copy link
Owner

rocky commented Nov 5, 2022

Ok - give some simple bytecode that when decompiled produces this and file info in a bug report.

@jameshilliard
Copy link
Contributor Author

Ok - give some simple bytecode that when decompiled produces this and file info in a bug report.

See bytecode in #420, also added details for another(unclear if related) error there.

@rocky
Copy link
Owner

rocky commented Nov 6, 2022

Ok thanks for more of the context.

@jameshilliard jameshilliard deleted the while1stmt-opc branch November 6, 2022 15:45
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