Skip to content

Commit ae51cba

Browse files
committed
Move all PyAPI_FUNC() definitions to the file level
1 parent 5db5b81 commit ae51cba

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

pythoncapi_compat.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,11 @@ static inline int PyLong_IsZero(PyObject *obj)
15691569

15701570
// gh-124502 added PyUnicode_Equal() to Python 3.14.0a0
15711571
#if PY_VERSION_HEX < 0x030E00A0
1572+
1573+
#if PY_VERSION_HEX >= 0x030d0000 && !defined(PYPY_VERSION)
1574+
PyAPI_FUNC(int) _PyUnicode_Equal(PyObject *str1, PyObject *str2);
1575+
#endif
1576+
15721577
static inline int PyUnicode_Equal(PyObject *str1, PyObject *str2)
15731578
{
15741579
if (!PyUnicode_Check(str1)) {
@@ -1583,8 +1588,6 @@ static inline int PyUnicode_Equal(PyObject *str1, PyObject *str2)
15831588
}
15841589

15851590
#if PY_VERSION_HEX >= 0x030d0000 && !defined(PYPY_VERSION)
1586-
PyAPI_FUNC(int) _PyUnicode_Equal(PyObject *str1, PyObject *str2);
1587-
15881591
return _PyUnicode_Equal(str1, str2);
15891592
#elif PY_VERSION_HEX >= 0x03060000 && !defined(PYPY_VERSION)
15901593
return _PyUnicode_EQ(str1, str2);
@@ -1607,11 +1610,14 @@ static inline PyObject* PyBytes_Join(PyObject *sep, PyObject *iterable)
16071610

16081611

16091612
#if PY_VERSION_HEX < 0x030E00A0
1613+
1614+
#if PY_VERSION_HEX >= 0x03000000 && !defined(PYPY_VERSION)
1615+
PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void *src, Py_ssize_t len);
1616+
#endif
1617+
16101618
static inline Py_hash_t Py_HashBuffer(const void *ptr, Py_ssize_t len)
16111619
{
16121620
#if PY_VERSION_HEX >= 0x03000000 && !defined(PYPY_VERSION)
1613-
PyAPI_FUNC(Py_hash_t) _Py_HashBytes(const void *src, Py_ssize_t len);
1614-
16151621
return _Py_HashBytes(ptr, len);
16161622
#else
16171623
Py_hash_t hash;
@@ -1948,11 +1954,14 @@ PyLongWriter_Finish(PyLongWriter *writer)
19481954

19491955
// gh-127350 added Py_fopen() and Py_fclose() to Python 3.14a4
19501956
#if PY_VERSION_HEX < 0x030E00A4
1957+
1958+
#if 0x030400A2 <= PY_VERSION_HEX && !defined(PYPY_VERSION)
1959+
PyAPI_FUNC(FILE*) _Py_fopen_obj(PyObject *path, const char *mode);
1960+
#endif
1961+
19511962
static inline FILE* Py_fopen(PyObject *path, const char *mode)
19521963
{
19531964
#if 0x030400A2 <= PY_VERSION_HEX && !defined(PYPY_VERSION)
1954-
PyAPI_FUNC(FILE*) _Py_fopen_obj(PyObject *path, const char *mode);
1955-
19561965
return _Py_fopen_obj(path, mode);
19571966
#else
19581967
FILE *f;

0 commit comments

Comments
 (0)