[issue39113] PyUnicode_AsUTF8AndSize Sometimes Segfaults With Incomplete Surrogate Pair

2019-12-21 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue39113] PyUnicode_AsUTF8AndSize Sometimes Segfaults With Incomplete Surrogate Pair

2019-12-20 Thread william.ayd
william.ayd added the comment: Hmm my mistake - thanks! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39113] PyUnicode_AsUTF8AndSize Sometimes Segfaults With Incomplete Surrogate Pair

2019-12-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Your function returns a borrowed reference. It xiuld cause ceash even without calling PyUnicode_AsUTF8AndSize. Add Py_INCREF(str) -- nosy: +serhiy.storchaka resolution: -> not a bug ___ Python tracker

[issue39113] PyUnicode_AsUTF8AndSize Sometimes Segfaults With Incomplete Surrogate Pair

2019-12-20 Thread william.ayd
New submission from william.ayd : With the attached extension module, if I run the following in the REPL: >>> import libtest >>> >>> libtest.error_if_not_utf8("foo") 'foo' >>> libtest.error_if_not_utf8("\ud83d") Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: