Conversion of `char` to python is broken in Python >= 3.0
- 主要言語
- C++
- スター
- 537
- フォーク
- 223
- 平均マージ
- 11時間 22分
- マージ済み PR(30日)
- 2
説明
`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).
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。