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

Unchecked _max_tb causing TypeError: '<=' not supported between instances of 'int' and 'nonetype' #137

Closed
GPhilo opened this issue Aug 17, 2023 · 7 comments

Comments

@GPhilo
Copy link

GPhilo commented Aug 17, 2023

There seems to be a missing check in this line causing a TypeError inside log_failure.

Shouldn't this be checking for _max_tb as well before the <=, like:

if (_max_tb is None) or (_num_failures <= _max_tb):
# rest of code
@okken
Copy link
Owner

okken commented Aug 29, 2023

Nice catch. It seems like it, looking at the code, since _max_tb defaults to None in this file.
However, in use, it is always set.
I can't come up with a use case to make this fail line raise an exception as is.

I think the fix may be to set the default value to 1 instead of None, since it more matches the current implementation.
Thanks for reviewing the code.

@okken okken closed this as completed Aug 29, 2023
@GPhilo
Copy link
Author

GPhilo commented Aug 29, 2023

Haha, I don't know if I'm using the code in an unexpected way then, but for me that was still initialized to None and causing issues 😄

@okken okken reopened this Aug 29, 2023
@okken
Copy link
Owner

okken commented Aug 29, 2023

Do you have a toy example that causes the failure?

@okken
Copy link
Owner

okken commented Aug 29, 2023

I'll fix it, but I'd like to have a way to reproduce the problem

@GPhilo
Copy link
Author

GPhilo commented Aug 31, 2023

I'm going on holiday tomorrow for a week, but once I'm back home I'll try to come up with some code to reproduce the issue (just so you know why my next comment will take a while).

@okken
Copy link
Owner

okken commented Sep 15, 2023

I've got a fix, I'll push in place soon

@okken
Copy link
Owner

okken commented Sep 22, 2023

Fixed with 2.2.2

@okken okken closed this as completed Sep 22, 2023
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

No branches or pull requests

2 participants