Re: Custom exception when transferring "owned" object

Nyall Dawson <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <CAB28AshU0b-qGOVqeiGB0yDRfKY2Ek4freHZbLdb5Vcqop1tXA@mail.gmail.com>
On Fri, 29 Mar 2019 at 19:59, Phil Thompson <[email protected]> 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    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.