Hello community,

here is the log from the commit of package python-xdis for openSUSE:Factory 
checked in at 2020-02-07 15:53:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-xdis (Old)
 and      /work/SRC/openSUSE:Factory/.python-xdis.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-xdis"

Fri Feb  7 15:53:41 2020 rev:6 rq:770565 version:4.2.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-xdis/python-xdis.changes  2019-12-04 
14:20:11.210428362 +0100
+++ /work/SRC/openSUSE:Factory/.python-xdis.new.26092/python-xdis.changes       
2020-02-07 15:54:31.679514596 +0100
@@ -1,0 +2,10 @@
+Thu Feb  6 12:27:12 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to 4.2.2
+  * Add Python versions: 3.6.10, 3.7.6. 3.8.1
+  * Update 3.9-dev to 3.9.0alpha2
+  * Add interpolation of FUNCTION_CALL_{KW,EX} argument for 3.7-3.9
+  * Better output of complex type values
+  * Correct and clean up compiler flags.
+
+-------------------------------------------------------------------

Old:
----
  4.1.3.tar.gz

New:
----
  4.2.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-xdis.spec ++++++
--- /var/tmp/diff_new_pack.McszBb/_old  2020-02-07 15:54:32.651515127 +0100
+++ /var/tmp/diff_new_pack.McszBb/_new  2020-02-07 15:54:32.655515129 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-xdis
 #
-# Copyright (c) 2019 SUSE LLC
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-xdis
-Version:        4.1.3
+Version:        4.2.2
 Release:        0
 Summary:        Python cross-version byte-code disassembler and marshal 
routines
 License:        GPL-2.0-only

++++++ 4.1.3.tar.gz -> 4.2.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/.circleci/config.yml 
new/python-xdis-4.2.2/.circleci/config.yml
--- old/python-xdis-4.1.3/.circleci/config.yml  2019-11-18 01:32:26.000000000 
+0100
+++ new/python-xdis-4.2.2/.circleci/config.yml  2019-12-24 15:39:30.000000000 
+0100
@@ -10,18 +10,8 @@
       CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
       CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
       COMPILE: --compile
-    # In CircleCI 1.0 we used a pre-configured image with a large number of 
languages and other packages.
-    # In CircleCI 2.0 you can now specify your own image, or use one of our 
pre-configured images.
-    # The following configuration line tells CircleCI to use the specified 
docker image as the runtime environment for you job.
-    # We have selected a pre-built image that mirrors the build environment we 
use on
-    # the 1.0 platform, but we recommend you choose an image more tailored to 
the needs
-    # of each job. For more information on choosing an image (or alternatively 
using a
-    # VM instead of a container) see 
https://circleci.com/docs/2.0/executor-types/
-    # To see the list of pre-built images that CircleCI provides for most 
common languages see
-    # https://circleci.com/docs/2.0/circleci-images/
     machine:
-      python:
-        version: 2.7.14
+      image: default
     steps:
     # Machine Setup
     #   If you break your build into multiple jobs with workflows, you will 
probably want to do the parts of this that are relevant in each
@@ -34,7 +24,7 @@
     # This is based on your 1.0 configuration file or project settings
     - run:
         working_directory: ~/rocky/python-xdis
-        command: pip install virtualenv && pip install nose && pip install 
pep8 && pyenv rehash
+        command: pip install virtualenv && pyenv install 3.6.3 && pyenv local 
3.6.3 && pip install nose && pip install pep8 && pyenv rehash
     # Dependencies
     #   This would typically go in either a build or a build-and-test job when 
using workflows
     # Restore the dependency cache
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/Makefile 
new/python-xdis-4.2.2/Makefile
--- old/python-xdis-4.1.3/Makefile      2019-11-18 01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/Makefile      2019-12-24 15:39:30.000000000 +0100
@@ -58,7 +58,6 @@
 sdist:
        $(PYTHON) ./setup.py sdist
 
-
 #: Style check. Set env var LINT to pyflakes, flake, or flake8
 lint: flake8
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/NEWS.md 
new/python-xdis-4.2.2/NEWS.md
--- old/python-xdis-4.1.3/NEWS.md       2019-11-18 01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/NEWS.md       2019-12-24 15:39:30.000000000 +0100
@@ -1,10 +1,34 @@
-4.1.3 2019-10-29 JNC
+4.2.2 2019-12-24 christmas + hannukah
+=====================================
+
+* Add Python versions: 3.6.10, 3.7.6. 3.8.1,
+* Update 3.9-dev to 3.9.0alpha2
+* Add interpolation of FUNCTION_CALL_{KW,EX} argument for 3.7-3.9
+* Better output of complex type values
+
+
+4.2.1 2019-12-16
+=================
+
+Correct and clean up compiler flags. Add 3.5+ `ITERABLE_COROUTINE` and
+3.6+ `ASYNC_GENERATOR`.
+
+Clean up PYPY 3.6 flags and opcodes Many thanks again to Arman
+Rigo. Split PYPY specfic compiler-specific flags into its own thing.
+
+4.2.0 2019-12-10 gecko gecko
+============================
+
+- Add preliminary 3.9(dev) support
+- Handle 3.8-3.9 bytecode from 3.7ish
+
+4.1.3 2019-11-17 JNC
 ====================
 
 - Add magics for 3.5.8 and 3.5.9
 - Python 3.0 tolerance
-- Fix for unmarshaling Python 3.8 str from 3.2
-- Pypy 3.3, 3.5 3.6 and 3.6.9 magic numbers and support
+- Fix for unmarshaling Python 3.8 `str` from 3.2
+- Pypy 3.3, 3.5, 3.6, and 3.6.9 magic numbers and support
 
 4.1.2 2019-10-29 pre Halloween redux
 ====================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/README.rst 
new/python-xdis-4.2.2/README.rst
--- old/python-xdis-4.1.3/README.rst    2019-11-18 01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/README.rst    2019-12-24 15:39:30.000000000 +0100
@@ -5,7 +5,7 @@
 xdis
 ====
 
-A Cross-Python bytecode isassembler, bytecode/workcode and magic-number 
manipulation library/package.
+A Cross-Python bytecode isassembler, bytecode/wordcode and magic-number 
manipulation library/package.
 
 
 Introduction
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/admin-tools/pyenv-newer-versions 
new/python-xdis-4.2.2/admin-tools/pyenv-newer-versions
--- old/python-xdis-4.1.3/admin-tools/pyenv-newer-versions      2019-11-18 
01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/admin-tools/pyenv-newer-versions      2019-12-24 
15:39:30.000000000 +0100
@@ -5,4 +5,4 @@
     echo "This script should be *sourced* rather than run directly through 
bash"
     exit 1
 fi
-export PYVERSIONS='3.5.9 3.6.9 2.6.9 3.3.7 2.7.17 3.2.6 3.1.5 3.4.10 3.7.5 
3.8.0'
+export PYVERSIONS='3.5.9 3.6.9 2.6.9 3.3.7 2.7.17 3.2.6 3.1.5 3.4.10 3.7.6 
3.8.1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/pytest/test_opcode.py 
new/python-xdis-4.2.2/pytest/test_opcode.py
--- old/python-xdis-4.1.3/pytest/test_opcode.py 2019-11-18 01:32:26.000000000 
+0100
+++ new/python-xdis-4.2.2/pytest/test_opcode.py 2019-12-24 15:39:30.000000000 
+0100
@@ -7,11 +7,11 @@
     opmap = dict([(k.replace('+', '_'), v)
                   for (k, v) in dis.opmap.items()])
 
-    # print("Extra in dis:", set(opmap.items()) - set(opc.opmap.items()))
-    # print("Extra in xdis:", set(opc.opmap.items()) - set(opmap.items()))
+    print("Extra in dis:", set(opmap.items()) - set(opc.opmap.items()))
+    print("Extra in xdis:", set(opc.opmap.items()) - set(opmap.items()))
 
-    # for item in opmap.items():
-    #   assert item in opc.opmap.items(), item
+    for item in opmap.items():
+        assert item in opc.opmap.items(), item
 
     fields_str = "hascompare hasconst hasfree hasjabs hasjrel haslocal"
     # PyPy 2.7.13 changes opcodes mid-version. It is too complicated
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-xdis-4.1.3/test/simple_source/02_async.py-notyet 
new/python-xdis-4.2.2/test/simple_source/02_async.py-notyet
--- old/python-xdis-4.1.3/test/simple_source/02_async.py-notyet 1970-01-01 
01:00:00.000000000 +0100
+++ new/python-xdis-4.2.2/test/simple_source/02_async.py-notyet 2019-12-24 
15:39:30.000000000 +0100
@@ -0,0 +1,5 @@
+# from 3.7 test_asyncgen.py
+def test_async_gen_iteration_01(self):
+    async def gen():
+        await awaitable()
+        a = yield 123
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/bin/pydisasm.py 
new/python-xdis-4.2.2/xdis/bin/pydisasm.py
--- old/python-xdis-4.1.3/xdis/bin/pydisasm.py  2019-11-18 01:32:26.000000000 
+0100
+++ new/python-xdis-4.2.2/xdis/bin/pydisasm.py  2019-12-24 15:39:30.000000000 
+0100
@@ -16,38 +16,46 @@
 
 program, ext = os.path.splitext(os.path.basename(__file__))
 
