Merge branch 'python-3.0-to-3.2' into python-2.4-to-2.7

This commit is contained in:
rocky
2024-07-21 19:06:21 -04:00
9 changed files with 25 additions and 15 deletions

View File

@@ -1,3 +1,9 @@
3.9.2: 2024-07-21
=================
- track xdis API changes
- Bug fixes and lint
3.9.1: 2024-05-15
=================

View File

@@ -79,7 +79,7 @@ entry_points = {
]
}
ftp_url = None
install_requires = ["spark-parser >= 1.8.9, < 1.9.0", "xdis >= 6.0.8, < 6.2.0"]
install_requires = ["spark-parser >= 1.8.9, < 1.9.0", "xdis >= 6.1.1, < 6.2.0"]
license = "GPL3"
mailing_list = "python-debugger@googlegroups.com"

View File

@@ -2,6 +2,6 @@
pytest
-e .
xdis>=6.0.4
xdis >= 6.1.0, < 6.2.0
configobj~=5.0.6
setuptools~=65.5.1
setuptools~=59.6.0

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2015-2016, 2818-2022 by Rocky Bernstein
# Copyright (c) 2015-2016, 2818-2022, 2024 by Rocky Bernstein
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
# Copyright (c) 1999 John Aycock
@@ -17,10 +17,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
CPython magic- and version- independent disassembly routines
CPython magic- and version-independent disassembly routines
There are two reasons we can't use Python's built-in routines
from dis. First, the bytecode we are extracting may be from a different
from ``dis``.
First, the bytecode we are extracting may be from a different
version of Python (different magic number) than the version of Python
that is doing the extraction.
@@ -39,12 +41,12 @@ from uncompyle6.scanner import get_scanner
def disco(version, co, out=None, is_pypy=False):
"""
diassembles and deparses a given code block 'co'
diassembles and deparses a given code block ``co``.
"""
assert iscode(co)
# store final output stream for case of error
# Store final output stream in case there is an error.
real_out = out or sys.stdout
real_out.write("# Python %s\n" % version_tuple_to_str(version))
if co.co_filename:
@@ -97,7 +99,7 @@ def disco_loop(disasm, queue, real_out):
def disassemble_file(filename, outstream=None):
"""
disassemble Python byte-code file (.pyc)
Disassemble Python byte-code file (.pyc).
If given a Python source file (".py") file, we'll
try to find the corresponding compiled object.
@@ -111,7 +113,6 @@ def disassemble_file(filename, outstream=None):
disco(version, con, outstream)
else:
disco(version, co, outstream, is_pypy=is_pypy)
co = None
def _test():

View File

@@ -663,6 +663,8 @@ def get_python_parser(
version = version[:2]
p = None
# FIXME: there has to be a better way...
# We could do this as a table lookup, but that would force us
# in import all of the parsers all of the time. Perhaps there is

View File

@@ -1,7 +1,8 @@
# Copyright (c) 2020 Rocky Bernstein
def except_handler(self, lhs, n, rule, ast, tokens, first, last):
end_token = tokens[last-1]
end_token = tokens[last - 1]
# print("XXX", first, last)
# for t in range(first, last):
@@ -13,7 +14,7 @@ def except_handler(self, lhs, n, rule, ast, tokens, first, last):
if self.version[:2] == (1, 4):
return False
# Make sure come froms all come from within "except_handler".
# Make sure COME_FROMs froms come from within "except_handler".
if end_token != "COME_FROM":
return False
return end_token.attr < tokens[first].offset

View File

@@ -172,7 +172,7 @@ def ifelsestmt(self, lhs, n, rule, tree, tokens, first, last):
if raise_stmt1 == "raise_stmt1" and raise_stmt1[0] in ("LOAD_ASSERT",):
return True
# Make sure all the offsets from the "come froms" at the
# Make sure all the offsets from the "COME_FROMs" at the
# end of the "if" come from somewhere inside the "if".
# Since the come_froms are ordered so that lowest
# offset COME_FROM is last, it is sufficient to test

View File

@@ -432,7 +432,7 @@ TABLE_DIRECT = {
# function_def_async
"mkfuncdeco0": ("%|def %c\n", (0, ("mkfunc", "mkfunc_annotate"))),
# In cases where we desire an explict new line.
# In cases where we desire an explicit new line.
# After docstrings which are followed by a "def" is
# one situations where Python formatting desires two newlines,
# and this is added, as a transformation rule.

View File

@@ -14,4 +14,4 @@
# This file is suitable for sourcing inside POSIX shell as
# well as importing into Python
# fmt: off
__version__="3.9.1" # noqa
__version__="3.9.2" # noqa