Skip to content

Commit fa92a77

Browse files
author
unknown
committed
BUG: avoid crash with when passing file pointer
This is just a workaround. Proper behavior would probably be to detect this or just use the python language API to compile the code.
1 parent bd3651b commit fa92a77

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/PythonQtImporter.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,12 @@ PythonQtImport::getCodeFromData(const QString& path, int isbytecode,int /*ispack
631631
// save a pyc file if possible
632632
QDateTime time;
633633
time = PythonQt::importInterface()->lastModifiedDate(path);
634-
writeCompiledModule((PyCodeObject*)code, path+"c", time.toTime_t());
634+
// Workaround for python release build and pythonqt debug build:
635+
// if this line is not commented out, you get a crash.
636+
// But since saving the .pyc file is a performance optimization
637+
// only it is okay to comment this out.
638+
// TODO: can the build type of python be checked with a define?
639+
//writeCompiledModule((PyCodeObject*)code, path+"c", time.toTime_t());
635640
}
636641
}
637642
return code;

0 commit comments

Comments
 (0)