mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
gh-128863: Deprecate private C API functions (#128864)
Deprecate private C API functions: * _PyBytes_Join() * _PyDict_GetItemStringWithError() * _PyDict_Pop() * _PyThreadState_UncheckedGet() * _PyUnicode_AsString() * _Py_HashPointer() * _Py_fopen_obj() Replace _Py_HashPointer() with Py_HashPointer(). Remove references to deprecated functions.
This commit is contained in:
parent
470a0a68eb
commit
9012fa741d
16 changed files with 103 additions and 30 deletions
|
|
@ -1349,7 +1349,7 @@ wrapper_hash(PyObject *self)
|
|||
wrapperobject *wp = (wrapperobject *)self;
|
||||
Py_hash_t x, y;
|
||||
x = PyObject_GenericHash(wp->self);
|
||||
y = _Py_HashPointer(wp->descr);
|
||||
y = Py_HashPointer(wp->descr);
|
||||
x = x ^ y;
|
||||
if (x == -1)
|
||||
x = -2;
|
||||
|
|
|
|||
|
|
@ -3090,8 +3090,8 @@ PyDict_PopString(PyObject *op, const char *key, PyObject **result)
|
|||
}
|
||||
|
||||
|
||||
PyObject *
|
||||
_PyDict_Pop(PyObject *dict, PyObject *key, PyObject *default_value)
|
||||
static PyObject *
|
||||
dict_pop_default(PyObject *dict, PyObject *key, PyObject *default_value)
|
||||
{
|
||||
PyObject *result;
|
||||
if (PyDict_Pop(dict, key, &result) == 0) {
|
||||
|
|
@ -3104,6 +3104,12 @@ _PyDict_Pop(PyObject *dict, PyObject *key, PyObject *default_value)
|
|||
return result;
|
||||
}
|
||||
|
||||
PyObject *
|
||||
_PyDict_Pop(PyObject *dict, PyObject *key, PyObject *default_value)
|
||||
{
|
||||
return dict_pop_default(dict, key, default_value);
|
||||
}
|
||||
|
||||
static PyDictObject *
|
||||
dict_dict_fromkeys(PyInterpreterState *interp, PyDictObject *mp,
|
||||
PyObject *iterable, PyObject *value)
|
||||
|
|
@ -4465,7 +4471,7 @@ static PyObject *
|
|||
dict_pop_impl(PyDictObject *self, PyObject *key, PyObject *default_value)
|
||||
/*[clinic end generated code: output=3abb47b89f24c21c input=e221baa01044c44c]*/
|
||||
{
|
||||
return _PyDict_Pop((PyObject*)self, key, default_value);
|
||||
return dict_pop_default((PyObject*)self, key, default_value);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ meth_hash(PyObject *self)
|
|||
{
|
||||
PyCFunctionObject *a = _PyCFunctionObject_CAST(self);
|
||||
Py_hash_t x = PyObject_GenericHash(a->m_self);
|
||||
Py_hash_t y = _Py_HashPointer((void*)(a->m_ml->ml_meth));
|
||||
Py_hash_t y = Py_HashPointer((void*)(a->m_ml->ml_meth));
|
||||
x ^= y;
|
||||
if (x == -1) {
|
||||
x = -2;
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ mp_length __len__ - dict_length
|
|||
mp_subscript __getitem__ - dict_subscript
|
||||
mp_ass_subscript __setitem__ - dict_ass_sub
|
||||
__delitem__
|
||||
tp_hash __hash__ _Py_HashPointer ..._HashNotImpl
|
||||
tp_hash __hash__ Py_HashPointer ..._HashNotImpl
|
||||
tp_str __str__ object_str -
|
||||
tp_getattro __getattribute__ ..._GenericGetAttr (repeated)
|
||||
__getattr__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue