[PyQt] Next PyQt, SIP, QScintilla Releases

Giovanni Bajo rasky at develer.com
Fri Nov 7 09:22:29 GMT 2008


On sab, 2008-11-01 at 17:29 +0000, Phil Thompson wrote:
> There will be new releases of PyQt, SIP and QScintilla in the next few days
> based on current snapshots.
> 
> Let me know if there is anything you are expecting that doesn't seem to be
> there.

sip.voidptr() only accepts a Python "int" in the constructor (thus, a
negative number for pointers above half of the memory address space).
This doesn't match the choice made by Python's module struct (see 'P'
type specificier for void*) and ctypes (see addressof()): they both
always return a positive number to represent a void*, possibly promoted
to Python long if necessary.

The different choice made by sip.voidptr() makes it harder to
interoperate with such modules. Specifically, it becomes very difficult
to write code that passes void* around and works on both 32 bit and 64
bit platforms. 

It would be great if:

 * sip.voidptr() accepted also a (positive) long as argument, to
represent an address. This ought to be fully backward-compatible.
 * sip.voidptr could implement __long__ differently from __int__, and
always return a positive long. I guess this is not fully backward
compatible (as long(ptr) currently defaults to __int__) but voidptr
isn't probably the most widely used class after all. Up to you.

Eventually, you might want to get rid of the negative ints. I understand
where it came from, but it doesn't match how other Python builtin
modules has chosen to handle it (plus it's doesn't make sense if you do
pointer arithmetic in Python).
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com




More information about the PyQt mailing list