Comments (5)
Oops, I forgot to merge the branch. You can check the version 2.10.1 :)
from mashumaro.
Hi @sizmailov
I see this can't be reproduced on 3.10. But on the previous versions it could be fixed by adding self.cls.__dict__
to typing.get_type_hints
here as suggested here https://bugs.python.org/issue42829#msg384423. I'll see if there's any problem with that.
from mashumaro.
I confirm, bug affects 3.8, 3.9, but not 3.10.
Interesting. The bug marked as "won't fix" disappears in next release 🙃
from mashumaro.
Fixed in 2.10.
from mashumaro.
Fixed in 2.10.
Just tried new release. Looks like the initial snippet still fails with mashumaro==2.10 with python 3.8 and 3.9...
Traceback
Traceback (most recent call last):
File "/tmp/bug/main.py", line 15, in <module>
cfg = Root.from_dict({"nested": {"x": 1}})
File "/tmp/bug/venv-3.9/lib/python3.9/site-packages/mashumaro/serializer/base/dict.py", line 55, in from_dict
builder.add_from_dict()
File "/tmp/bug/venv-3.9/lib/python3.9/site-packages/mashumaro/serializer/base/metaprogramming.py", line 375, in add_from_dict
return self._add_from_dict()
File "/tmp/bug/venv-3.9/lib/python3.9/site-packages/mashumaro/serializer/base/metaprogramming.py", line 288, in _add_from_dict
self._add_from_dict_lines()
File "/tmp/bug/venv-3.9/lib/python3.9/site-packages/mashumaro/serializer/base/metaprogramming.py", line 311, in _add_from_dict_lines
for fname, ftype in self.field_types.items():
File "/tmp/bug/venv-3.9/lib/python3.9/site-packages/mashumaro/serializer/base/metaprogramming.py", line 194, in field_types
return self.__get_field_types()
File "/tmp/bug/venv-3.9/lib/python3.9/site-packages/mashumaro/serializer/base/metaprogramming.py", line 168, in __get_field_types
raise UnresolvedTypeReferenceError(self.cls, name) from None
mashumaro.exceptions.UnresolvedTypeReferenceError: Class Root has unresolved type reference Nested in some of its fields
from mashumaro.
Related Issues (20)
- Investigate support for recursive Union types HOT 2
- Supports `numpy.ndarray` type for `orjson` HOT 2
- Add support for PEP 695
- Union type of [int | float] not serialized correctly HOT 2
- Add an alternative way to assign a field alias with annotations
- Add support for PEP 696
- Annotated SerializationStrategy used as a field serialization strategy leads to RecursionError
- Suppress warning about Union type HOT 4
- Take description from docstring HOT 4
- Incorrect type annotation for the result of `to_json` in `DataClassORJSONMixin`
- Different results between standard library json and orjson HOT 3
- Python 3.12.4 Compatibility
- Some tests error out with typing_extensions>=4.12
- More issues on Python 3.12.4 HOT 5
- [BUG] to_msgpack doesn't behave properly with Discriminator(include_subtypes=True) HOT 1
- [BUG] Can't generate expected JSON Schema when using `dict` HOT 6
- Unable to convert msg to msgpack (was originally working on mashumaro 2.9 HOT 1
- strict_map_keys for DataClassMessagePackMixin HOT 1
- unable to serialize torch.tensor as float HOT 1
- `Discriminator` not respected by `JSONEncoder` when it works for `to_json`.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mashumaro.