-PATTERNS = ('*.pyc', '*.pyo')
+PATTERNS = ("*.pyc", "*.pyo")
+
 
 @click.command()
[email protected]("--asm/--noasm", default=False,
-              help='Produce output suitable for the xasm assembler')
[email protected]("--show-bytes/--noshow-bytes", default=False,
-              help='include bytecode bytes in output')
[email protected](
+    "--asm/--noasm",
+    default=False,
+    help="Produce output suitable for the xasm assembler",
+)
[email protected](
+    "--show-bytes/--noshow-bytes",
+    default=False,
+    help="include bytecode bytes in output",
+)
 @click.version_option(version=VERSION)
[email protected]("--header/--no-header", default=False,
-              help='Show only the module header information')
[email protected]('files', nargs=-1, type=click.Path(readable=True), 
required=True)
[email protected](
+    "--header/--no-header",
+    default=False,
+    help="Show only the module header information",
+)
[email protected]("files", nargs=-1, type=click.Path(readable=True), 
required=True)
 def main(asm, show_bytes, header, files):
     """Disassembles a Python bytecode file.
 
     We handle bytecode for virtually every release of Python and some releases 
of PyPy.
     The version of Python in the bytecode doesn't have to be the same version 
as
-    the Python interpreter used to run this program. For example, you can 
disassemble Python 3.6.1
-    bytecode from Python 2.7.13 and vice versa.
+    the Python interpreter used to run this program. For example, you can 
disassemble Python 3.6.9
+    bytecode from Python 2.7.15 and vice versa.
     """
-    Usage_short = """usage:
-   %s [--asm] -i FILE...
-   %s --version
-Type -h for for full help.""" % (program, program)
-
-
-    if not (2.5 <= PYTHON_VERSION <= 3.8):
-        sys.stderr(print("This works on Python version 2.5..3.8; have %s" % 
PYTHON_VERSION))
-
-    if not len(files):
-        sys.stderr.write("No file(s) given..\n")
-        print(Usage_short, file=sys.stderr)
-        sys.exit(1)
+    if not (2.7 <= PYTHON_VERSION <= 3.9):
+        if 2.4 <= PYTHON_VERSION <= 2.6:
+            sys.stderr.write(
+                "This code works on 2.7..3.8. code that works for %s can be 
found in the python-2.4 branch\n"
+                % PYTHON_VERSION
+            )
+            sys.exit(1)
+        sys.stderr.write(
+            "This works on Python version 2.7..3.8; have %s.\n" % 
PYTHON_VERSION
+        )
+        sys.exit(2)
 
     for path in files:
         # Some sanity checks
@@ -58,11 +66,15 @@
             sys.stderr.write("File name: '%s' isn't a file\n" % path)
             continue
         elif osp.getsize(path) < 50:
