Skip to content

Conversation

@alexei
Copy link
Contributor

@alexei alexei commented Mar 25, 2024

Fixes #11653

@github-actions

This comment has been minimized.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@hauntsaninja
Copy link
Collaborator

Can this be object instead?

@JelleZijlstra
Copy link
Member

I think Any is more appropriate because we don't really want to accept all objects. For example, ideally we'd reject make_dataclass("T", [("x", 1)]).

@AlexWaygood
Copy link
Member

Yeah, I agree with Jelle. It can't actually be any object, so object isn't really accurate. The type just can't be expressed without a TypeForm-esque thing.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood changed the title fix: use Any for field type in make_dataclass Use Any for field type in make_dataclass Mar 25, 2024
@AlexWaygood AlexWaygood merged commit 4df0725 into python:main Mar 25, 2024
@AlexWaygood
Copy link
Member

Thanks @alexei!

@alexei alexei deleted the fix-11653-make_dataclass_type_hints branch March 26, 2024 11:20
@alexei
Copy link
Contributor Author

alexei commented Mar 26, 2024

Thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dataclasses.make_dataclass should accept Any, not type

4 participants