[PyQt] SIP: missing PyType_Ready

2009-05-26 Thread Kevin Watters
I was using an extension that traverses the GC heap, and it crashed when it got to the sipVariableDescr_Type object, because it never gets initialized via PyType_Ready. The fix is easy; just an extra PyType_Ready for sipVariableDescr_Type in the PyMODINIT_FUNC in siplib.c Thanks! - Kevin __

[PyQt] SIP suggestion: warnings for /Transfer/ with /Supertype=sip.simplewrapper/

2009-03-25 Thread Kevin Watters
I updated to a newish SIP snapshot and was playing around with using /Supertype=sip.simplewrapper/ when possible. The note in the docs about simplewrapper objects being unable to take part in ownership transfer is good, but it might be even more useful for SIP to warn or fail when you have a s

[PyQt] Re: More recent g++ slows build time immensely

2008-10-20 Thread Kevin Watters
> Anyway, I'm looking into using sipconfig so I'll end up with lots of little > files instead of one big one. It sounds like some new algorithm made your big-oh a little a bigger--splitting things up might improve things quite a bit. I'd also take the time to figure out how to make g++ do precomp

[PyQt] Re: Auto-generate sip specification file?

2008-08-15 Thread Kevin Watters
> I'm still at Akademy, but I'll try to get this checked into KDE's SVN > some time this weekend along with all of my changes. (Probably in > kdesupport. I'm not sure if I can keep the change history though.) +1 on interest in seeing this! Especially the autodocs-from-doxygen support. _

[PyQt] Re: Debugging memory corruption b/c of invalid GIL usage

2008-08-12 Thread Kevin Watters
Turns out (one) of my problems was %GCClearCode that was being invoked after a C++ object's destructor. There's a note in sipWrapper_dealloc about calling sipWrapper_clear after td_dealloc: Now that the C++ object no longer exists we can tidy up the Python object. We used to do this first but

[PyQt] Debugging memory corruption b/c of invalid GIL usage

2008-08-11 Thread Kevin Watters
I've got random sporadic crashes that look like memory corruption. From some googling around it looks similar to problems others have had when they're not obtaining the GIL before calling Python code. I've sifted through my .sip files looking for trouble spots with no luck. Is there some trick t

[PyQt] Re: Destructor being called on a subthread.

2008-07-31 Thread Kevin Watters
> You could look at the call to PyObject_GC_UnTrack() in > sipWrapper_dealloc(). I don't think it's the same problem, but there may be > similarities. As far as I can tell, PyObject_GC_UnTrack just says that the GC shouldn't call the traverse functions while you're destructing the object--but what

[PyQt] Destructor being called on a subthread.

2008-07-31 Thread Kevin Watters
I've got a sporadic crash in my app (not PyQT) and I think I have it narrowed down. 1) Main thread creates a Flub object. 2) Main thread releases all references to the Flub object, but there's a cycle, so the object isn't collected immediately. 3) Worker thread does some unrelated work, during wh

[PyQt] Re: Building on windows

2008-07-17 Thread Kevin Watters
> '0xc135' > Stop. Google says that could mean nmake can't find cl.exe. Did you make sure to start your command prompt via the "Visual Studio 200x Command Prompt" shortcut? ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcom

[PyQt] Re: Virtual methods and an extra reference

2008-07-07 Thread Kevin Watters
> It should be fixed in tonight's SIP snapshot. It was just a Py_DECREF() > that got dropped. Thanks--the fix looks good in my tests. Although I'm still a bit confused about the long comment for when there's a callable (not a CFunction and not a PyMethod) in the slot. There's still no Py_DECREF i

[PyQt] Re: /NewThread/, and Python stack in Visual Studio

