[PyQt] /Transfer/ annotation not respected?

Giovanni Bajo rasky at develer.com
Mon Jul 27 17:33:03 BST 2009


Hi Phil,

Using sip 4.8.2-snapshot, PyQt 4.5.2:

========================================
import sip
from PyQt4.Qt import *

class W(QGLWidget):
     def __init__(self, parent=None):

         format = QGLFormat()
         ctx = QGLContext(format, None)

         sip.dump(ctx)
         QGLWidget.__init__(self, ctx, parent)
         sip.dump(ctx)

         self.makeCurrent()
         #self.ctx = ctx

app = QApplication([])
x = W()

assert QGLContext.currentContext() is not None
========================================

<PyQt4.QtOpenGL.QGLContext object at 0x00BA1E68>
     Reference count: 2
     Address of wrapped object: 00C8CCD8
     To be destroyed by: Python
     Derived class?: yes
<PyQt4.QtOpenGL.QGLContext object at 0x00BA1E68>
     Reference count: 2
     Address of wrapped object: 00C8CCD8
     To be destroyed by: Python
     Derived class?: yes
Traceback (most recent call last):
   File "pyqtbug24.py", line 20, in <module>
     assert QGLContext.currentContext() is not None
AssertionError


ctx should be transferred to C++ in the constructor call; if I look at 
qgl.sip, the argument is correctly marked with /Transfer/.

This used to work with PyQt 4.4.2 and SIP 4.7.4.
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


More information about the PyQt mailing list