Fix #1028 ( Fix podofo convert pystring to PdfString bug )

This commit is contained in:
Kovid Goyal 2019-08-10 19:34:11 +05:30
parent e1e3f41065
commit 93911255f6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -31,7 +31,8 @@ pdf::podofo_convert_pdfstring(const PdfString &s) {
const PdfString
pdf::podofo_convert_pystring(PyObject *val) {
#if PY_MAJOR_VERSION > 2
return s(reinterpret_cast<const pdf_utf8*>(PyUnicode_AsUTF8(val)));
PdfString s(reinterpret_cast<const pdf_utf8*>(PyUnicode_AsUTF8(val)));
return s;
#else
PyObject *temp = PyUnicode_AsUTF8String(val);
if (!temp) throw std::bad_alloc();