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

Correct error message for binary_to_existing_atom/2 #4901

Merged
merged 1 commit into from
May 28, 2021

Conversation

bjorng
Copy link
Contributor

@bjorng bjorng commented May 27, 2021

The extended error information for binary_to_existing_atom/2 was wrong
when the encoding was utf8 or unicode:

1> binary_to_existing_atom(<<"oops doesnt_really_exist">>, utf8).
** exception error: bad argument
     in function  binary_to_existing_atom/2
        called as binary_to_existing_atom(<<"oops doesnt_really_exist">>,utf8)
        *** argument 1: invalid UTF8 encoding

Corrected:

1> binary_to_existing_atom(<<"oops doesnt_really_exist">>, utf8).
** exception error: bad argument
     in function  binary_to_existing_atom/2
        called as binary_to_existing_atom(<<"oops doesnt_really_exist">>,utf8)
        *** argument 1: not an already existing atom

Also fixed a similar problem for list_to_existing_atom/1.

Closes #4900.

@bjorng bjorng added team:VM Assigned to OTP team VM fix testing currently being tested, tag is used by OTP internal CI labels May 27, 2021
@bjorng bjorng self-assigned this May 27, 2021
@bjorng bjorng linked an issue May 27, 2021 that may be closed by this pull request
@bjorng bjorng force-pushed the bjorn/fix-error-info/GH-4900/OTP-17449 branch from 8660d07 to 3fdabfb Compare May 27, 2021 11:13
The extended error information for `binary_to_existing_atom/2` was wrong
when the encoding was `utf8` or `unicode`:

    1> binary_to_existing_atom(<<"oops doesnt_really_exist">>, utf8).
    ** exception error: bad argument
         in function  binary_to_existing_atom/2
            called as binary_to_existing_atom(<<"oops doesnt_really_exist">>,utf8)
            *** argument 1: invalid UTF8 encoding

Corrected:

    1> binary_to_existing_atom(<<"oops doesnt_really_exist">>, utf8).
    ** exception error: bad argument
         in function  binary_to_existing_atom/2
            called as binary_to_existing_atom(<<"oops doesnt_really_exist">>,utf8)
            *** argument 1: not an already existing atom

Also fixed a similar problem for `list_to_existing_atom/1`.

Closes erlang#4900.
@bjorng bjorng force-pushed the bjorn/fix-error-info/GH-4900/OTP-17449 branch from 3fdabfb to c1942e3 Compare May 27, 2021 11:14
@bjorng
Copy link
Contributor Author

bjorng commented May 27, 2021

Forgot to fix the bug for list_to_existing_atom/1. Fixed now.

@garazdawi garazdawi self-requested a review May 27, 2021 13:04
@bjorng bjorng merged commit cacfc87 into erlang:maint May 28, 2021
@bjorng bjorng deleted the bjorn/fix-error-info/GH-4900/OTP-17449 branch May 28, 2021 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong error message for binary_to_existing_atom/2
2 participants