Patch for possible resolution of https://bugs.kde.org/show_bug.cgi?id=416037
ClosedPublic

Authored by paolini on Thu, Jan 9, 5:44 PM.

Details

Summary

After transition python2 -> python3 a crash is experienced when closing kig in case an object is create via python scripting.

Diff Detail

Repository
R331 Kig
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
paolini created this revision.Thu, Jan 9, 5:44 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptThu, Jan 9, 5:44 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
paolini requested review of this revision.Thu, Jan 9, 5:44 PM

Looks reasonable.

But I am not sure about the comment, i.e., whether the Kig maintainer(s) want this kind of verbose documentation in the code (as opposed to in the commit history only) or not. (I guess it mostly depends on how likely somebody is to accidentally change it back if the comment is missing.)

paolini updated this revision to Diff 73166.Fri, Jan 10, 12:02 AM

Removed comments

Since I forgot to mention, this is a patch agains bug #416037

wbauer added a subscriber: wbauer.Thu, Jan 16, 7:58 PM
wbauer added inline comments.
scripting/python_scripter.cc
431

This breaks the build with python2 though.

Maybe add a conditional like it's done in https://cgit.kde.org/kig.git/commit/?id=c0aa768f28219ce8b3c275a6d13ad69757e3c7af ?

paolini added inline comments.Thu, Jan 16, 11:17 PM
scripting/python_scripter.cc
431

Actually Py_Finalze() should still work for compatibility reasons in python3, so we could simply
substitute Py_FinalizeEx() with Py_Finalize()

wbauer added inline comments.Fri, Jan 17, 2:37 PM
scripting/python_scripter.cc
431

I saw now that Py_FinalizeEx() exists only since python version 3.6.
So this should be changed anyway, even if we don't care for python2 anymore.

But yes, it's probably best to just switch back to Py_Finalize(), I suppose. The return value is not checked anyway.

paolini updated this revision to Diff 73809.Sat, Jan 18, 5:43 AM

Going back to original Py_Finalize() to maintain compatibility with pithon2 and earlier versions of python3

This revision was not accepted when it landed; it landed in state Needs Review.Sat, Jan 18, 6:18 AM
This revision was automatically updated to reflect the committed changes.