Segfault after deepcopy in a C extension
Marco Sulla
Marco.Sulla.Python at gmail.com
Mon Jan 31 18:10:49 EST 2022
....and I had to Py_INCREF(memo)! Thank you A LOT!
On Mon, 31 Jan 2022 at 23:01, Chris Angelico <rosuav at gmail.com> wrote:
> On Tue, 1 Feb 2022 at 08:54, Marco Sulla <Marco.Sulla.Python at gmail.com>
> wrote:
> > PyObject* d = PyDict_New();
> > args = PyTuple_New(2);
> > PyTuple_SET_ITEM(args, 0, d);
> > PyTuple_SET_ITEM(args, 1, memo);
> > Py_DECREF(d);
> >
>
> https://docs.python.org/3/c-api/tuple.html#c.PyTuple_SET_ITEM
>
> SET_ITEM steals a reference, so you'll need to not also decref the
> dict yourself.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list