Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError when setting ExceptionDictTransformer's constructor arguments locals_max_string and locals_max_length to None #672

Closed
Sh4pe opened this issue Nov 13, 2024 · 0 comments · Fixed by #675

Comments

@Sh4pe
Copy link
Contributor

Sh4pe commented Nov 13, 2024

As of version 24.3.0 (see #627), ExceptionDictTransformer interprets the constructor arguments locals_max_string and locals_max_length as type int | None where None supposedly disables abbreviation or truncation. However, if you set one of those to None, you get a TypeError:

TypeError: '<' not supported between instances of 'NoneType' and 'int'

This is because of the following snippet:

if locals_max_length < 0:
msg = f'"locals_max_length" must be >= 0: {locals_max_length}'
raise ValueError(msg)
if locals_max_string < 0:
msg = f'"locals_max_string" must be >= 0: {locals_max_string}'
raise ValueError(msg)

It should contain logic that handles the None case.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant