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

BUG: Exceptions are not explicitly raised in python when validating output. #26

Closed
zoj613 opened this issue Jul 20, 2021 · 0 comments · Fixed by #29
Closed

BUG: Exceptions are not explicitly raised in python when validating output. #26

zoj613 opened this issue Jul 20, 2021 · 0 comments · Fixed by #29
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@zoj613
Copy link
Owner

zoj613 commented Jul 20, 2021

cdef inline void validate_return_info(int info):
if info == HTNORM_ALLOC_ERROR:
raise MemoryError("Not enough memory to allocate resources.")
elif info < 0:
raise ValueError("Possible illegal value in one of the inputs.")
elif info > 0:
raise ValueError(
f"""Either the leading minor of the {info}'th order is not
positive definite (meaning the covariance matrix is also not
positive definite), or factorization of one of the inputs
returned a `U` with a zero in the {info}'th diagonal."""
)

Since this cython function has void return type, the raised exception is not propagated properly and thus gets treated as a warning.

To remedy this, the function should return an int. A value of zero when everything checks out and probably a -1 otherwise.

@zoj613 zoj613 added bug Something isn't working good first issue Good for newcomers labels Jul 20, 2021
@zoj613 zoj613 changed the title BUG: Exceptions are not explicitly raised when validating output. BUG: Exceptions are not explicitly raised in python when validating output. Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant