File tree Expand file tree Collapse file tree 14 files changed +74
-26
lines changed Expand file tree Collapse file tree 14 files changed +74
-26
lines changed Original file line number Diff line number Diff line change 1+ Pending removal in Python 3.16
2+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3+
4+ * Deprecated private functions (:gh: `128863 `):
5+
6+ * :c:func: `!_PyBytes_Join `: use :c:func: `PyBytes_Join `.
7+ * :c:func: `!_PyDict_GetItemStringWithError `: use :c:func: `PyDict_GetItemStringRef `.
8+ * :c:func: `!_PyThreadState_UncheckedGet `: use :c:func: `PyThreadState_GetUnchecked `.
9+ * :c:func: `!_PyUnicode_AsString `: use :c:func: `PyUnicode_AsUTF8 `.
10+ * :c:func: `!_Py_HashPointer `: use :c:func: `Py_HashPointer `.
11+ * :c:func: `!_Py_fopen_obj `: use :c:func: `Py_fopen `.
Original file line number Diff line number Diff line change @@ -1356,12 +1356,27 @@ Deprecated
13561356
13571357 .. include :: ../deprecations/c-api-pending-removal-in-3.15.rst
13581358
1359+ .. include :: ../deprecations/c-api-pending-removal-in-3.16.rst
1360+
13591361.. include :: ../deprecations/c-api-pending-removal-in-future.rst
13601362
13611363* The ``PyMonitoring_FireBranchEvent `` function is deprecated and should
13621364 be replaced with calls to :c:func: `PyMonitoring_FireBranchLeftEvent `
13631365 and :c:func: `PyMonitoring_FireBranchRightEvent `.
13641366
1367+ * The following private functions are deprecated and planned for removal in
1368+ Python 3.16:
1369+
1370+ * :c:func: `!_PyBytes_Join `: use :c:func: `PyBytes_Join `.
1371+ * :c:func: `!_PyDict_GetItemStringWithError `: use :c:func: `PyDict_GetItemStringRef `.
1372+ * :c:func: `!_PyThreadState_UncheckedGet `: use :c:func: `PyThreadState_GetUnchecked `.
1373+ * :c:func: `!_PyUnicode_AsString `: use :c:func: `PyUnicode_AsUTF8 `.
1374+ * :c:func: `!_Py_HashPointer `: use :c:func: `Py_HashPointer `.
1375+ * :c:func: `!_Py_fopen_obj `: use :c:func: `Py_fopen `.
1376+
1377+ (Contributed by Victor Stinner in :gh: `128863 `.)
1378+
1379+
13651380Removed
13661381-------
13671382
Original file line number Diff line number Diff line change @@ -34,5 +34,9 @@ static inline Py_ssize_t PyBytes_GET_SIZE(PyObject *op) {
3434
3535PyAPI_FUNC (PyObject * ) PyBytes_Join (PyObject * sep , PyObject * iterable );
3636
37- // Alias kept for backward compatibility
38- #define _PyBytes_Join PyBytes_Join
37+ // Deprecated alias kept for backward compatibility
38+ Py_DEPRECATED (3.14 ) static inline PyObject *
39+ _PyBytes_Join (PyObject * sep , PyObject * iterable )
40+ {
41+ return PyBytes_Join (sep , iterable );
42+ }
Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ PyAPI_FUNC(FILE*) Py_fopen(
66 PyObject * path ,
77 const char * mode );
88
9- // Deprecated alias to Py_fopen() kept for backward compatibility
10- Py_DEPRECATED (3.14 ) PyAPI_FUNC (FILE * ) _Py_fopen_obj (
11- PyObject * path ,
12- const char * mode );
9+ // Deprecated alias kept for backward compatibility
10+ Py_DEPRECATED (3.14 ) static inline FILE *
11+ _Py_fopen_obj (PyObject * path , const char * mode )
12+ {
13+ return Py_fopen (path , mode );
14+ }
1315
1416PyAPI_FUNC (int ) Py_fclose (FILE * file );
Original file line number Diff line number Diff line change 2929/* Helpers for hash functions */
3030PyAPI_FUNC (Py_hash_t ) _Py_HashDouble (PyObject * , double );
3131
32- // Kept for backward compatibility
33- #define _Py_HashPointer Py_HashPointer
34-
3532
3633/* hash function definition */
3734typedef struct {
@@ -44,6 +41,14 @@ typedef struct {
4441PyAPI_FUNC (PyHash_FuncDef * ) PyHash_GetFuncDef (void );
4542
4643PyAPI_FUNC (Py_hash_t ) Py_HashPointer (const void * ptr );
44+
45+ // Deprecated alias kept for backward compatibility
46+ Py_DEPRECATED (3.14 ) static inline Py_hash_t
47+ _Py_HashPointer (const void * ptr )
48+ {
49+ return Py_HashPointer (ptr );
50+ }
51+
4752PyAPI_FUNC (Py_hash_t ) PyObject_GenericHash (PyObject * );
4853
4954PyAPI_FUNC (Py_hash_t ) Py_HashBuffer (const void * ptr , Py_ssize_t len );
Original file line number Diff line number Diff line change @@ -239,8 +239,12 @@ struct _ts {
239239 * if it is NULL. */
240240PyAPI_FUNC (PyThreadState * ) PyThreadState_GetUnchecked (void );
241241
242- // Alias kept for backward compatibility
243- #define _PyThreadState_UncheckedGet PyThreadState_GetUnchecked
242+ // Deprecated alias kept for backward compatibility
243+ Py_DEPRECATED (3.14 ) static inline PyThreadState *
244+ _PyThreadState_UncheckedGet (void )
245+ {
246+ return PyThreadState_GetUnchecked ();
247+ }
244248
245249
246250// Disable tracing and profiling.
Original file line number Diff line number Diff line change @@ -630,8 +630,12 @@ _PyUnicodeWriter_Dealloc(_PyUnicodeWriter *writer);
630630
631631PyAPI_FUNC (const char * ) PyUnicode_AsUTF8 (PyObject * unicode );
632632
633- // Alias kept for backward compatibility
634- #define _PyUnicode_AsString PyUnicode_AsUTF8
633+ // Deprecated alias kept for backward compatibility
634+ Py_DEPRECATED (3.14 ) static inline const char *
635+ _PyUnicode_AsString (PyObject * unicode )
636+ {
637+ return PyUnicode_AsUTF8 (unicode );
638+ }
635639
636640
637641/* === Characters Type APIs =============================================== */
Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ class C(A):
187187
188188
189189def test_open (testfn ):
190- # SSLContext.load_dh_params uses _Py_fopen_obj rather than normal open()
190+ # SSLContext.load_dh_params uses Py_fopen() rather than normal open()
191191 try :
192192 import ssl
193193
Original file line number Diff line number Diff line change 1+ The following private functions are deprecated and planned for removal in
2+ Python 3.16:
3+
4+ * :c:func: `!_PyBytes_Join `: use :c:func: `PyBytes_Join `.
5+ * :c:func: `!_PyDict_GetItemStringWithError `: use :c:func: `PyDict_GetItemStringRef `.
6+ * :c:func: `!_PyThreadState_UncheckedGet `: use :c:func: `PyThreadState_GetUnchecked `.
7+ * :c:func: `!_PyUnicode_AsString `: use :c:func: `PyUnicode_AsUTF8 `.
8+ * :c:func: `!_Py_HashPointer `: use :c:func: `Py_HashPointer `.
9+ * :c:func: `!_Py_fopen_obj `: use :c:func: `Py_fopen `.
10+
11+ Patch by Victor Stinner.
Original file line number Diff line number Diff line change @@ -1349,7 +1349,7 @@ wrapper_hash(PyObject *self)
13491349 wrapperobject * wp = (wrapperobject * )self ;
13501350 Py_hash_t x , y ;
13511351 x = PyObject_GenericHash (wp -> self );
1352- y = _Py_HashPointer (wp -> descr );
1352+ y = Py_HashPointer (wp -> descr );
13531353 x = x ^ y ;
13541354 if (x == -1 )
13551355 x = -2 ;
You can’t perform that action at this time.
0 commit comments