Problem: new type in Python 2.2
dkuhlman at rexx.com
Fri Jan 11 20:39:08 CET 2002
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:
File "test_to_file_compiled.py", line 28, in translate
for stem in fileStems:
TypeError: argument 2 must be string, not libxslt_stylesheet
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.
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.
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 have re-compiled my C source code with Python 2.2 source
Are there some steps that I must go through in order to upgrade a
type implemented in C for Python 2.2? For example, did files like
Objects/dictobject.c, Objects/stringobject.c, etc have to be updated
in a certain way? Did the definition of PyTypeObject change in
some incompatible way?
Is there somewhere I can find notes on how to do this? I've
searched at the http://www.python.org/search/, but could not find
I'm now reading Guido's "Unifying types and classes in Python 2.2",
but that does not seem to say anything about implementing types in
C. I've also looked at "2. Defining New Types" in "Extending and
Embedding the Python Interpreter", but no changes for Python 2.2
jump out at me.
Thanks in advance for help.
dkuhlman at rexx.com
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
More information about the Python-list