diff --git a/ChangeLog b/ChangeLog index a8f4054d..717390ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-08-13 rocky + + * 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-10 rocky * : commit c38dc61021368f11e95cef70ee77e4a43dba1598 Author: rocky diff --git a/NEWS b/NEWS index e1d418c2..efcee88e 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,16 @@ -uncompyle6 2.11.2 2017-08-09 +uncompyle6 2.11.4 2017-08-15 + +* scanner and parser now 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 +* 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 + semanatic routines. We need "is not". +* Some PyPy tolerance in validate testing. +* Some pyston tolerance + +uncompyle6 2.11.3 2017-08-09 Very minor changes diff --git a/__pkginfo__.py b/__pkginfo__.py index 6c0154b1..a64393d6 100644 --- a/__pkginfo__.py +++ b/__pkginfo__.py @@ -40,7 +40,7 @@ entry_points = { ]} ftp_url = None install_requires = ['spark-parser >= 1.6.1, < 1.7.0', - 'xdis == 3.5.1'] + 'xdis >= 3.5.4, < 3.6.0'] license = 'MIT' mailing_list = 'python-debugger@googlegroups.com' modname = 'uncompyle6' diff --git a/pytest/validate.py b/pytest/validate.py index 5d437cb3..d3e46877 100644 --- a/pytest/validate.py +++ b/pytest/validate.py @@ -126,7 +126,10 @@ def validate_uncompyle(text, mode='exec'): original_text = text deparsed = deparse_code(PYTHON_VERSION, original_code, - compile_mode=mode, out=StringIO()) + + compile_mode=mode, + out=StringIO(), + is_pypy=IS_PYPY) uncompyled_text = deparsed.text uncompyled_code = compile(uncompyled_text, '', 'exec') diff --git a/uncompyle6/parser.py b/uncompyle6/parser.py index 1bf1d5ce..83391a32 100644 --- a/uncompyle6/parser.py +++ b/uncompyle6/parser.py @@ -9,13 +9,10 @@ Common uncompyle parser routines. import sys from xdis.code import iscode +from xdis.magics import py_str2float from spark_parser import GenericASTBuilder, DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG from uncompyle6.show import maybe_show_asm -# FIXME: put in xdis -from uncompyle6.scanner import version_str2float - - class ParserError(Exception): def __init__(self, token, offset): self.token = token @@ -614,7 +611,7 @@ def get_python_parser( # If version is a string, turn that into the corresponding float. if isinstance(version, str): - version = version_str2float(version) + version = py_str2float(version) # FIXME: there has to be a better way... # We could do this as a table lookup, but that would force us diff --git a/uncompyle6/scanner.py b/uncompyle6/scanner.py index 040c6464..750c565c 100755 --- a/uncompyle6/scanner.py +++ b/uncompyle6/scanner.py @@ -15,6 +15,7 @@ import sys from uncompyle6 import PYTHON3, IS_PYPY from uncompyle6.scanners.tok import Token from xdis.bytecode import op_size +from xdis.magics import py_str2float # The byte code versions we support PYTHON_VERSIONS = (1.5, @@ -256,28 +257,11 @@ def parse_fn_counts(argc): return ((argc & 0xFF), (argc >> 8) & 0xFF, (argc >> 16) & 0x7FFF) -# FIXME: put in xdis -from xdis.magics import magics -def version_str2float(version): - if version in magics: - magic = magics[version] - for v, m in list(magics.items()): - if m == magic: - try: - return float(v) - except: - pass - pass - pass - raise RuntimeError("Can't find a valid Python version for version %s" - % version) - return - def get_scanner(version, is_pypy=False, show_asm=None): # If version is a string, turn that into the corresponding float. if isinstance(version, str): - version = version_str2float(version) + version = py_str2float(version) # Pick up appropriate scanner if version in PYTHON_VERSIONS: diff --git a/uncompyle6/version.py b/uncompyle6/version.py index 632937ca..e7a1612b 100644 --- a/uncompyle6/version.py +++ b/uncompyle6/version.py @@ -1,3 +1,3 @@ # This file is suitable for sourcing inside bash as # well as importing into Python -VERSION='2.11.3' +VERSION='2.11.4'