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

Base: prevent precision infinite recursion #52910

Merged
merged 1 commit into from
Jan 23, 2024
Merged

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented Jan 15, 2024

Make the single-argument method of _precision into its own function.

Now precision(Union{Float16,Float32}) results in a MethodError instead of in a StackOverflowError.

Fixes #52909

@nsajko nsajko added the bugfix This change fixes an existing bug label Jan 15, 2024
base/float.jl Outdated Show resolved Hide resolved
@nsajko nsajko marked this pull request as draft January 17, 2024 10:07
Make the single-argument method of `_precision` into its own function.

Now `precision(Union{Float16,Float32})` will result in a `MethodError`
instead of in a `StackOverflowError`.

Fixes JuliaLang#52909
@nsajko nsajko marked this pull request as ready for review January 17, 2024 10:59
@nsajko
Copy link
Contributor Author

nsajko commented Jan 17, 2024

Added back the _ name prefix, removed a default argument value (=2), added more tests.

@nsajko
Copy link
Contributor Author

nsajko commented Jan 22, 2024

bump

@gbaraldi gbaraldi merged commit 4dcd271 into JuliaLang:master Jan 23, 2024
7 checks passed
@nsajko nsajko deleted the prec branch January 23, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

precision(Union{Float16,Float32}) recurs without bound (until StackOverflowError)
2 participants