15.04.21 10:03, Shreyan Avigyan пише:
> After going through the
> https://github.com/python/cpython/blob/master/Include/object.h it seems that
> Py_XDECREF is just calling Py_DECREF if the PyObject pointer is not NULL.
> This if statement could be directly implemented in Py_DECREF right? Therefore
> is it really required to have Py_XDECREF? Why not use a DeprecationWarning
> for now and plan to deprecate Py_XDECREF in the near future?
> How about implementing an if statement in Py_DECREF to make it work like
> Py_XDECREF?
Py_XDECREF is a convenient macro which allows you to write one line
Py_XDECREF(obj);
instead of 3 lines
if (obj != NULL) {
Py_DECREF(obj);
}
The code would look uglier without it.
Also, it is very difficult to deprecate it, because it is one of most
used macros/functions. You propose to break all existing extensions.
What exactly problem do you try to solve?
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/NU5CUMJXLGUAOOQE5ZSA7PNJCKXVVD2Z/
Code of Conduct: http://python.org/psf/codeofconduct/