]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43795: PEP-652: Clean up the stable ABI/limited API (GH-25482)
authorPetr Viktorin <encukou@gmail.com>
Fri, 23 Apr 2021 12:17:58 +0000 (14:17 +0200)
committerGitHub <noreply@github.com>
Fri, 23 Apr 2021 12:17:58 +0000 (14:17 +0200)
- `_Py_EncodeLocaleRaw`, which is private by name, undocumented,
  and wasn't exported in `python3.dll`, is moved to a private header.
- `_Py_HashSecret_Initialized`, again private by name, undocumented,
  and not exported in `python3.dll`, is excluded with `Py_LIMITED_API`.
- `PyMarshal_*` and `PyMember_*One` functions, declared in private headers and
  not exported in `python3.dll`, are removed from `Doc/data/stable_abi.dat`.
- `PyMem_Calloc` which *was* exported in `python3dll.c`, is moved to public
  headers where it joins its other `PyMem_*` friends.

Only the last change is documented in the blurb; others are not user-visible.
(Nothing uses `Doc/data/stable_abi.dat` yet.)

https://bugs.python.org/issue43795

Doc/data/stable_abi.dat
Include/cpython/fileutils.h
Include/cpython/pymem.h
Include/fileutils.h
Include/pyhash.h
Include/pymem.h
Misc/NEWS.d/next/C API/2021-04-20-15-06-29.bpo-43795.y0IP4c.rst [new file with mode: 0644]

index b7e3ef4a676a8e75542631ae389f7adf1ff2d2ee..cdc7160250243b728919ef294bc21261294984eb 100644 (file)
@@ -351,16 +351,11 @@ PyMapping_Length
 PyMapping_SetItemString
 PyMapping_Size
 PyMapping_Values
-PyMarshal_ReadObjectFromString
-PyMarshal_WriteLongToFile
-PyMarshal_WriteObjectToFile
-PyMarshal_WriteObjectToString
+PyMem_Calloc
 PyMem_Free
 PyMem_Malloc
 PyMem_Realloc
 PyMemberDescr_Type
-PyMember_GetOne
-PyMember_SetOne
 PyMemoryView_FromMemory
 PyMemoryView_FromObject
 PyMemoryView_GetContiguous
index 312fd9582847885b1863bb5af11ee2432bab91ba..954f078d25a77d0008ccbe38abe136c0253fa4d8 100644 (file)
@@ -32,6 +32,9 @@ PyAPI_FUNC(int) _Py_EncodeLocaleEx(
     int current_locale,
     _Py_error_handler errors);
 
+PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
+    const wchar_t *text,
+    size_t *error_pos);
 
 PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
 
index 61d719584584e881d11d883eb696a37b9bb6297b..d1054d76520b9aab0f9c312340cf7dd2d5bed9be 100644 (file)
@@ -10,8 +10,6 @@ PyAPI_FUNC(void) PyMem_RawFree(void *ptr);
 /* Try to get the allocators name set by _PyMem_SetupAllocators(). */
 PyAPI_FUNC(const char*) _PyMem_GetCurrentAllocatorName(void);
 
-PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
-
 /* strdup() using PyMem_RawMalloc() */
 PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str);
 
index 12bd071c49c04a514978a402067051f8461a4cbf..16f3b635deed89472da06e0751ab6900bbd6e92d 100644 (file)
@@ -12,10 +12,6 @@ PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
 PyAPI_FUNC(char*) Py_EncodeLocale(
     const wchar_t *text,
     size_t *error_pos);
-
-PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
-    const wchar_t *text,
-    size_t *error_pos);
 #endif
 
 #ifndef Py_LIMITED_API
index 728ef932a1accbfe6b2fc33754fdf2a660e00bee..a314ea907b7fe21c6c2e954c440b63e3b9ed75ff 100644 (file)
@@ -76,7 +76,6 @@ typedef union {
     } expat;
 } _Py_HashSecret_t;
 PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret;
-#endif
 
 #ifdef Py_DEBUG
 PyAPI_DATA(int) _Py_HashSecret_Initialized;
@@ -84,7 +83,6 @@ PyAPI_DATA(int) _Py_HashSecret_Initialized;
 
 
 /* hash function definition */
-#ifndef Py_LIMITED_API
 typedef struct {
     Py_hash_t (*const hash)(const void *, Py_ssize_t);
     const char *name;
index 92cd5369589edb6a269daf7c036c079dc53c824c..2f770b1fbf183d230d45c492580255838998e5e3 100644 (file)
@@ -50,6 +50,7 @@ extern "C" {
 */
 
 PyAPI_FUNC(void *) PyMem_Malloc(size_t size);
+PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
 PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size);
 PyAPI_FUNC(void) PyMem_Free(void *ptr);
 
diff --git a/Misc/NEWS.d/next/C API/2021-04-20-15-06-29.bpo-43795.y0IP4c.rst b/Misc/NEWS.d/next/C API/2021-04-20-15-06-29.bpo-43795.y0IP4c.rst
new file mode 100644 (file)
index 0000000..1dee6e2
--- /dev/null
@@ -0,0 +1,2 @@
+:c:func:`PyMem_Calloc` is now available in the limited C API
+(``Py_LIMITED_API``).