[Pyrex] undefined symbol: None
John J Lee
jjl at pobox.com
Sat Jun 21 21:35:26 CEST 2003
What am I doing wrong here?
tidylib[0]$ python2.2
Python 2.2.1 (#1, Sep 7 2002, 14:34:30)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _tidylib
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: ./_tidylib.so: undefined symbol: None
>>>
2.3b1 gives me the same result. I'm using Pyrex 0.7.2.
The relevant bit of _tidylib.c seems to be this:
/* "/home/john/comp/dev/wwwsearch/tidylib/_tidylib.pyx":126 */
__pyx_1 = None(__pyx_v_doc); if (PyErr_Occurred()) {__pyx_filename = __pyx_f1; __pyx_lineno = 126; goto __pyx_L1;}
__pyx_2 = PyInt_AsLong(__pyx_v_optId); if (PyErr_Occurred())
{__pyx_filename = __pyx_f1; __pyx_lineno = 126; goto __pyx_L1;}
__pyx_3 = PyInt_AsLong(__pyx_v_val); if (PyErr_Occurred())
{__pyx_filename = __pyx_f1; __pyx_lineno = 126; goto __pyx_L1;}
__pyx_4 = PyInt_FromLong(tidyOptSetBool(__pyx_1,__pyx_2,__pyx_3)); if
(!__pyx_4) {__pyx_filename = __pyx_f1; __pyx_lineno = 126; goto __pyx$
Py_DECREF(__pyx_v_ok);
__pyx_v_ok = __pyx_4;
__pyx_4 = 0;
-----------------------START _tidylib.pyx--------------
# -*-python-mode-*-
ctypedef int byte
ctypedef int uint
ctypedef int Bool
cdef extern from "tidy.h":
ctypedef struct TidyBuffer
ctypedef struct TidyDoc
ctypedef struct TidyOption
ctypedef enum TidyOptionId:
TidyUnknownOption # Unknown option!
TidyIndentSpaces # Indentation n spaces
TidyWrapLen # Wrap margin
#[...snip rest of huge enum...]
Bool tidyOptSetBool(TidyDoc tdoc, TidyOptionId optId, Bool val)
def optSetBool(doc, optId, val):
ok = tidyOptSetBool(doc, optId, val)
if not ok:
raise ValueError, "something bad happened"
-----------------------END _tidylib.pyx--------------
-----------------------START setup.py--------------
from distutils.core import setup, Extension
from Pyrex.Distutils import build_ext
setup(name = "tidylib",
version = "0.1",
license = "BSD",
author = "John J. Lee",
author_email = "jjl at pobox.com",
description = "HTML tidying.",
py_modules = ["tidylib"],
ext_modules = [Extension("_tidylib",
sources=["_tidylib.pyx"],
include_dirs=["/usr/local/include/tidy"],
libraries=["tidy"],
library_dirs=["/usr/local/lib"])
],
cmdclass = {'build_ext': build_ext}
)
-----------------------END setup.py--------------
TIA for any help.
John
More information about the Pyrex
mailing list