Minor tweaks

This commit is contained in:
rocky
2016-05-05 22:09:22 -04:00
parent 408ba8c564
commit 163dfd888d
3 changed files with 17 additions and 10 deletions

View File

@@ -13,7 +13,7 @@ Introduction
*uncompyle6* translates Python bytecode back into equivalent Python *uncompyle6* translates Python bytecode back into equivalent Python
source code. It accepts bytecodes from Python version 2.5 to 3.4 or source code. It accepts bytecodes from Python version 2.5 to 3.4 or
so. The code requires Python 2.6 or later and has been tested on Python so. The code requires Python 2.6 or later and has been tested on Python
running versions 2.6, 2.7, 3.3, 3.4 and 3.5. running versions 2.6, 2.7, 3.2, 3.3, 3.4 and 3.5.
Why this? Why this?
--------- ---------
@@ -92,8 +92,11 @@ for usage help.
Known Bugs/Restrictions Known Bugs/Restrictions
----------------------- -----------------------
Python 2 deparsing is probably as solid as the various versions of Python 2 deparsing decompiles all of the Python 2.7.10 library and as
uncompyle2. Python 3 deparsing is okay but not as solid. Python 3.5 is missing some of new opcodes added, but still often works. such is probably a little better than uncompyle2. Python 3 deparsing
is okay, sometimes. More work is needed to decompile all of its
library. Python 3.5 is missing some of new opcodes added, but still
often works.
See Also See Also
-------- --------

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2015 by Rocky Bernstein # Copyright (c) 2015, 2016 by Rocky Bernstein
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org> # Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com> # Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
# Copyright (c) 1999 John Aycock # Copyright (c) 1999 John Aycock
@@ -595,8 +595,14 @@ class FragmentsWalker(pysource.SourceWalker, object):
else: else:
buildclass = node[0] buildclass = node[0]
build_list = buildclass[1][0] build_list = buildclass[1][0]
subclass = buildclass[-3][0].attr if hasattr(buildclass[-3][0], 'attr'):
currentclass = buildclass[0].pattr subclass = buildclass[-3][0].attr
currentclass = buildclass[0].pattr
elif hasattr(node[0][0], 'pattr'):
subclass = buildclass[-3][1].attr
currentclass = node[0][0].pattr
else:
raise 'Internal Error n_classdef: cannot find class name'
self.write('\n\n') self.write('\n\n')
self.currentclass = str(currentclass) self.currentclass = str(currentclass)

View File

@@ -1075,14 +1075,12 @@ class SourceWalker(GenericASTTraversal, object):
else: else:
buildclass = node[0] buildclass = node[0]
build_list = buildclass[1][0] build_list = buildclass[1][0]
subclass = buildclass[-3][0].attr if hasattr(buildclass[-3][0], 'attr'):
currentclass = buildclass[0].pattr
if hasattr(buildclass[-3][0], 'pattr'):
subclass = buildclass[-3][0].attr subclass = buildclass[-3][0].attr
currentclass = buildclass[0].pattr currentclass = buildclass[0].pattr
elif hasattr(node[0][0], 'pattr'): elif hasattr(node[0][0], 'pattr'):
currentclass = node[0][0].pattr
subclass = buildclass[-3][1].attr subclass = buildclass[-3][1].attr
currentclass = node[0][0].pattr
else: else:
raise 'Internal Error n_classdef: cannot find class name' raise 'Internal Error n_classdef: cannot find class name'