Skip to content

Commit

Permalink
Fix 3.8 bug. Start testing Python 3.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Apr 16, 2020
1 parent 4ae71a9 commit 26fa32a
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 3 deletions.
26 changes: 24 additions & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,36 @@ check: check-short
--bytecode-3.0 --bytecode-3.1 \
--bytecode-3.2 --bytecode-3.3 \
--bytecode-3.4 --bytecode-3.5 \
--bytecode-3.6 --bytecode-3.7 \
--bytecode-3.6 --bytecode-3.7 --bytecode-3.8 \
--bytecode-2.7pypy --bytecode-3.2pypy \
--bytecode-3.5pypy --bytecode-3.6pypy $(COMPILE)
check-short:
$(PYTHON) test_pyenvlib.py --verify --simple

check-bytecode-1.5:
$(PYTHON) test_pyenvlib.py --bytecode-1.5
$(PYTHON) test_pythonlib.py --bytecode-1.5

check-bytecode-1:
$(PYTHON) test_pythonlib.py \
--bytecode-1.0 --bytecode-1.1 --bytecode-1.2 --bytecode-1.3 \
--bytecode-1.4 --bytecode-1.5 --bytecode-1.6

check-bytecode-2:
$(PYTHON) test_pythonlib.py \
--bytecode-2.1 --bytecode-2.2 --bytecode-2.3 \
--bytecode-2.4 --bytecode-2.5 \
--bytecode-2.5dropbox \
--bytecode-2.6 --bytecode-2.7

check-bytecode-3:
$(PYTHON) test_pythonlib.py \
--bytecode-3.0 --bytecode-3.1 \
--bytecode-3.2 --bytecode-3.3 \
--bytecode-3.4 --bytecode-3.5 \
--bytecode-3.6 --bytecode-3.7 --bytecode-3.8

check-bytecode-3.8:
$(PYTHON) test_pythonlib.py --bytecode-3.8

#: Test of all pyenv Python library files
check-full check-pyenv:
Expand Down
Binary file added test/bytecode_3.8/00_chained-compare.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/00_docstring.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/01_assert2.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/01_chained_compare.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/01_class.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/01_conditional.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/01_extra_iter.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/01_triple_compare.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/02_var_annotate.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/04_and_del.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/04_def_annotate.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/04_importlist.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/05_call_function_kw2.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/06_listcomp.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/10_for.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/10_fstring.pyc
Binary file not shown.
Binary file added test/bytecode_3.8/14_mixed_expressions.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions xdis/codetype/code15.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def decode_lineno_tab(self):
line_number, line_number_diff = self.co_firstlineno, 0
offset, offset_diff = 0, 0
uncompressed_lnotab = {offset: line_number}
if not hasattr(self.co_lnotab, "__len__"):
raise TypeError("line number table should have a type with a length; is %s" % type(self.co_lnotab))
for i in range(0, len(self.co_lnotab), 2):
offset_diff = self.co_lnotab[i]
line_number_diff = self.co_lnotab[i+1]
Expand Down
7 changes: 6 additions & 1 deletion xdis/unmarshal.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,13 @@ def load_code_type(fp, magic_int, bytes_for_s=False, code_objects={}):
else:
co_argcount = 0

if version >= 3.8:
# FIXME:
# Note we do this by magic_int, not version which is *not*
# 3.8
if magic_int in (3412, 3413, 3422):
co_posonlyargcount = unpack("<i", fp.read(4))[0]
if version >= 3.8:
co_posonlyargcount = 0
else:
co_posonlyargcount = None

Expand Down

0 comments on commit 26fa32a

Please sign in to comment.