-            sys.stderr.write("File name: '%s (%d bytes)' is too short to be a 
valid pyc file\n" % (path, osp.getsize(path)))
+            sys.stderr.write(
+                "File name: '%s (%d bytes)' is too short to be a valid pyc 
file\n"
+                % (path, osp.getsize(path))
+            )
             continue
 
         disassemble_file(path, sys.stdout, asm, header, show_bytes)
     return
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     main(sys.argv[1:])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/load.py 
new/python-xdis-4.2.2/xdis/load.py
--- old/python-xdis-4.1.3/xdis/load.py  2019-11-18 01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/xdis/load.py  2019-12-24 15:39:30.000000000 +0100
@@ -181,7 +181,7 @@
                 timestamp = 0
                 _ = unpack("<I", ts)[0]  # hash word 1
                 _ = unpack("<I", fp.read(4))[0]  # hash word 2
-            elif magic_int in (3394, 3401, 3412, 3413):
+            elif magic_int in (3394, 3401, 3412, 3413, 3422):
                 timestamp = 0
                 _ = unpack("<I", fp.read(4))[0]  # pep552_bits
             else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/magics.py 
new/python-xdis-4.2.2/xdis/magics.py
--- old/python-xdis-4.1.3/xdis/magics.py        2019-11-18 01:32:26.000000000 
+0100
+++ new/python-xdis-4.2.2/xdis/magics.py        2019-12-24 15:39:30.000000000 
+0100
@@ -269,6 +269,7 @@
 add_magic_from_int(3401, "3.8.0a3+")
 add_magic_from_int(3412, "3.8.0beta2")
 add_magic_from_int(3413, "3.8.0rc1+")
+add_magic_from_int(3422, "3.9.0alpha1")
 
 # Weird ones
 # WTF? Python 3.2.5 and PyPy have weird magic numbers
@@ -330,7 +331,7 @@
 add_canonic_versions("3.5.0 3.5.1", "3.5")
 add_canonic_versions("3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9", 
"3.5.2")
 add_canonic_versions(
-    "3.6 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9", "3.6rc1"
+    "3.6 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.6.10", 
"3.6rc1"
 )
 
 add_canonic_versions("2.7.10pypy 2.7.13pypy", "2.7pypy")
@@ -341,9 +342,10 @@
 add_canonic_versions("3.6.9pypy", "3.6pypy")
 add_canonic_versions("2.7.8Pyston", "2.7.7Pyston")
 add_canonic_versions("3.7.0alpha3", "3.7.0alpha3")
-add_canonic_versions("3.7 3.7.0beta5 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5", "3.7.0")
+add_canonic_versions("3.7 3.7.0beta5 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6", 
"3.7.0")
 add_canonic_versions("3.8.0alpha0 3.8.0alpha3 3.8.0a0", "3.8.0a3+")
-add_canonic_versions("3.8.0 3.8 3.8.0candidate1", "3.8.0rc1+")
+add_canonic_versions("3.8.0 3.8.1 3.8 3.8.0candidate1", "3.8.0rc1+")
+add_canonic_versions("3.9 3.9.0 3.9.0a1+ 3.9.0a2+ 3.9.0alpha1 3.9.0alpha2", 
"3.9.0alpha1")
 
 # The canonic version for a canonic version is itself
 for v in versions.values():
@@ -387,7 +389,7 @@
                     return float(canonic_python_version[v])
                 except:
                     try:
-                        m = re.match(r"^(\d\.)(\d+)\.(\d+)$", v)
+                        m = re.match(r"^(\d\.)(\d+)\.(\d+)", v)
                         if m:
                             return float(m.group(1) + m.group(2))
                     except:
@@ -463,15 +465,14 @@
 
 def test():
     magic_20 = magics["2.0"]
-    current = imp.get_magic()
-    magic_current = by_magic[current]
+    magic_current = by_magic[MAGIC]
     print(type(magic_20), len(magic_20), repr(magic_20))
     print()
     print("This Python interpreter has version", magic_current)
     print("Magic code: ", PYTHON_MAGIC_INT)
     print(type(magic_20), len(magic_20), repr(magic_20))
     print(sysinfo2float())
-    assert sysinfo2magic() == current
+    assert sysinfo2magic() == MAGIC
 
 
 if __name__ == "__main__":
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/op_imports.py 
new/python-xdis-4.2.2/xdis/op_imports.py
--- old/python-xdis-4.1.3/xdis/op_imports.py    2019-11-18 01:32:26.000000000 
+0100
+++ new/python-xdis-4.2.2/xdis/op_imports.py    2019-12-24 15:39:30.000000000 
+0100
@@ -42,6 +42,7 @@
 from xdis.opcodes import opcode_36 as opcode_36
 from xdis.opcodes import opcode_37 as opcode_37
 from xdis.opcodes import opcode_38 as opcode_38
+from xdis.opcodes import opcode_39 as opcode_39
 
 from xdis.opcodes import opcode_26pypy as opcode_26pypy
 from xdis.opcodes import opcode_27pypy as opcode_27pypy
@@ -117,6 +118,9 @@
     '3.8.0rc1+': opcode_38,
     '3.8.0candidate1': opcode_38,
     '3.8' : opcode_38,
+    '3.9.0alpha1' : opcode_39,
+    '3.9.0alpha2' : opcode_39,
+    '3.9' : opcode_39,
 
     '2.6pypy':  opcode_26pypy,
     '2.7pypy':  opcode_27pypy,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/opcodes/base.py 
new/python-xdis-4.2.2/xdis/opcodes/base.py
--- old/python-xdis-4.1.3/xdis/opcodes/base.py  2019-11-18 01:32:26.000000000 
+0100
+++ new/python-xdis-4.2.2/xdis/opcodes/base.py  2019-12-24 15:39:30.000000000 
+0100
@@ -235,10 +235,6 @@
 def format_extended_arg(arg):
     return str(arg * (1 << 16))
 
-def format_extended_arg36(arg):
-    return str(arg * (1 << 8))
-
-
 def format_CALL_FUNCTION_pos_name_encoded(argc):
     """Encoded positional and named args. Used to
     up to about 3.6 where wordcodes are used and
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/opcodes/opcode_36.py 
new/python-xdis-4.2.2/xdis/opcodes/opcode_36.py
--- old/python-xdis-4.1.3/xdis/opcodes/opcode_36.py     2019-11-18 
01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/xdis/opcodes/opcode_36.py     2019-12-24 
15:39:30.000000000 +0100
@@ -22,7 +22,6 @@
 
 from xdis.opcodes.base import(
     def_op, finalize_opcodes,
-    format_extended_arg36,
     init_opdata, jrel_op, name_op,
     nargs_op, rm_op, varargs_op,
     update_pj3
@@ -128,7 +127,21 @@
         # empty fmt_spec.
         return ''
 
+def format_extended_arg36(arg):
+    return str(arg * (1 << 8))
+
+def format_CALL_FUNCTION_EX(flags):
+    str = ""
+    if flags & 0x01:
+        str = "keyword args"
+    return str
+
+def format_CALL_FUNCTION_KW(argc):
+    return "%d total positional and keyword args" % argc
+
 opcode_arg_fmt = {
+    'CALL_FUNCTION_KW': format_CALL_FUNCTION_KW,
+    'CALL_FUNCTION_EX': format_CALL_FUNCTION_EX,
     'MAKE_FUNCTION': format_MAKE_FUNCTION_arg,
     'FORMAT_VALUE': format_value_flags,
     'EXTENDED_ARG': format_extended_arg36
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/opcodes/opcode_36pypy.py 
new/python-xdis-4.2.2/xdis/opcodes/opcode_36pypy.py
--- old/python-xdis-4.1.3/xdis/opcodes/opcode_36pypy.py 2019-11-18 
01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/xdis/opcodes/opcode_36pypy.py 2019-12-24 
15:39:30.000000000 +0100
@@ -44,8 +44,6 @@
 # PyPy only
 # ----------
 
-def_op(l, "FORMAT_VALUE", 155)
-def_op(l, "BUILD_STRING", 157)
 name_op(l, "LOOKUP_METHOD", 201, 1, 2)
 nargs_op(l, "CALL_METHOD", 202, -1, 1)
 l["hasvargs"].append(202)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/opcodes/opcode_37.py 
new/python-xdis-4.2.2/xdis/opcodes/opcode_37.py
--- old/python-xdis-4.1.3/xdis/opcodes/opcode_37.py     2019-11-18 
01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/xdis/opcodes/opcode_37.py     2019-12-24 
15:39:30.000000000 +0100
@@ -22,7 +22,6 @@
 
 from xdis.opcodes.base import(
     finalize_opcodes,
-    format_extended_arg36,
     init_opdata, nargs_op,
     name_op, rm_op,
     update_pj3
@@ -89,9 +88,11 @@
 format_value_flags = opcode_36.format_value_flags
 
 opcode_arg_fmt = {
+    'CALL_FUNCTION_KW': opcode_36.format_CALL_FUNCTION_KW,
+    'CALL_FUNCTION_EX': opcode_36.format_CALL_FUNCTION_EX,
     'MAKE_FUNCTION': format_MAKE_FUNCTION_arg,
     'FORMAT_VALUE': format_value_flags,
-    'EXTENDED_ARG': format_extended_arg36
+    'EXTENDED_ARG': opcode_36.format_extended_arg36
 }
 
 update_pj3(globals(), l)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/opcodes/opcode_38.py 
new/python-xdis-4.2.2/xdis/opcodes/opcode_38.py
--- old/python-xdis-4.1.3/xdis/opcodes/opcode_38.py     2019-11-18 
01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/xdis/opcodes/opcode_38.py     2019-12-24 
15:39:30.000000000 +0100
@@ -19,15 +19,22 @@
 This is a like Python 3.8's opcode.py
 """
 
-from xdis.opcodes.base import(
+from xdis.opcodes.base import (
     finalize_opcodes,
-    format_extended_arg36,
-    init_opdata, nargs_op,
-    def_op, jrel_op, rm_op,
-    update_pj3
-    )
+    init_opdata,
+    nargs_op,
+    def_op,
+    jrel_op,
+    rm_op,
+    update_pj3,
+)
 
 import xdis.opcodes.opcode_37 as opcode_37
+from xdis.opcodes.opcode_36 import (
+    format_CALL_FUNCTION_EX,
+    format_CALL_FUNCTION_KW,
+    format_extended_arg36,
+)
 
 version = 3.8
 
@@ -36,29 +43,31 @@
 init_opdata(l, opcode_37, version)
 
 # These are removed since 3.7...
-rm_op(l, 'BREAK_LOOP', 80)
-rm_op(l, 'CONTINUE_LOOP', 119)
-rm_op(l, 'SETUP_LOOP', 120)
-rm_op(l, 'SETUP_EXCEPT', 121)
+rm_op(l, "BREAK_LOOP", 80)
+rm_op(l, "CONTINUE_LOOP", 119)
+rm_op(l, "SETUP_LOOP", 120)
+rm_op(l, "SETUP_EXCEPT", 121)
 
 # These are new since Python 3.7
 
 #          OP NAME            OPCODE POP PUSH
-#--------------------------------------------
-def_op(l, 'ROT_FOUR',           6,   4, 4)
-def_op(l, 'BEGIN_FINALLY',     53,   0, 1)
-def_op(l, 'END_ASYNC_FOR',     54,   7, 0)  # POP is 0, when not 7
-def_op(l, 'END_FINALLY',       88,   1, 0)  # POP is 6, when not 1
-jrel_op(l, 'CALL_FINALLY',    162,   0, 1)
-nargs_op(l, 'POP_FINALLY',    163,   0, 0)  # PUSH/POP vary
+# --------------------------------------------
+def_op(l, "ROT_FOUR", 6, 4, 4)
+def_op(l, "BEGIN_FINALLY", 53, 0, 1)
+def_op(l, "END_ASYNC_FOR", 54, 7, 0)  # POP is 0, when not 7
+def_op(l, "END_FINALLY", 88, 1, 0)  # POP is 6, when not 1
+jrel_op(l, "CALL_FINALLY", 162, 0, 1)
+nargs_op(l, "POP_FINALLY", 163, 0, 0)  # PUSH/POP vary
 
 format_MAKE_FUNCTION_arg = opcode_37.format_MAKE_FUNCTION_arg
 format_value_flags = opcode_37.format_value_flags
 
 opcode_arg_fmt = {
-    'MAKE_FUNCTION': format_MAKE_FUNCTION_arg,
-    'FORMAT_VALUE': format_value_flags,
-    'EXTENDED_ARG': format_extended_arg36
+    "CALL_FUNCTION_KW": format_CALL_FUNCTION_KW,
+    "CALL_FUNCTION_EX": format_CALL_FUNCTION_EX,
+    "MAKE_FUNCTION": format_MAKE_FUNCTION_arg,
+    "FORMAT_VALUE": format_value_flags,
+    "EXTENDED_ARG": format_extended_arg36,
 }
 
 update_pj3(globals(), l)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/opcodes/opcode_39.py 
new/python-xdis-4.2.2/xdis/opcodes/opcode_39.py
--- old/python-xdis-4.1.3/xdis/opcodes/opcode_39.py     1970-01-01 
01:00:00.000000000 +0100
+++ new/python-xdis-4.2.2/xdis/opcodes/opcode_39.py     2019-12-24 
15:39:30.000000000 +0100
@@ -0,0 +1,75 @@
+# (C) Copyright 2019 by Rocky Bernstein
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
+"""
+CPython 3.8 bytecode opcodes
+
+This is a like Python 3.9's opcode.py
+"""
+
+from xdis.opcodes.base import(
+    const_op,
+    def_op,
+    finalize_opcodes,
+    init_opdata,
+    rm_op,
+    update_pj3
+    )
+
+from xdis.opcodes.opcode_36 import (
+    format_CALL_FUNCTION_EX,
+    format_CALL_FUNCTION_KW,
+    format_extended_arg36,
+)
+
+import xdis.opcodes.opcode_38 as opcode_38
+
+version = 3.9
+
+l = locals()
+
+init_opdata(l, opcode_38, version)
+
+# These are removed since 3.8...
+rm_op(l, "BEGIN_FINALLY", 53)
+rm_op(l, "WITH_CLEANUP_START", 81)
+rm_op(l, "WITH_CLEANUP_FINISH", 82)
+rm_op(l, "END_FINALLY", 88)
+rm_op(l, "CALL_FINALLY", 162)
+rm_op(l, "POP_FINALLY", 163)
+
+
+# These are new since Python 3.9
+
+#          OP NAME              OPCODE  POP PUSH
+#-----------------------------------------------
+def_op(l, 'RERAISE',                48,   0, 0)
+def_op(l, 'WITH_EXCEPT_START',      49,   3, 0)
+def_op(l, 'LOAD_ASSERTION_ERROR',   74,   0, 1)
+
+format_MAKE_FUNCTION_arg = opcode_38.format_MAKE_FUNCTION_arg
+format_value_flags = opcode_38.format_value_flags
+
+opcode_arg_fmt = {
+    "CALL_FUNCTION_KW": format_CALL_FUNCTION_KW,
+    "CALL_FUNCTION_EX": format_CALL_FUNCTION_EX,
+    'MAKE_FUNCTION': format_MAKE_FUNCTION_arg,
+    'FORMAT_VALUE': format_value_flags,
+    'EXTENDED_ARG': format_extended_arg36
+}
+
+update_pj3(globals(), l)
+
+finalize_opcodes(l)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/std.py 
new/python-xdis-4.2.2/xdis/std.py
--- old/python-xdis-4.1.3/xdis/std.py   2019-11-18 01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/xdis/std.py   2019-12-24 15:39:30.000000000 +0100
@@ -126,7 +126,7 @@
 
         If *file* is not provided, the output is printed on stdout.
         """
-        return _show_code(x, self.opc.version, file)
+        return _show_code(x, self.opc.version, file, is_pypy=self.is_pypy)
 
     def pretty_flags(self, flags):
         """Return pretty representation of code flags."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/unmarshal.py 
new/python-xdis-4.2.2/xdis/unmarshal.py
--- old/python-xdis-4.1.3/xdis/unmarshal.py     2019-11-18 01:32:26.000000000 
+0100
+++ new/python-xdis-4.2.2/xdis/unmarshal.py     2019-12-24 15:39:30.000000000 
+0100
@@ -134,7 +134,7 @@
     else:
         co_argcount = unpack("<i", fp.read(4))[0]
 
-    if magic_int in (3412, 3413):
+    if magic_int in (3412, 3413, 3422):
         co_posonlyargcount = unpack("<i", fp.read(4))[0]
     else:
         co_posonlyargcount = None
@@ -233,9 +233,9 @@
                     co_cellvars,
                 )
             else:
