durusmail: quixote-users: error in quixote.ptl.cimport
error in quixote.ptl.cimport
2005-10-24
2005-10-24
error in quixote.ptl.cimport
Titus Brown
2005-10-24
-> I'm upgrading an old app from Quixote 1.x to Quixote 2.3, and I ran into
-> an interesting problem: even though 'quixote.html.html_quote' no longer
-> exists in Quixote 2.3, when using the 'cimport' PTL module you can
-> import it.

Judicious placement of printfs throughout the code identified the
problem.  Here's the fix:

(the diff is attached as a file, too.)

*** cimport.c   2005-03-16 06:12:28.000000000 -0800
--- cimport.c.new       2005-10-24 09:50:34.000000000 -0700
***************
*** 321,327 ****

                m = call_find_load(fullname, subname, path);

!               if (m != NULL && mod != Py_None) {
                        if (PyObject_SetAttrString(mod, subname, m) < 0) {
                                Py_DECREF(m);
                                m = NULL;
--- 321,327 ----

                m = call_find_load(fullname, subname, path);

!               if (m != NULL && m != Py_None && mod != Py_None) {
                        if (PyObject_SetAttrString(mod, subname, m) < 0) {
                                Py_DECREF(m);
---                             m = NULL;

This fix makes sense to me & it works in my app as well as all three
Quixote demos.

cheers,
--titus
reply