You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Merge branch 'master' into python-2.4
This commit is contained in:
32
ChangeLog
32
ChangeLog
@@ -1,13 +1,41 @@
|
||||
2017-08-15 rocky <rb@dustyfeet.com>
|
||||
|
||||
* : commit c54a47b15f85be50d2278aa79fd514eb08580e65 Author: rocky
|
||||
<rb@dustyfeet.com> Date: Tue Aug 15 10:47:12 2017 -0400
|
||||
|
||||
2017-08-15 rocky <rb@dustyfeet.com>
|
||||
|
||||
* __pkginfo__.py, pytest/validate.py, uncompyle6/parser.py,
|
||||
uncompyle6/scanner.py: Misc cleanups... remove code now in xdis require at least xdis 3.5.4 PyPy tolerance
|
||||
in validate testing
|
||||
|
||||
2017-08-13 rocky <rb@dustyfeet.com>
|
||||
|
||||
* ChangeLog, README.rst, __pkginfo__.py, pytest/test_basic.py,
|
||||
uncompyle6/parser.py, uncompyle6/scanner.py: Allow version to be
|
||||
string... in get_python_parser and get_scanner
|
||||
|
||||
2017-08-13 rocky <rb@dustyfeet.com>
|
||||
|
||||
* pytest/test_basic.py, uncompyle6/parser.py, uncompyle6/scanner.py:
|
||||
Allow 3-part version string lookups, e.g 2.7.1 We allow a float here, but if passed a string like '2.7'. or
|
||||
'2.7.13', accept that in looking up either a scanner or a parser.
|
||||
|
||||
2017-08-10 rocky <rb@dustyfeet.com>
|
||||
|
||||
* : commit c38dc61021368f11e95cef70ee77e4a43dba1598 Author: rocky
|
||||
<rb@dustyfeet.com> Date: Wed Aug 9 22:01:59 2017 -0400
|
||||
* : commit 503039ab51f004cca27a9da43ff22b031cc486dc Author: rocky
|
||||
<rb@dustyfeet.com> Date: Thu Aug 10 09:41:48 2017 -0400
|
||||
|
||||
2017-08-09 rocky <rb@dustyfeet.com>
|
||||
|
||||
* ChangeLog, NEWS, README.rst, __pkginfo__.py,
|
||||
uncompyle6/semantics/consts.py, uncompyle6/version.py: Get ready for
|
||||
release 2.11.3 need xdis 3.5.1 for now. Adjust for xdis "is-not" which we need as
|
||||
"is not"
|
||||
|
||||
2017-08-09 rocky <rb@dustyfeet.com>
|
||||
|
||||
* uncompyle6/semantics/consts.py: xdis "is not" is now "is-not"
|
||||
|
||||
2017-08-09 rocky <rb@dustyfeet.com>
|
||||
|
||||
|
2
Makefile
2
Makefile
@@ -36,6 +36,8 @@ check-2.7 check-3.3 check-3.4: pytest
|
||||
check-3.0 check-3.1 check-3.2 check-3.5 check-3.6:
|
||||
$(MAKE) -C test $@
|
||||
|
||||
check-3.7: pytest
|
||||
|
||||
#:Tests for Python 2.6 (doesn't have pytest)
|
||||
check-2.4 check-2.5 check-2.6:
|
||||
$(MAKE) -C test $@
|
||||
|
2
NEWS
2
NEWS
@@ -5,7 +5,7 @@ uncompyle6 2.11.4 2017-08-15
|
||||
* unpin 3.5.1. xdis 3.5.4 has been releasd and fixes the problems we had. Use that.
|
||||
* some routnes here moved to xdis. Use the xdis version
|
||||
* README.rst: Link typo Name is trepan2 now not trepan
|
||||
* xdis-forched change adjust for COMPARE_OP "is-not" in
|
||||
* xdis-forced change adjust for COMPARE_OP "is-not" in
|
||||
semanatic routines. We need "is not".
|
||||
* Some PyPy tolerance in validate testing.
|
||||
* Some pyston tolerance
|
||||
|
@@ -12,7 +12,7 @@ Introduction
|
||||
|
||||
*uncompyle6* translates Python bytecode back into equivalent Python
|
||||
source code. It accepts bytecodes from Python version 1.5, and 2.1 to
|
||||
3.6 or so, including PyPy bytecode and Dropbox's Python 2.5 bytecode.
|
||||
3.7 or so, including PyPy bytecode and Dropbox's Python 2.5 bytecode.
|
||||
|
||||
Why this?
|
||||
---------
|
||||
|
@@ -40,7 +40,7 @@ entry_points = {
|
||||
]}
|
||||
ftp_url = None
|
||||
install_requires = ['spark-parser >= 1.6.1, < 1.7.0',
|
||||
'xdis >= 3.5.4, < 3.6.0']
|
||||
'xdis >= 3.5.5, < 3.6.0']
|
||||
license = 'MIT'
|
||||
mailing_list = 'python-debugger@googlegroups.com'
|
||||
modname = 'uncompyle6'
|
||||
|
41
uncompyle6/parsers/parse37.py
Normal file
41
uncompyle6/parsers/parse37.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2017 Rocky Bernstein
|
||||
"""
|
||||
spark grammar differences over Python 3.6 for Python 3.7
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
from uncompyle6.parser import PythonParserSingle
|
||||
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
|
||||
from uncompyle6.parsers.parse36 import Python37Parser
|
||||
|
||||
class Python36Parser(Python35Parser):
|
||||
|
||||
def __init__(self, debug_parser=PARSER_DEFAULT_DEBUG):
|
||||
super(Python37Parser, self).__init__(debug_parser)
|
||||
self.customized = {}
|
||||
|
||||
|
||||
class Python37ParserSingle(Python37Parser, PythonParserSingle):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Check grammar
|
||||
p = Python37Parser()
|
||||
p.checkGrammar()
|
||||
from uncompyle6 import PYTHON_VERSION, IS_PYPY
|
||||
if PYTHON_VERSION == 3.7:
|
||||
lhs, rhs, tokens, right_recursive = p.checkSets()
|
||||
from uncompyle6.scanner import get_scanner
|
||||
s = get_scanner(PYTHON_VERSION, IS_PYPY)
|
||||
opcode_set = set(s.opc.opname).union(set(
|
||||
"""JUMP_BACK CONTINUE RETURN_END_IF COME_FROM
|
||||
LOAD_GENEXPR LOAD_ASSERT LOAD_SETCOMP LOAD_DICTCOMP LOAD_CLASSNAME
|
||||
LAMBDA_MARKER RETURN_LAST
|
||||
""".split()))
|
||||
remain_tokens = set(tokens) - opcode_set
|
||||
import re
|
||||
remain_tokens = set([re.sub('_\d+$', '', t) for t in remain_tokens])
|
||||
remain_tokens = set([re.sub('_CONT$', '', t) for t in remain_tokens])
|
||||
remain_tokens = set(remain_tokens) - opcode_set
|
||||
print(remain_tokens)
|
||||
# print(sorted(p.rule2name.items()))
|
@@ -3,7 +3,7 @@
|
||||
"""
|
||||
All the crazy things we have to do to handle Python functions
|
||||
"""
|
||||
from xdis.code import iscode
|
||||
from xdis.code import iscode, code_has_star_arg, code_has_star_star_arg
|
||||
from uncompyle6.scanner import Code
|
||||
from uncompyle6.parsers.astnode import AST
|
||||
from uncompyle6.semantics.parser_error import ParserError
|
||||
@@ -40,17 +40,6 @@ def find_none(node):
|
||||
return True
|
||||
return False
|
||||
|
||||
# FIXME: put this in xdis
|
||||
def code_has_star_arg(code):
|
||||
"""Return True iff
|
||||
the code object has a variable positional parameter (*args-like)"""
|
||||
return (code.co_flags & 4) != 0
|
||||
|
||||
def code_has_star_star_arg(code):
|
||||
"""Return True iff
|
||||
The code object has a variable keyword parameter (**kwargs-like)."""
|
||||
return (code.co_flags & 8) != 0
|
||||
|
||||
# FIXME: DRY the below code...
|
||||
|
||||
def make_function3_annotate(self, node, isLambda, nested=1,
|
||||
|
@@ -1,3 +1,3 @@
|
||||
# This file is suitable for sourcing inside bash as
|
||||
# well as importing into Python
|
||||
VERSION='2.11.4'
|
||||
VERSION='2.11.5'
|
||||
|
Reference in New Issue
Block a user