I just tried to disable the getreadbufferproc on Unicode objects. Most of the test suite continues to work. test_unicode fails, which is caused by "s#" not working anymore when in readbuffer_encode when testing the unicode_internal encoding. That could be fixed (*). More concerning, sre fails when matching a unicode string. sre uses the getreadbufferproc to get to the internal representation. If it has sizeof(Py_UNICODE) times as many bytes as it is long, we got a unicode buffer (?!?). I'm not sure what the right solution would be in this case: I *think* sre should have more specific knowledge of Unicode objects, so it should support objects with a buffer interface representing a 1-byte character string, or Unicode objects. Actually, is there anything wrong with sre operating on string and unicode objects only? It requires that the buffer has a single segment, anyway... Regards, Martin (*) The 'internal encoding' function should directly get to the representation of the unicode object, and readbuffer_encode could become Python: def readbuffer_encode(o,errors="strict"): b = buffer(o) return str(b),len(b) or be removed altogether, as it would (rightfully) stop working on unicode objects.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4