Skip to content

New Python-only closure cell rewriting fails on Python 3.8-dev #538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hynek opened this issue Jun 2, 2019 · 1 comment · Fixed by #539
Closed

New Python-only closure cell rewriting fails on Python 3.8-dev #538

hynek opened this issue Jun 2, 2019 · 1 comment · Fixed by #539

Comments

@hynek
Copy link
Member

hynek commented Jun 2, 2019

I need someone who understands the code better than I to tell me whether this is our problem or whether we should report this upstream.

The problem seems to be the instantiation of types.CodeType(*args) because it throws an:

TypeError('an integer is required (got type bytes)')

The contents of args is the following:

[1,
 0,
 2,
 1,
 19,
 b'|\x00\x89\x00d\x00S\x00',
 (None,
  <code object force_x_to_be_a_cell at 0x7fe71817fe70, file "/Users/hynek/Projects/attrs/.tox/py38/lib/python3.8/site-packages/attr/_compat.py", line 151>,
  'make_set_closure_cell.<locals>.set_first_cellvar_to.<locals>.force_x_to_be_a_cell'),
 (),
 ('value', 'force_x_to_be_a_cell'),
 '/Users/hynek/Projects/attrs/.tox/py38/lib/python3.8/site-packages/attr/_compat.py',
 'set_first_cellvar_to',
 144,
 b'\x00\x01\x04\x01\x04\x05',
 ('x',),
 ()]

I suspect it's either b'|\x00\x89\x00d\x00S\x00', or b'\x00\x01\x04\x01\x04\x05', or both. However, it's bytes on 3.7 too.

Halp @oremanj?

@hynek hynek added this to the 19.2 milestone Jun 2, 2019
@oremanj
Copy link
Contributor

oremanj commented Jun 3, 2019

Sorry, I’ve been out of town for a few days. Will try to look into this within the next day or two.

My unfounded suspicion is that the signature of CodeType changed in 3.8 to add a positional-only arguments count, and we just need to update our call to the CodeType constructor accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants