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
Pydantic dataclasses
break __eq__
method generated by stdlib dataclasses
when upgrading from v1.6.1 to v1.7.2
#2162
Labels
bug V1
Bug related to Pydantic V1.X
Comments
Hi @jtrh and thanks for reporting! |
PrettyWood
added a commit
to PrettyWood/pydantic
that referenced
this issue
Dec 7, 2020
… can still equal its stdlib dataclass equivalent closes pydantic#2162
4 tasks
PrettyWood
added a commit
to PrettyWood/pydantic
that referenced
this issue
Dec 8, 2020
…its stdlib dataclass equivalent closes pydantic#2162
3 tasks
4 tasks
jtrobles-cdd
added a commit
to cordada/lib-cl-sii-python
that referenced
this issue
Aug 31, 2022
Changelog: - 1.10.1 (2022-08-31): https://github.com/pydantic/pydantic/blob/v1.10.1/HISTORY.md#v1101-2022-08-31 - 1.10.0 (2022-08-30): https://github.com/pydantic/pydantic/blob/v1.10.0/HISTORY.md#v1100-2022-08-30 - … - 1.9.0 (2021-12-31): https://github.com/pydantic/pydantic/blob/v1.10.0/HISTORY.md#v190-2021-12-31 - 1.8.2 (2021-05-11): https://pydantic-docs.helpmanual.io/changelog/#v182-2021-05-11 - 1.8.1 (2021-03-03): https://pydantic-docs.helpmanual.io/changelog/#v181-2021-03-03 - 1.8 (2021-02-26): https://pydantic-docs.helpmanual.io/changelog/#v18-2021-02-26 - … - 1.7 (2020-10-26): https://pydantic-docs.helpmanual.io/changelog/#v17-2020-10-26 Code diff: pydantic/pydantic@v1.6.2...v1.10.1 --- Add version exclusions for Pydantic 1.7.*, 1.8.*, and 1.9.* to Setuptools configuration (`setup.py`) because those versions have a buggy `dataclasses` implementation (see pydantic/pydantic#2162).
jtrobles-cdd
added a commit
to cordada/lib-cl-sii-python
that referenced
this issue
Aug 31, 2022
Changelog: - 1.10.1 (2022-08-31): https://github.com/pydantic/pydantic/blob/v1.10.1/HISTORY.md#v1101-2022-08-31 - 1.10.0 (2022-08-30): https://github.com/pydantic/pydantic/blob/v1.10.0/HISTORY.md#v1100-2022-08-30 - … - 1.9.0 (2021-12-31): https://github.com/pydantic/pydantic/blob/v1.10.0/HISTORY.md#v190-2021-12-31 - 1.8.2 (2021-05-11): https://pydantic-docs.helpmanual.io/changelog/#v182-2021-05-11 - 1.8.1 (2021-03-03): https://pydantic-docs.helpmanual.io/changelog/#v181-2021-03-03 - 1.8 (2021-02-26): https://pydantic-docs.helpmanual.io/changelog/#v18-2021-02-26 - … - 1.7 (2020-10-26): https://pydantic-docs.helpmanual.io/changelog/#v17-2020-10-26 Code diff: pydantic/pydantic@v1.6.2...v1.10.1 --- Add version exclusions for Pydantic 1.7.*, 1.8.*, and 1.9.* to Setuptools configuration (`setup.py`) because those versions have a buggy `dataclasses` implementation (see GitHub issue pydantic/pydantic#2162, created by @jtrh).
jtrobles-cdd
added a commit
to cordada/lib-cl-sii-python
that referenced
this issue
Aug 31, 2022
Changelog: - 1.10.1 (2022-08-31): https://github.com/pydantic/pydantic/blob/v1.10.1/HISTORY.md#v1101-2022-08-31 - 1.10.0 (2022-08-30): https://github.com/pydantic/pydantic/blob/v1.10.0/HISTORY.md#v1100-2022-08-30 - … - 1.9.0 (2021-12-31): https://github.com/pydantic/pydantic/blob/v1.10.0/HISTORY.md#v190-2021-12-31 - 1.8.2 (2021-05-11): https://pydantic-docs.helpmanual.io/changelog/#v182-2021-05-11 - 1.8.1 (2021-03-03): https://pydantic-docs.helpmanual.io/changelog/#v181-2021-03-03 - 1.8 (2021-02-26): https://pydantic-docs.helpmanual.io/changelog/#v18-2021-02-26 - … - 1.7 (2020-10-26): https://pydantic-docs.helpmanual.io/changelog/#v17-2020-10-26 Code diff: pydantic/pydantic@v1.6.2...v1.10.1 --- Add version exclusions for Pydantic 1.7.*, 1.8.*, and 1.9.* to Setuptools configuration (`setup.py`) because those versions have a buggy `dataclasses` implementation (see GitHub issue pydantic/pydantic#2162, created by @jtrh). ```python >>> import packaging.specifiers >>> pydantic_specifier_set = packaging.specifiers.SpecifierSet('>=1.6.2,!=1.7.*,!=1.8.*,!=1.9.*') >>> pydantic_specifier_set.contains('1.6.2') True >>> pydantic_specifier_set.contains('1.7') False >>> pydantic_specifier_set.contains('1.7.0') False >>> pydantic_specifier_set.contains('1.8.1') False >>> pydantic_specifier_set.contains('1.9.2') False >>> pydantic_specifier_set.contains('1.10.0a1') False >>> pydantic_specifier_set.contains('1.10.0b1') False >>> pydantic_specifier_set.contains('1.10.0') True ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checks
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:Output with
pydantic==1.7.2
:Output with
pydantic==1.6.1
:I think this issue may be related to the automatic conversion of standard library
dataclasses
to Pydanticdataclasses
. The__eq__
method generated by the standard library checks that both instances are of the same class (seedataclasses._cmp_fn
anddataclasses._process_class
), which is true in 1.6.1 (assert foo.__class__ is bar.c.__class__
succeeds), but not in 1.7.2 (assert foo.__class__ is bar.c.__class__
fails, butassert issubclass(bar.c.__class__, foo.__class__)
succeeds).The text was updated successfully, but these errors were encountered: