Skip to content

breaking change with 3.14: local method list() interferes with typingΒ #219

@parmentelat

Description

@parmentelat

with this input file here

https://github.com/fit-r2lab/rhubarbe/blob/292f58ae86db47e7443bc49e51a1011be2178f61/rhubarbe/inventorypdus.py

I am seeing this error with a newly installed Python-3.14
It was working just fine with 3.13

In [3]: InventoryPdus.from_yaml("""
   ...: pdu_hosts: []
   ...: devices: []
   ...: """)

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~/miniconda3/envs/rhubarbe/lib/python3.14/site-packages/dataclass_wizard/loader_selection.py:75, in fromdict(cls, d)
     74 try:
---> 75     load = CLASS_TO_LOAD_FUNC[cls]
     76 except KeyError:

KeyError: <class 'rhubarbe.inventorypdus.InventoryPdus'>

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 InventoryPdus.from_yaml("""
      2 pdu_hosts: []
      3 devices: []
      4 """)

File ~/miniconda3/envs/rhubarbe/lib/python3.14/site-packages/dataclass_wizard/wizard_mixins.py:254, in YAMLWizard.from_yaml(cls, string_or_stream, decoder, **decoder_kwargs)
    250     decoder = yaml.safe_load
    252 o = decoder(string_or_stream, **decoder_kwargs)
--> 254 return fromdict(cls, o) if isinstance(o, dict) else fromlist(cls, o)

<snip>

File ~/miniconda3/envs/rhubarbe/lib/python3.14/annotationlib.py:205, in ForwardRef.evaluate(self, globals, locals, type_params, owner, format)
    203 code = self.__forward_code__
    204 try:
--> 205     return eval(code, globals=globals, locals=locals)
    206 except Exception:
    207     if not is_forwardref_format:

File <string>:1

TypeError: 'function' object is not subscriptable

I'm eager to hear if this rings a bell

I can also turn this into a Minimal Reproducible Example, if it helps pinpointing the issue, just let me know

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions