Skip to content
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

fix: remove wrapping Optional if python version < 3.11 #186

Closed
wants to merge 2 commits into from

Conversation

jokasimr
Copy link
Contributor

Fixes #182

Comment on lines +307 to +310
if sys.version_info[1] < 11:
for name, param in inspect.signature(func).parameters.items():
if param.default is None:
hints[name] = get_args(hints[name])[0]
Copy link
Member

Choose a reason for hiding this comment

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

What happens if the function signature is f(a: int | None = None)? We don't want to remove the optional in that case!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha, I thought an additional optional was added as a wrapper also in that case, but I guess it isn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if there's a good way to fix this. Maybe better in that case to just do nothing and wait for later python versions like was suggested in the issue.

Copy link
Member

Choose a reason for hiding this comment

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

Agree, do nothing!

@jokasimr jokasimr closed this Sep 26, 2024
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.

Param setting not working with default values
2 participants