-                if PYTHON_MAGIC_INT in (3412, 3413):
+                if PYTHON_MAGIC_INT in (3412, 3413, 3422):
                     if co_posonlyargcount is not None:
-                        # Python3.8 to Python3.8: Ok to use native Python3.8's 
code type
+                        # Python3.8 to Python3.9: Ok to use native Python3.8's 
code type
                         code = Code(
                             co_argcount,
                             co_posonlyargcount,
@@ -275,6 +275,8 @@
                             co_cellvars,
                         )
                 elif co_posonlyargcount is not None:
+                    if not isinstance(co_lnotab, bytes):
+                        co_lnotab = bytes(co_lnotab, encoding="utf-8")
                     code = Code38(
                         co_argcount,
                         co_posonlyargcount,
@@ -289,7 +291,7 @@
                         co_filename,
                         co_name,
                         co_firstlineno,
-                        bytes(co_lnotab, encoding="utf-8"),
+                        co_lnotab,
                         co_freevars,
                         co_cellvars,
                     )
@@ -792,7 +794,6 @@
     global internStrings, internObjects
 
     b1 = ord(fp.read(1))
-
     save_ref = False
     if b1 & FLAG_REF:
         # Since 3.4, "flag" is the marshal.c name
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/util.py 
new/python-xdis-4.2.2/xdis/util.py
--- old/python-xdis-4.1.3/xdis/util.py  2019-11-18 01:32:26.000000000 +0100
+++ new/python-xdis-4.2.2/xdis/util.py  2019-12-24 15:39:30.000000000 +0100
@@ -14,6 +14,7 @@
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
 
