This commit is contained in:
Kovid Goyal 2019-08-10 22:12:53 +05:30
parent 93911255f6
commit b808ee0078
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

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