You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A "narrow" Python build is one where unicode objects are UTF-16 internally (most characters are 2 bytes, but characters beyond U+FFFF get represented by a 4-byte "surrogate pair"), whereas in "wide" builds they're UCS-4 (every character takes 4 bytes).
The system build on Mac OS X, and the Python.org Windows and Mac builds, are "narrow" Python builds, but apparently most Linux builds are "wide." base65536 fails on "narrow" builds with:
>>> a = base65536.encode(x)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/vitorio/Library/Python/2.7/lib/python/site-packages/base65536/core.py", line 118, in encode
stream.write(unichr(code_point))
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
Replacing unichr() with a struct-based solution such as in HypothesisWorks/hypothesis@f49b829 allows encoding to work, but decoding continues to fail:
>>> a = base65536.encode(b"hello world")
>>> a
u'\u9a68\ua36c\u556f\U00012077\ua372\u1564'
>>> base65536.decode(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/vitorio/Library/Python/2.7/lib/python/site-packages/base65536/core.py", line 136, in decode
'point: %d' % code_point)
ValueError: Invalid Base-65536 code point: 55304
A "narrow" Python build is one where unicode objects are UTF-16 internally (most characters are 2 bytes, but characters beyond U+FFFF get represented by a 4-byte "surrogate pair"), whereas in "wide" builds they're UCS-4 (every character takes 4 bytes).
The system build on Mac OS X, and the Python.org Windows and Mac builds, are "narrow" Python builds, but apparently most Linux builds are "wide." base65536 fails on "narrow" builds with:
Replacing
unichr()
with astruct
-based solution such as in HypothesisWorks/hypothesis@f49b829 allows encoding to work, but decoding continues to fail:Replacing
unichr()
andord()
andint2byte()
withunichr()
andbyteord()
andbytechr()
from https://github.com/behdad/fonttools/blob/master/Lib/fontTools/misc/py23.py#L20 fails similarly:The text was updated successfully, but these errors were encountered: