Conversion of `char` to python is broken in Python >= 3.0
- Dominant language
- C++
- Stars
- 537
- Forks
- 223
- Avg merge
- 11h 22m
- Merged PRs (30d)
- 2
Description
`char` is currently being converted using `PyUnicode_FromStringAndSize(&x, 1)`, but [PyUnicode_FromStringAndSize](https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_FromStringAndSize) interprets the input string as UTF-8, so every char between 128 and 255 is a malformed UTF-8 string and can't be converted.
Before submitting a fix, I'd like to discuss the solution: returning a positive integer seems to be more appropriate, since this is the new convention in Python 3 (e.g., `b'a'[0]` returns 97 in Python 3, while it returns `b'a'` in Python 2). Also, this is more consistent with how `signed char` and `unsigned char` are currently converted (as integers too).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.