+from math import copysign
 
 def code2num(code, i):
     if isinstance(code, str):
@@ -37,9 +38,12 @@
     0x00000010: "NESTED",
     0x00000020: "GENERATOR",
     0x00000040: "NOFREE",
-    # These are in Python 3.x
+    # These are in Python 3.5 +
     0x00000080: "COROUTINE",
     0x00000100: "ITERABLE_COROUTINE",
+    # These are in Python 3.6+
+    0x00000200: "ASYNC_GENERATOR",
+
     # These are used only in Python 2.x */
     0x00001000: "GENERATOR_ALLOWED",
     0x00002000: "FUTURE_DIVISION",
@@ -48,11 +52,12 @@
     0x00010000: "FUTURE_PRINT_FUNCTION",
     0x00020000: "FUTURE_UNICODE_LITERALS",
     0x00040000: "FUTURE_BARRY_AS_DBFL",
-    # These are PYPY specific
-    0x00100000: "KILL_DOCSTRING",
-    0x00200000: "YIELD_INSIDE_TRY",
-    0x00000100: "PYPY_SOURCE_IS_UTF8",
-    0x00000200: "PYPY_DONT_IMPLY_DEDENT",
+}
+
+# These are PYPY specific
+PYPY_COMPILER_FLAG_NAMES = {
+    0x00100000: "PYPY_KILL_DOCSTRING",
+    0x00200000: "PYPY_YIELD_INSIDE_TRY",
     0x00000400: "PYPY_ONLY_AST",
     0x10000000: "PYPY_ACCEPT_NULL_BYTES",
 }
