Eric Cousineau <eric.cousineau@tri.global> added the comment:

> I get an error with 3.8.10, but not on the main branch (3.11) [...]

Confirmed, using 3.11.0a1 (using Docker). Seems like at least the pickling is 
fixed?

> I'm confused -- your initial report talks about pickling fields, but your 
> tests are pickling the entire class... what am I missing?

Sorry about that; the original file, `enum_test.py`, was just trying to pickle 
an enum field, i.e. `DoesNotWork.a`. However, because it uses the type 
`DoesNotWork.NestedValue2`, `pickle` tries to unpackage that type, but cannot 
access it via name because `DoesNotWork.NestedValue2` is wrapped as an enum 
*field*, rather than just a normal field.

I've uploaded a new file, `enum_nested_type_test.py`, that perhaps shows the 
root cause - the `Enum` interprets the nested class as an enum field (wrapping 
it as an enum value), rather than as "just" a nested class. In contrast, it did 
not seem to wrap the function.

Does that make sense / help at all?

----------
Added file: https://bugs.python.org/file50384/enum_nested_type_test.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45546>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to