Problem: new type in Python 2.2
Michael Hudson
mwh at python.net
Tue Jan 15 09:48:25 EST 2002
Dave Kuhlman <dkuhlman at rexx.com> writes:
> I've implemented a new Python type (in C). It's based on
> Objects/xxobject.c in the source code distribution. It implements
> a wrapper for a compiled XSLT stylesheet and is part of the Python
> support for libxslt. (See http://www.rexx.com/~dkuhlman)
>
> It no longer works with Python 2.2.
>
> Here is the finger-print of the error:
>
>
> o
> o
> o
> File "test_to_file_compiled.py", line 28, in translate
> for stem in fileStems:
> TypeError: argument 2 must be string, not libxslt_stylesheet
Hmph. I doubt that traceback is right.
Can you post some code? Python or C, but lets go for Python first.
> Where:
>
> libxslt_stylesheet is the Python type that I have implemented.
>
> fileStems is a list of strings.
>
> The error occurs when the for statement is exited, i.e. after all
> the iterations have been completed.
Wierd.
> This error message does not make too much sense to me. My type is
> not referenced in the for statement. I don't know what argument 2
> is in a for statement. I suppose my type implemented in C is
> confusing Python. I'm confused too; I can't find this error
> message in the Python 2.2 source.
The error looks to me like it came from somewhere in Python/getargs.c.
> This error occurs when I run Python 2.2. It does not occur when I
> run Python 2.1.
>
> If I modify my test so that it does _not_ create an instance of
> libxslt_stylesheet, then the error does not occur.
I really need to see the Python code you're running.
> I have re-compiled my C source code with Python 2.2 source
> (includes).
>
> Are there some steps that I must go through in order to upgrade a
> type implemented in C for Python 2.2?
Don't think so; there are steps you *can* go through to enable
subclassing and stuff, but they're not mandatory.
Lets see some code!
Cheers,
M.
--
$ head -n 2 src/bash/bash-2.04/unwind_prot.c
/* I can't stand it anymore! Please can't we just write the
whole Unix system in lisp or something? */
-- spotted by Rich van der Hoff
More information about the Python-list
mailing list