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

warn_if #762

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

warn_if #762

wants to merge 1 commit into from

Conversation

nstarman
Copy link

Fixes #761.

I haven't yet cracked why the warnings aren't raised when a function is jitted.

Signed-off-by: nstarman <[email protected]>
@nstarman nstarman marked this pull request as draft June 17, 2024 21:14
@patrick-kidger
Copy link
Owner

Let me know if you figure it out!
Other than that -- this has a lot of duplicate code with error_if. Probably this is most easily done with a Boolean flag instead?

@nstarman
Copy link
Author

Other than that -- this has a lot of duplicate code with error_if. Probably this is most easily done with a Boolean flag instead?

I was considering that as well, but warn has a number of keyword arguments, like category and stacklevel that aren't shared with raise.
Perhaps the combining could be done at the branched_error_if_impl level, which isn't exposed to the user and thus it's less important if the kwargs are a bit of a mess?

@patrick-kidger
Copy link
Owner

Yeah, I think that's the right place to do it!

(Although FWIW I think some stuff like stacklevel may be incompatible with JIT? Or maybe you need to just preemptively grab the stack at trace time just in case you want to warn about it later?)

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.

Add a warn_if
2 participants