[Python-Dev] ctypes is in SVN now.

Thomas Heller theller at python.net
Fri Mar 10 08:27:57 CET 2006


Thomas Wouters wrote:
(about ctypes and Py_ssize_t)
>> you want to do that yourself, or do you want me to submit a patch? (Or I
>>> could just check it in ;)
>> You can do it faster then me, I assume - so go ahead and check it in.
>> I'll backport it to the upstream ctypes CVS repository.
> 
> 
> I'm not sure if I'll be faster. It's quite a lot of work to make it
> completely Py_ssize_t-aware (but worth it, IMHO; ints just don't cut it on
> 64-bit platforms. :) I have a simple patch to silence the warnings, but it
> doesn't support indexing beyond int-size and such. I'm also going through
> all of the code and changing most appropriate things into Py_ssize_t's, and
> that would be much nicer. I'll probably have some XXX markers left when I'm
> done, though. Also, how stable should the C API be? Does the C code have any
> direct users besides Python?

Apart from a few functions that are used as foreign functions from ctypes itself
(memmove and memset currently), the C api is not used from the outside.

The important thing when changing something in the ctypes sources is to run
the unittests (*) on as many platforms and Python versions as possible - currently
I do this on all the sourceforge compile farm machines that have either Python >= 2.3, or
where I have been able to compile Python myself.  Plus WindowsXP 32 and OSX 10.4.
This is for the ctypes upstream version, of course.

If your patch is going to change more than a few int -> Py_ssize_t replacements
it would probably be less work to do it in ctypes CVS instead of Python SVN.
Maintaining code in multiple repositories is no fun ;)

(*) ctypes unittests are run by 'python ctypes/test/runtests.py', for example.

Thomas



More information about the Python-Dev mailing list