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

Char[] and byte[] ambiguity between bytes, str, and bytearray #598

Open
Thrameos opened this issue Mar 6, 2020 · 0 comments
Open

Char[] and byte[] ambiguity between bytes, str, and bytearray #598

Thrameos opened this issue Mar 6, 2020 · 0 comments

Comments

@Thrameos
Copy link
Contributor

Thrameos commented Mar 6, 2020

One of the left over issues from Python 2 is the ambiguity between bytes, bytearray, and str when selecting the overload for byte[] and char[]. Simple commands like JString(bytearray([1])) currently fail with ambiguity between java.lang.String(char[]) and java.lang.String(byte[]). bytearray is pretty obviously best matched to byte[] but we have three implicit conversions defined that match ''PyUnicode'', ''PyBytes'', and ''PySequence''.

I would recommend modifying the matches to be
byte[] <=> str (none) reason: string to math type prohibited)
byte[] <=> bytes, bytearray (exact) reason: bytes are bytes
byte[] <=> Sequence (implicit) reason: a list of numbers can be converted
char[] <=> str (exact)
char[] <=> Sequence, bytes, bytearray (implicit)

Personally I think the last one should be "none" but it would break code.

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

No branches or pull requests

1 participant