After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 360411 - gimpfu.py uses Python 2.4 function unconditionally
gimpfu.py uses Python 2.4 function unconditionally
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Gimp-Python
git master
Other Windows
: Normal normal
: ---
Assigned To: Manish Singh
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-10-07 15:20 UTC by Hans Breuer
Modified: 2006-10-07 21:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Hans Breuer 2006-10-07 15:20:52 UTC
configure.in checks for Python 2.3.5, which I like as minimal version cause there are troubles on win32/gtk with Python >= 2.4 due to their use of a newer c-runtime version. But the error path in gimpfu.py uses a function only available from 2.4. The patch below gets around that. Ok to apply?

--- from-cvs/gimp/plug-ins/pygimp/gimpfu.py	Sat Oct 07 12:12:50 2006
+++ my-gtk/gimp/plug-ins/pygimp/gimpfu.py	Sat Oct 07 15:47:35 2006
@@ -356,7 +356,11 @@
         expander.add(scrolled)
         scrolled.show()
 
-        label = gtk.Label(traceback.format_exc());
+	if "format_exc" in dir(traceback) :
+		label = gtk.Label(traceback.format_exc());
+	else :
+		# print_exc is only a short-hand function added with Python 2.4
+		label = gtk.Label(traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
         label.set_alignment(0.0, 0.0)
         label.set_padding(6, 6)
         label.set_selectable(True)
Comment 1 Michael Schumacher 2006-10-07 20:27:50 UTC
I use Python 2.4 without any problems, though. Is the c runtime only a problem for   builds made with the Microsoft compilers?
Comment 2 Hans Breuer 2006-10-07 20:45:55 UTC
If you have a Python build done with mingw you would not be plagued by having two c-runtimes in one process: msvcr71.dll (from Python 2.4, at least the official build) and msvcrt.dll (from gtk+ built either with mingw or msvc6). But in fact I don't know if this issue crashes with pygimp, but it definitely does with pydia:
http://mail.gnome.org/archives/dia-list/2006-September/msg00045.html

But the main point in this bug is checking for 2.3.5 but using 2.4 function.
Comment 3 Manish Singh 2006-10-07 21:10:00 UTC
sys.exc_{type, value, traceback} are long deprecated, I changed the code to not use them anywhere. There also isn't any need to special case around thin wrappers like format_exc imho.

2006-10-07  Manish Singh  <yosh@gimp.org>

        * plug-ins/pygimp/gimpfu.py: Don't use Python 2.4 specific functions,
        nor deprecated sys module attributes. Fixes bug #360411.
Comment 4 Manish Singh 2006-10-07 21:12:04 UTC
As far as the C runtime issue, Tor tells me the big worry is when you create C runtime objects from one place using one time, and pass it to another library using anothe runtime. pygimp doesn't do any of that, so it should be safe.