timgates42/namedlist

namedlist fails on python 3.8.5

Closed this issue · 3 comments

I appreciate namedlist, even though it's not necessarily known, it's useful.

I get this error with the canonical example:

>>> from namedlist import namedlist
>>> Point = namedlist('Point', 'x y')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    Point = namedlist('Point', 'x y')
  File "/usr/local/lib/python3.8/site-packages/namedlist.py", line 381, in namedli
st
    type_dict = {'__init__': _make_fn('__init__', _nl_init, fields, defaults),
  File "/usr/local/lib/python3.8/site-packages/namedlist.py", line 180, in _make_fn
    code = compile(module_node, '<string>', 'exec')
TypeError: required field "posonlyargs" missing from arguments
>>>

This is tested on 3.7.5 and it works.

$ python3
Python 3.7.5 (default, Mar 22 2020, 07:14:26)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from namedlist import namedlist
>>> Point = namedlist('Point', 'x y')
>>>

See also notice on Python's bug tracker:
https://bugs.python.org/issue38977

Here is the diagnosis, according to user xtreak:

From Python 3.8, type_ignores is also mandatory for ast.Module as discussed in issue35894 which also needs to be fixed in the module. Closing this as third party as I don't see any apparent regression here in 3.8.

https://bugs.python.org/msg357844

I close this issue, because I posted it on the official repo on:
https://gitlab.com/ericvsmith/namedlist/-/issues/1