Fix closure cell rewriting on 3.8 (#539)

* Fix closure cell rewriting on 3.8

* Enable py38

* Don't use CodeType.replace() -- it was added in 3.8.0b1, but CI still uses 3.8.0a4
This commit is contained in:
Joshua Oreman 2019-06-04 01:35:05 -07:00 committed by Hynek Schlawack
parent 40d5c90ef6
commit a686f74d94
2 changed files with 5 additions and 4 deletions

View File

@ -30,10 +30,9 @@ jobs:
py37:
python.version: '3.7'
tox.env: py37
# Our cell rewriting is currently broken on 3.8.
# py38:
# python.version: '3.8'
# tox.env: py38
py38:
python.version: '3.8'
tox.env: py38
pypy2:
python.version: 'pypy2'

View File

@ -164,6 +164,8 @@ def make_set_closure_cell():
# Convert this code object to a code object that sets the
# function's first _freevar_ (not cellvar) to the argument.
args = [co.co_argcount]
if sys.version_info >= (3, 8):
args.append(co.co_posonlyargcount)
if not PY2:
args.append(co.co_kwonlyargcount)
args.extend(