[Patches] [ python-Patches-1158926 ] Names conflict with QT (on linux)

SourceForge.net noreply at sourceforge.net
Tue Mar 8 13:19:34 CET 2005


Patches item #1158926, was opened at 2005-03-08 11:07
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1158926&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: CyberRan (cyberran)
Assigned to: Nobody/Anonymous (nobody)
Summary: Names conflict with QT (on linux)

Initial Comment:
The patch fixes a problem when embedding python 2.4
(using static library) in an application that also link
against qt 3.3 (using the qt-mt shared library). 

If an XML import is used in an application containning
the QT library, a strange segmentation fault occoured.
After reasearching this problem, I found out that there
is a name conflict for a symbol exported by the QT
library and the pyexpat module SO file. 

The symbol name is "XML_ErrorString". The cause for
this problem is the fact that the symbol is not defined
static in the pyexpat module (it is used in several
different compilation units).

The solution is to simply replace the "XML_ErrorString"
symbol with "PyXML_ErrorString".

Ran.

ran.peleg at gmail.com

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2005-03-08 13:19

Message:
Logged In: YES 
user_id=21627

I can't understand why this happened. What precisely was a
static library in your application, if both qt-mt and the
expat extension where shared libraries? Also, why does qt-mt
export XML_ErrorString? In my copy of qt-mt, it does not;
instead, it links with expat.so.1.

Unless you have modified something, the Python extension
module should have been loaded with RTLD_LOCAL, which should
have preferred its own definition of XML_ErrorString over
the one in Qt.

I'm hesitant to apply the patch, because:
a) these are original Expat sources, not Python sources, and
we prefer to use them unmodified (or else a future import of
expat will just undo this change),
b) renaming a single function does no good - if the problem
can occur with this function, it can occur with any other
function,
c) even in your application, I wonder why renaming
XML_ErrorString solved the problem. If you really somehow
got an entire copy of Expat into your qt-mt, and if you
really somehow managed to make pyexpat find parts of Expat
in qt-mt, this problem should have occurred with any other
of the qt symbols as well.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1158926&group_id=5470


More information about the Patches mailing list