You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Pypy 2.7 fixes
* pypy doesn't seem to grok sys.stdout.flush() sometimes? * pypy has extra come_froms for return_if_stmt
This commit is contained in:
@@ -315,10 +315,19 @@ def main(in_base, out_base, files, codes, outfile=None,
|
|||||||
sys.stdout.write("%s\r" %
|
sys.stdout.write("%s\r" %
|
||||||
status_msg(do_verify, tot_files, okay_files, failed_files,
|
status_msg(do_verify, tot_files, okay_files, failed_files,
|
||||||
verify_failed_files, do_verify))
|
verify_failed_files, do_verify))
|
||||||
|
try:
|
||||||
|
# FIXME: Something is weird with Pypy here
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if current_outfile:
|
if current_outfile:
|
||||||
sys.stdout.write("\n")
|
sys.stdout.write("\n")
|
||||||
|
try:
|
||||||
|
# FIXME: Something is weird with Pypy here
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
pass
|
||||||
return (tot_files, okay_files, failed_files, verify_failed_files)
|
return (tot_files, okay_files, failed_files, verify_failed_files)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3,7 +3,8 @@
|
|||||||
# Copyright (c) 2000-2002 by hartmut Goebel <hartmut@goebel.noris.de>
|
# Copyright (c) 2000-2002 by hartmut Goebel <hartmut@goebel.noris.de>
|
||||||
|
|
||||||
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
||||||
from uncompyle6.parser import PythonParserSingle
|
from xdis import next_offset
|
||||||
|
from uncompyle6.parser import PythonParserSingle, nop_func
|
||||||
from uncompyle6.parsers.parse2 import Python2Parser
|
from uncompyle6.parsers.parse2 import Python2Parser
|
||||||
|
|
||||||
class Python27Parser(Python2Parser):
|
class Python27Parser(Python2Parser):
|
||||||
@@ -196,6 +197,13 @@ class Python27Parser(Python2Parser):
|
|||||||
POP_BLOCK LOAD_CONST COME_FROM suite_stmts_opt
|
POP_BLOCK LOAD_CONST COME_FROM suite_stmts_opt
|
||||||
END_FINALLY
|
END_FINALLY
|
||||||
""")
|
""")
|
||||||
|
if 'PyPy' in customize:
|
||||||
|
# PyPy-specific customizations
|
||||||
|
self.addRule("""
|
||||||
|
return_if_stmt ::= ret_expr RETURN_END_IF come_froms
|
||||||
|
""", nop_func)
|
||||||
|
|
||||||
|
|
||||||
super(Python27Parser, self).customize_grammar_rules(tokens, customize)
|
super(Python27Parser, self).customize_grammar_rules(tokens, customize)
|
||||||
self.check_reduce['and'] = 'AST'
|
self.check_reduce['and'] = 'AST'
|
||||||
# self.check_reduce['or'] = 'AST'
|
# self.check_reduce['or'] = 'AST'
|
||||||
|
Reference in New Issue
Block a user