2008-06-23 Thread Kevin Watters
> > Anyone lucky enough to be using Visual Studio for their SIP projects have > > any > > advice on the Python stack trace issue? > > Not that I know of, but please let me know if you find out something. The best I could come up with was to wrap my main loop in an SEH block (lookup __try and __e

[PyQt] Re: Virtual methods and an extra reference

2008-06-21 Thread Kevin Watters
> The workaround makes my skin crawl. :| I hope you'll be able to whip up > a fix, Kevin. I tried, but I screwed up attribute access in a way I didn't understand yet. Disabling the method cache altogether proved a workable temporary fix for me--but I won't want to ship it :) Phil, any suggest

[PyQt] Re: Virtual methods and an extra reference

2008-06-19 Thread Kevin Watters
Sundance ierne.eu.org> writes: > This class behaves like weakref.ref, only for callables. We use a variant of this idea in our app for observable callbacks: class bound_ref(object): def __init__(self, method, cb = None): self.object = weakref_ref(method.im_self, cb) self.fun

[PyQt] Virtual methods and an extra reference

2008-06-18 Thread Kevin Watters
There's a comment in siplib.c:5300ish in the sip_api_is_py_method function that I'll reproduce here: /* * Note that the callable is never garbage collected. The main * reason for this is that it's not possible to get hold of the * method cache without make incompatible changes to the SIP * AP

[PyQt] Re: /NewThread/, and Python stack in Visual Studio

2008-06-12 Thread Kevin Watters
Phil Thompson riverbankcomputing.com> writes: > > On Thursday 12 June 2008 3:50:00 pm Kevin Watters wrote: > > I noticed /NewThread/ on QThread and QRunnable in the PyQT source-- and > > a peek at the source code shows SIP creating thread local structures for > > pend

[PyQt] /NewThread/, and Python stack in Visual Studio

2008-06-12 Thread Kevin Watters
I noticed /NewThread/ on QThread and QRunnable in the PyQT source-- and a peek at the source code shows SIP creating thread local structures for pending objects. My app creates threads, but only through Python's threading module. Do I need to use /NewThread/, or call something like api_new_thread

[PyQt] operator new/delete and PyMem_New/Del

2008-06-04 Thread Kevin Watters
I was profiling my SIP extension, seeing that I allocate lots and lots of a certain class of small objects, whose ownership is never transferred to C++. I remembered reading a section from the Python C API manual on memory management, here: http://docs.python.org/api/memoryOverview.html -- the re

[PyQt] %ConvertToSubClassCode across modules

2008-05-30 Thread Kevin Watters
In the docs for %ConvertToSubClassCode, there's a mention about class hierarchies over multiple modules: >> Note that if a class hierarchy extends over a number of modules then >> this directive should be used in each of those modules to handle the >> part of the hierarchy defined in that module.

[PyQt] SIP out of memory error

2008-05-19 Thread Kevin Watters
Yikes! SIP ran out of memory because of this typo: class MyClass : MyClass { }; (As a side note, Mac OS X deals with out of memory situations much more gracefully than Vista.) I'd imagine there's a fix to be somewhere in the superclass: part of parser.y ;) _

[PyQt] Re: Building with Visual Studio 2008

2008-05-19 Thread Kevin Watters
> As far as I can see SIP embeds the manifest in the executable so it is not > necessary to install it. If I don't run mt on the exe then it fails to run. > If I do then it runs - irrespective of whether the manifest is installed or > not. I second this--I had to add the following post-build st

[PyQt] SIP, object destruction, and sip.setdeleted

2008-04-29 Thread Kevin Watters
I've got a couple quick questions about SIP's handling of object destruction. The docs for sip.setdeleted says setdeleted(obj) This marks the C++ instance or C structure as having been destroyed or returned to the heap so that future references to it raise an exception rather than cause a pro

[PyQt] Re: SIP: rich compare with a tuple bug?

2008-04-24 Thread Kevin Watters
Phil Thompson riverbankcomputing.com> writes: > It should be fixed in tonight's snapshot. Thanks! This fixed every single one of my related failing test cases. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/m

[PyQt] SIP: rich compare with a tuple bug?

2008-04-23 Thread Kevin Watters
I think I found a bug with rich comparison operators. I have a simple class like this: class point { public: point(); point(int x, int y); int x; int y; %ConvertToTypeCode /* (convert sequences with 2 ints to points) */ %End bool operator==(const p

[PyQt] Re: SIP - patched methods with lazy lookups

2008-04-22 Thread Kevin Watters
> old_init = MyClass.__init__ def new_init(self, foo, bar=5, meep=13): > old_init(self, foo, bar, meep) MyClass.__init__ = new_init > > assert MyClass.__init__ is new_init # FAIL Oops. That should be old_init = MyClass.__init__ def new_init(self, foo, bar=5, meep=13): old_init(self, foo, bar

[PyQt] SIP - patched methods with lazy lookups

2008-04-22 Thread Kevin Watters
SIP is working great for me so far, enough so that I'm coming to the question of what to do with keyword arguments. I've got a fairly large code base, part of which makes calls to GUI control constructors using keyword arguments. It's actually a fairly limited subset of methods, so my initial thou

[PyQt] Re: SIP properties

2008-04-16 Thread Kevin Watters
For future reference, my forked SIP with auto-generated properties is here: http://github.com/kevinwatters/wxpy/tree/master Just use %SIPOptions (AutoProperties) There's also (as of this posting) an option to strip "wx" from the beginning of any PyNames. This hack is enabled with %SIPOptions (Ren

[PyQt] SIP properties

2008-04-11 Thread Kevin Watters
I want to make an option for SIP to autogenerate properties (i.e., GetTitle and SetTitle just become Title). I've been reading through transform.c, trying to get a feel for how this might happen, but I think I'm lacking the "big picture" when it comes to how SIP implements methods and attribute lo

[PyQt] Re: SIP newcomer questions/complaints

2008-04-07 Thread Kevin Watters
> you will find a cache implementation for PyQt4's configure.py (search > for "manage_cache"). ... > > You might grab that code and integrate it within your setup.py. > This was exactly what I was looking for, and is work great! Thanks! > > 6) The docs show show no comparisons with similar tools.

[PyQt] SIP newcomer questions/complaints

2008-04-06 Thread Kevin Watters
I just started looking into SIP this weekend (I'm trying to wrap the wxWidgets library--has this been attempted before?), and I had a couple thoughts and questions. 1) The docs make no mention of the fact that you cannot use keyword arguments when calling C functions. This was a surprising limitat