mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +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
|
|
@ -34,5 +34,9 @@ static inline Py_ssize_t PyBytes_GET_SIZE(PyObject *op) {
|
|||
|
||||
PyAPI_FUNC(PyObject*) PyBytes_Join(PyObject *sep, PyObject *iterable);
|
||||
|
||||
// Alias kept for backward compatibility
|
||||
#define _PyBytes_Join PyBytes_Join
|
||||
// Deprecated alias kept for backward compatibility
|
||||
Py_DEPRECATED(3.14) static inline PyObject*
|
||||
_PyBytes_Join(PyObject *sep, PyObject *iterable)
|
||||
{
|
||||
return PyBytes_Join(sep, iterable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,12 @@ PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
|
|||
|
||||
PyAPI_FUNC(int) PyDict_Pop(PyObject *dict, PyObject *key, PyObject **result);
|
||||
PyAPI_FUNC(int) PyDict_PopString(PyObject *dict, const char *key, PyObject **result);
|
||||
PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *dict, PyObject *key, PyObject *default_value);
|
||||
|
||||
// Use PyDict_Pop() instead
|
||||
Py_DEPRECATED(3.14) PyAPI_FUNC(PyObject *) _PyDict_Pop(
|
||||
PyObject *dict,
|
||||
PyObject *key,
|
||||
PyObject *default_value);
|
||||
|
||||
/* Dictionary watchers */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ PyAPI_FUNC(FILE*) Py_fopen(
|
|||
PyObject *path,
|
||||
const char *mode);
|
||||
|
||||
// Deprecated alias to Py_fopen() kept for backward compatibility
|
||||
Py_DEPRECATED(3.14) PyAPI_FUNC(FILE*) _Py_fopen_obj(
|
||||
PyObject *path,
|
||||
const char *mode);
|
||||
// Deprecated alias kept for backward compatibility
|
||||
Py_DEPRECATED(3.14) static inline FILE*
|
||||
_Py_fopen_obj(PyObject *path, const char *mode)
|
||||
{
|
||||
return Py_fopen(path, mode);
|
||||
}
|
||||
|
||||
PyAPI_FUNC(int) Py_fclose(FILE *file);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,6 @@
|
|||
/* Helpers for hash functions */
|
||||
PyAPI_FUNC(Py_hash_t) _Py_HashDouble(PyObject *, double);
|
||||
|
||||
// Kept for backward compatibility
|
||||
#define _Py_HashPointer Py_HashPointer
|
||||
|
||||
|
||||
/* hash function definition */
|
||||
typedef struct {
|
||||
|
|
@ -44,6 +41,14 @@ typedef struct {
|
|||
PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void);
|
||||
|
||||
PyAPI_FUNC(Py_hash_t) Py_HashPointer(const void *ptr);
|
||||
|
||||
// Deprecated alias kept for backward compatibility
|
||||
Py_DEPRECATED(3.14) static inline Py_hash_t
|
||||
_Py_HashPointer(const void *ptr)
|
||||
{
|
||||
return Py_HashPointer(ptr);
|
||||
}
|
||||
|
||||
PyAPI_FUNC(Py_hash_t) PyObject_GenericHash(PyObject *);
|
||||
|
||||
PyAPI_FUNC(Py_hash_t) Py_HashBuffer(const void *ptr, Py_ssize_t len);
|
||||
|
|
|
|||
|
|
@ -239,8 +239,12 @@ struct _ts {
|
|||
* if it is NULL. */
|
||||
PyAPI_FUNC(PyThreadState *) PyThreadState_GetUnchecked(void);
|
||||
|
||||
// Alias kept for backward compatibility
|
||||
#define _PyThreadState_UncheckedGet PyThreadState_GetUnchecked
|
||||
// Deprecated alias kept for backward compatibility
|
||||
Py_DEPRECATED(3.14) static inline PyThreadState*
|
||||
_PyThreadState_UncheckedGet(void)
|
||||
{
|
||||
return PyThreadState_GetUnchecked();
|
||||
}
|
||||
|
||||
|
||||
// Disable tracing and profiling.
|
||||
|
|
|
|||
|
|
@ -630,8 +630,12 @@ _PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer);
|
|||
|
||||
PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode);
|
||||
|
||||
// Alias kept for backward compatibility
|
||||
#define _PyUnicode_AsString PyUnicode_AsUTF8
|
||||
// Deprecated alias kept for backward compatibility
|
||||
Py_DEPRECATED(3.14) static inline const char*
|
||||
_PyUnicode_AsString(PyObject *unicode)
|
||||
{
|
||||
return PyUnicode_AsUTF8(unicode);
|
||||
}
|
||||
|
||||
|
||||
/* === Characters Type APIs =============================================== */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue