[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Custom exception when transferring "owned" object
From: Nyall Dawson <nyall.dawson () gmail ! com>
Date: 2019-04-05 4:33:55
Message-ID: CAB28AshU0b-qGOVqeiGB0yDRfKY2Ek4freHZbLdb5Vcqop1tXA () mail ! gmail ! com
[Download RAW message or body]
On Fri, 29 Mar 2019 at 19:59, Phil Thompson <phil@riverbankcomputing.com> wrote:
>
> sipConvertFromType() returns a new reference which you aren't dealing with properly.
>
> You don't need the first call to sipConvertFromType(). Use /GetWrapper/ instead.
>
> sipIsPyOwned() is an undocumented internal function and may be removed at any time.
Is there any way to reconsider this, or add a stable way to retrieve
this information?
> Personally I think trying to add protection in the bindings layer to cover weaknesses in the \
> (current) *implementation* of the C++ API is a mistake (and a never ending task).
I honestly can't see any issue with the c++ api, it's fairly standard
stuff. The next step after this would be to modernize the c++ api to
use unique_ptrs instead of raw pointers. It's then only in the Python
-> c++ conversion that ownership issues can arise, which I'm trying to
find a way to avoid. A hard crash is not a nice experience for
beginners starting out with our Python API, and the explanation on why
these occur veers way to heavily into the guts of c++ memory
management for my comfort. That's why I'd love to find a stable way to
instead raise exceptions, which at least is the expected behaviour for
Python devs.
Nyall
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic