[mod_python] Problem with C extension type

Michael Owens mike at mikesclutter.com
Mon Mar 3 17:26:37 EST 2003


As a matter of interest, I found what was wrong (sort of). My C type's (X's) 
tp_getattro implementation was screwy. When I replaced it with 
PyObject_GenericGetAttr, everything worked fine in mod_python. I still don't 
know why the original implementation worked in Python and not in mod_python, 
but I don't care so long as it works now.

On Saturday 01 March 2003 11:07 am, Michael Owens wrote:
> This is a rather intricate problem, but I don't know where else to go. I
> have a C extension in which I created a native Python type, call it X,
> which has two methods: A() and B(). Then I create a Python class, derived
> from X type, called Y, which has has two methods C() and D(). Y is defined
> as follows (cmod is my C extension in which X is implemented)
>
> from cmod import X
>
> class Y(X):
>
>     def __new__(cls, db):
>         return super(Y, cls).__new__(cls)
>
>     def C():
> 	print "C()"
>
>     def D():
> 	print "D()"
>
> If I call Y.A() from a normal python script, there is no problem --- it
> resolved to X.A(). But if I do this inside of mod_python, I get an error
> saying that object Y has no such attribute A. I don't understand why
> mod_python would be any different in attribute resolution than Python would
> be since it is using the same Python implementation/library. I am using
> Python 2.2.2 and mod_python 3.0.1 in Apache 2.x.
>
> Any ideas?
>
> Michael Owens.
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list