Undefined symbol with single threaded python

Bug #1092521 reported by Ulrich Seidl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
Medium
scoder

Bug Description

When using a single threaded python 2.7, and trying to do "from lxml import etree", I get the following error:

lib/python2.7/site-packages/lxml/etree.so: undefined symbol: PyThread_free_lock

Even though lxml was compiled with "python setup.py build --without-threading" and the compile time flag "WITHOUT_THREADING" was set when compiling lxml.etree.c, there are still some symbols left which require threading support in python. Doing a:

nm etree.so | grep -i thread

results in the following output:

         U PyThreadState_GetDict
         U PyThread_free_lock
         U _PyThreadState_Current
000239d0 t __pyx_f_4lxml_5etree_24_ParserDictionaryContext__findThreadParserContext
00054b90 t __pyx_f_4lxml_5etree_24_ParserDictionaryContext__getThreadDict
00054c50 t __pyx_f_4lxml_5etree_24_ParserDictionaryContext_initThreadDictRef
000367a0 t __pyx_f_4lxml_5etree_fixThreadDictNames
00036490 t __pyx_f_4lxml_5etree_fixThreadDictNamesForNode

I would assume that the three undefined *PyThread* symbols should not be in the etree.so library when compiled with "python setup.py build --without-threading".

Revision history for this message
scoder (scoder) wrote :

A patch that fixes this would be appreciated.

Revision history for this message
Ulrich Seidl (ulrich-seidl) wrote :

I would suggest to extend the if-clause ("if self._lock is not NULL") of the __dealloc__ method of the _ParserContext class with a check for config.ENABLE_THREADING. Same check is already done in __cinit__ method. At least with cython 0.17.4, gcc 4.4.6 & python 2.7.3 this solves the problem for me.

Revision history for this message
scoder (scoder) wrote :
Changed in lxml:
assignee: nobody → Stefan Behnel (scoder)
importance: Undecided → Medium
status: New → Fix Committed
Revision history for this message
scoder (scoder) wrote :

Released in lxml 3.1.0.

Changed in lxml:
status: Fix Committed → Fix Released
scoder (scoder)
Changed in lxml:
milestone: none → 3.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.