1
0
mirror of https://github.com/thp/pyotherside.git synced 2025-01-28 23:52:55 +08:00

Do not decref PySys_GetObject return values (Fixes #84)

The function PySys_GetObject() returns a borrowed reference
only, so we must incref/decref the value accordingly, and
not take ownership of the returned value.

https://docs.python.org/3/c-api/sys.html#c.PySys_GetObject
This commit is contained in:
Thomas Perl 2017-10-14 12:31:36 +02:00
parent b435941e51
commit d1e329048a

View File

@ -652,7 +652,7 @@ QPythonPriv::instance()
QString
QPythonPriv::importFromQRC(const char *module, const QString &filename)
{
PyObjectRef sys_modules(PySys_GetObject((char *)"modules"), true);
PyObjectRef sys_modules(PySys_GetObject((char *)"modules"));
if (!PyMapping_Check(sys_modules.borrow())) {
return QString("sys.modules is not a mapping object");
}