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

omero.gateway assert_re decorator raises TypeError during exception checking #446

Open
jmuhlich opened this issue Mar 4, 2025 · 1 comment · May be fixed by #447
Open

omero.gateway assert_re decorator raises TypeError during exception checking #446

jmuhlich opened this issue Mar 4, 2025 · 1 comment · May be fixed by #447

Comments

@jmuhlich
Copy link
Contributor

jmuhlich commented Mar 4, 2025

def __init__(self, onPrepareFailureReturnNone=True, ignoreExceptions=None):

except ctx.ignoreExceptions:

The default value of ignoreExceptions in the assert_re decorator initializer is None but except None is invalid, raising a TypeError:

TypeError: catching classes that do not inherit from BaseException is not allowed

Exception chaining does retain the original exception and traceback but it's confusing to see this extra unrelated error.

except None was allowed in Python 2, where the argument to except could be anything and non-exception types would simply never match any actual raised exception. The no-match equivalent for Python 3 is an empty tuple, so I think the default arg for ignoreExceptions should be changed to ().

@jmuhlich
Copy link
Contributor Author

jmuhlich commented Mar 4, 2025

Sorry, duplicate of #356 and #308 ! But I guess I did add something in the form of a suggested fix... :)

@jmuhlich jmuhlich linked a pull request Mar 4, 2025 that will close this issue
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 a pull request may close this issue.

1 participant