Skip to content

Commit 1c0689c

Browse files
committed
Issue python#19526: Exclude all new API from the stable ABI.
1 parent a2924ca commit 1c0689c

14 files changed

Lines changed: 37 additions & 2 deletions

File tree

Include/abstract.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
409409

410410
#ifndef Py_LIMITED_API
411411
PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o);
412+
PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
412413
#endif
413-
PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t);
414414

415415
/*
416416
Guess the size of object o using len(o) or o.__length_hint__().

Include/codecs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ PyAPI_FUNC(PyObject *) PyCodec_Decode(
9494
const char *errors
9595
);
9696

97-
#ifndef PY_LIMITED_API
97+
#ifndef Py_LIMITED_API
9898
/* Text codec specific encoding and decoding API.
9999
100100
Checks the encoding against a list of codecs which do not

Include/dictobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
5353
PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key);
5454
PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp,
5555
struct _Py_Identifier *key);
56+
#ifndef Py_LIMITED_API
5657
PyAPI_FUNC(PyObject *) PyDict_SetDefault(
5758
PyObject *mp, PyObject *key, PyObject *defaultobj);
59+
#endif
5860
PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
5961
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
6062
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);

Include/fileutils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ PyAPI_FUNC(int) _Py_stat(
2727
struct stat *statbuf);
2828
#endif
2929

30+
#ifndef Py_LIMITED_API
3031
PyAPI_FUNC(int) _Py_open(
3132
const char *pathname,
3233
int flags);
34+
#endif
3335

3436
PyAPI_FUNC(FILE *) _Py_wfopen(
3537
const wchar_t *path,
@@ -61,12 +63,14 @@ PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
6163
wchar_t *buf,
6264
size_t size);
6365

66+
#ifndef Py_LIMITED_API
6467
PyAPI_FUNC(int) _Py_get_inheritable(int fd);
6568

6669
PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
6770
int *atomic_flag_works);
6871

6972
PyAPI_FUNC(int) _Py_dup(int fd);
73+
#endif
7074

7175
#ifdef __cplusplus
7276
}

Include/object.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,10 @@ PyAPI_FUNC(int) PyObject_Not(PyObject *);
533533
PyAPI_FUNC(int) PyCallable_Check(PyObject *);
534534

535535
PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *);
536+
#ifndef Py_LIMITED_API
536537
PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject *);
537538
PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *);
539+
#endif
538540

539541
/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes
540542
dict as the last parameter. */

Include/pyerrors.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ typedef PyOSErrorObject PyWindowsErrorObject;
7575

7676
PyAPI_FUNC(void) PyErr_SetNone(PyObject *);
7777
PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);
78+
#ifndef Py_LIMITED_API
7879
PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
80+
#endif
7981
PyAPI_FUNC(void) PyErr_SetString(
8082
PyObject *exception,
8183
const char *string /* decoded from utf-8 */
@@ -321,16 +323,20 @@ PyAPI_FUNC(void) PyErr_SyntaxLocationEx(
321323
const char *filename, /* decoded from the filesystem encoding */
322324
int lineno,
323325
int col_offset);
326+
#ifndef Py_LIMITED_API
324327
PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
325328
PyObject *filename,
326329
int lineno,
327330
int col_offset);
331+
#endif
328332
PyAPI_FUNC(PyObject *) PyErr_ProgramText(
329333
const char *filename, /* decoded from the filesystem encoding */
330334
int lineno);
335+
#ifndef Py_LIMITED_API
331336
PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
332337
PyObject *filename,
333338
int lineno);
339+
#endif
334340

335341
/* The following functions are used to create and modify unicode
336342
exceptions from C */

Include/pyhash.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void*, Py_ssize_t);
5050
* (*) The siphash member may not be available on 32 bit platforms without
5151
* an unsigned int64 data type.
5252
*/
53+
#ifndef Py_LIMITED_API
5354
typedef union {
5455
/* ensure 24 bytes */
5556
unsigned char uc[24];
@@ -76,6 +77,7 @@ typedef union {
7677
} expat;
7778
} _Py_HashSecret_t;
7879
PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret;
80+
#endif
7981

8082
#ifdef Py_DEBUG
8183
PyAPI_DATA(int) _Py_HashSecret_Initialized;

Include/pymem.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
extern "C" {
1212
#endif
1313

14+
#ifndef Py_LIMITED_API
1415
PyAPI_FUNC(void *) PyMem_RawMalloc(size_t size);
1516
PyAPI_FUNC(void *) PyMem_RawRealloc(void *ptr, size_t new_size);
1617
PyAPI_FUNC(void) PyMem_RawFree(void *ptr);
18+
#endif
1719

1820

1921
/* BEWARE:
@@ -58,8 +60,10 @@ PyAPI_FUNC(void *) PyMem_Malloc(size_t size);
5860
PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size);
5961
PyAPI_FUNC(void) PyMem_Free(void *ptr);
6062

63+
#ifndef Py_LIMITED_API
6164
PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str);
6265
PyAPI_FUNC(char *) _PyMem_Strdup(const char *str);
66+
#endif
6367

6468
/* Macros. */
6569

Include/pystate.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void);
236236
/* Helper/diagnostic function - return 1 if the current thread
237237
* currently holds the GIL, 0 otherwise
238238
*/
239+
#ifndef Py_LIMITED_API
239240
PyAPI_FUNC(int) PyGILState_Check(void);
241+
#endif
240242

241243
#endif /* #ifdef WITH_THREAD */
242244

Include/pythonrun.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,12 @@ PyAPI_FUNC(struct symtable *) Py_SymtableString(
155155
const char *str,
156156
const char *filename, /* decoded from the filesystem encoding */
157157
int start);
158+
#ifndef Py_LIMITED_API
158159
PyAPI_FUNC(struct symtable *) Py_SymtableStringObject(
159160
const char *str,
160161
PyObject *filename,
161162
int start);
163+
#endif
162164

163165
PyAPI_FUNC(void) PyErr_Print(void);
164166
PyAPI_FUNC(void) PyErr_PrintEx(int);

0 commit comments

Comments
 (0)