@@ -66,7 +71,7 @@
 globals().update(dict(["CO_" + k, v] for (k, v) in COMPILER_FLAG_BIT.items()))
 
 
-def pretty_flags(flags):
+def pretty_flags(flags, is_pypy=False):
     """Return pretty representation of code flags."""
     names = []
     result = "0x%08x" % flags
@@ -74,6 +79,8 @@
         flag = 1 << i
         if flags & flag:
             names.append(COMPILER_FLAG_NAMES.get(flag, hex(flag)))
+            if is_pypy:
+                names.append(PYPY_COMPILER_FLAG_NAMES.get(flag, hex(flag)))
             flags ^= flag
             if not flags:
                 break
@@ -94,8 +101,45 @@
     The code object has a variable keyword parameter (**kwargs-like)."""
     return (code.co_flags & 8) != 0
 
+def is_negative_zero(n):
+    """Returns true if n is -0.0"""
+    return n == 0.0 and copysign(1, n) == -1
+
+def better_repr(v):
+    """Work around Python's unorthogonal and unhelpful repr() for primitive 
float
+    and complex."""
+    if isinstance(v, float):
+        # float values 'nan' and 'inf' are not directly
+        # representable in Python before Python 3.5. In Python 3.5
+        # it is accessible via a library constant math.inf.  We
+        # will canonicalize representation of these value as
+        # float('nan') and float('inf')
+        if str(v) in frozenset(["nan", "-nan", "inf", "-inf"]):
+            return "float('%s')" % v
+        elif is_negative_zero(v):
+            return "-0.0"
+        return repr(v)
+    elif isinstance(v, complex):
+        real = better_repr(v.real)
+        imag = better_repr(v.imag)
+        # FIXME: we could probably use repr() in most cases
+        # sort out when that's possible.
+        # The below is however round-tripable, and Python's repr() isn't.
+        return "complex(%s, %s)" % (real, imag)
+    elif isinstance(v, tuple):
+        if len(v) == 1:
+            return "(%s,)" % better_repr(v[0])
+        return "(%s)" % ", ".join(better_repr(i) for i in v)
+    elif isinstance(v, list):
+        l = better_repr(v)
+        if len(v) == 1:
+            return "[%s,]" % better_repr(v[0])
+        return "[%s]" % ", ".join(better_repr(i) for i in v)
+    # TODO: elif deal with sets and dicts
+    else:
+        return repr(v)
 
-def format_code_info(co, version, name=None):
+def format_code_info(co, version, name=None, is_pypy=False):
     if not name:
         name = co.co_name
     lines = []
@@ -115,7 +159,7 @@
         lines.append("# Stack size:        %s" % co.co_stacksize)
 
     if version >= 1.3:
-        lines.append("# Flags:             %s" % pretty_flags(co.co_flags))
+        lines.append("# Flags:             %s" % pretty_flags(co.co_flags, 
is_pypy=is_pypy))
 
     if version >= 1.5:
         lines.append("# First Line:        %s" % co.co_firstlineno)
@@ -123,8 +167,8 @@
     #     lines.append("# Freevars:      %s" % str(co.co_freevars))
     if co.co_consts:
         lines.append("# Constants:")
-        for i_c in enumerate(co.co_consts):
-            lines.append("# %4d: %r" % i_c)
+        for i, c in enumerate(co.co_consts):
+            lines.append("# %4d: %s" % (i, better_repr(c)))
     if co.co_names:
         lines.append("# Names:")
         for i_n in enumerate(co.co_names):
@@ -181,17 +225,17 @@
     raise TypeError("don't know how to disassemble %s objects" % 
type(x).__name__)
 
 
-def code_info(x, version):
+def code_info(x, version, is_pypy=False):
     """Formatted details of methods, functions, or code."""
-    return format_code_info(get_code_object(x), version)
+    return format_code_info(get_code_object(x), version, is_pypy=is_pypy)
 
 
-def show_code(co, version, file=None):
+def show_code(co, version, file=None, is_pypy=False):
     """Print details of methods, functions, or code to *file*.
 
     If *file* is not provided, the output is printed on stdout.
     """
     if file is None:
-        print(code_info(co, version))
+        print(code_info(co, version, is_pypy=is_pypy))
     else:
         file.write(code_info(co, version) + "\n")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-xdis-4.1.3/xdis/version.py 
new/python-xdis-4.2.2/xdis/version.py
--- old/python-xdis-4.1.3/xdis/version.py       2019-11-18 01:32:26.000000000 
+0100
+++ new/python-xdis-4.2.2/xdis/version.py       2019-12-24 15:39:30.000000000 
+0100
@@ -1,3 +1,3 @@
 # This file is suitable for sourcing inside bash as
 # well as importing into Python
-VERSION='4.1.3'
+VERSION='4.2.2'


Reply via email to