Skip to content

Stable ABI builds and Py_XDECREF #500

Answered by vstinner
nicholasjng asked this question in Q&A
Discussion options

You must be logged in to vote

Py_XDECREF() is part of the limited C API and implemented as:

static inline void Py_XDECREF(PyObject *op)
{
    if (op != _Py_NULL) {
        Py_DECREF(op);
    }
}

It's not part of the stable ABI, since it's compiled as a call to Py_DECREF() which calls _Py_DecRef() at the ABI level.

At the end, only _Py_DecRef() is part of the stable ABI.

I'm not sure of what is your question. As soon as you use the limited C API, the generated binary uses the stable ABI and you're good.

In short, Py_XDECREF() is part of the stable ABI, but it's implemented as if (ptr != 0) + call to _Py_DecRef().

Replies: 5 comments 21 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@nicholasjng
Comment options

@nicholasjng
Comment options

@wjakob
Comment options

@nicholasjng
Comment options

@nicholasjng
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@wjakob
Comment options

Comment options

You must be logged in to vote
11 replies
@woodruffw
Comment options

@encukou
Comment options

@woodruffw
Comment options

@nicholasjng
Comment options

@woodruffw
Comment options

Answer selected by nicholasjng
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants