Skip to content

Commit e502451

Browse files
authored
closes bpo-34646: Remove PyAPI_* macros from declarations. (GH-9218)
1 parent 019f0a0 commit e502451

13 files changed

+33
-31
lines changed

Diff for: Modules/_hashopenssl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ EVP_hexdigest(EVPobject *self, PyObject *unused)
245245

246246
EVP_MD_CTX_free(temp_ctx);
247247

248-
return _Py_strhex((const char *)digest, digest_size);
248+
return _Py_strhex((const char *)digest, (Py_ssize_t)digest_size);
249249
}
250250

251251
PyDoc_STRVAR(EVP_update__doc__,

Diff for: Modules/_io/winconsoleio.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,6 @@ PyTypeObject PyWindowsConsoleIO_Type = {
11701170
0, /* tp_finalize */
11711171
};
11721172

1173-
PyAPI_DATA(PyObject *) _PyWindowsConsoleIO_Type = (PyObject*)&PyWindowsConsoleIO_Type;
1173+
PyObject * _PyWindowsConsoleIO_Type = (PyObject*)&PyWindowsConsoleIO_Type;
11741174

11751175
#endif /* MS_WINDOWS */

Diff for: Modules/posixmodule.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ PyOS_AfterFork(void)
488488

489489
#ifdef MS_WINDOWS
490490
/* defined in fileutils.c */
491-
PyAPI_FUNC(void) _Py_time_t_to_FILE_TIME(time_t, int, FILETIME *);
492-
PyAPI_FUNC(void) _Py_attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *,
491+
void _Py_time_t_to_FILE_TIME(time_t, int, FILETIME *);
492+
void _Py_attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *,
493493
ULONG, struct _Py_stat_struct *);
494494
#endif
495495

Diff for: Objects/methodobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static int numfree = 0;
1818
/* undefine macro trampoline to PyCFunction_NewEx */
1919
#undef PyCFunction_New
2020

21-
PyAPI_FUNC(PyObject *)
21+
PyObject *
2222
PyCFunction_New(PyMethodDef *ml, PyObject *self)
2323
{
2424
return PyCFunction_NewEx(ml, self, NULL);

Diff for: Objects/object.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2180,7 +2180,7 @@ _PyTrash_thread_destroy_chain(void)
21802180
/* For Py_LIMITED_API, we need an out-of-line version of _Py_Dealloc.
21812181
Define this here, so we can undefine the macro. */
21822182
#undef _Py_Dealloc
2183-
PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
2183+
void _Py_Dealloc(PyObject *);
21842184
void
21852185
_Py_Dealloc(PyObject *op)
21862186
{

Diff for: Parser/printgrammar.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ printgrammar(grammar *g, FILE *fp)
1818
fprintf(fp, "/* Generated by Parser/pgen */\n\n");
1919
fprintf(fp, "#include \"pgenheaders.h\"\n");
2020
fprintf(fp, "#include \"grammar.h\"\n");
21-
fprintf(fp, "PyAPI_DATA(grammar) _PyParser_Grammar;\n");
21+
fprintf(fp, "grammar _PyParser_Grammar;\n");
2222
printdfas(g, fp);
2323
printlabels(g, fp);
2424
fprintf(fp, "grammar _PyParser_Grammar = {\n");

Diff for: Python/_warnings.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ PyErr_WarnEx(PyObject *category, const char *text, Py_ssize_t stack_level)
10041004

10051005
#undef PyErr_Warn
10061006

1007-
PyAPI_FUNC(int)
1007+
int
10081008
PyErr_Warn(PyObject *category, const char *text)
10091009
{
10101010
return PyErr_WarnEx(category, text, 1);

Diff for: Python/compile.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5550,7 +5550,7 @@ assemble(struct compiler *c, int addNone)
55505550
}
55515551

55525552
#undef PyAST_Compile
5553-
PyAPI_FUNC(PyCodeObject *)
5553+
PyCodeObject *
55545554
PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags,
55555555
PyArena *arena)
55565556
{

Diff for: Python/graminit.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "pgenheaders.h"
44
#include "grammar.h"
5-
PyAPI_DATA(grammar) _PyParser_Grammar;
5+
grammar _PyParser_Grammar;
66
static arc arcs_0_0[3] = {
77
{2, 1},
88
{3, 1},

Diff for: Python/import.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ get_path_importer(PyObject *path_importer_cache, PyObject *path_hooks,
11381138
return importer;
11391139
}
11401140

1141-
PyAPI_FUNC(PyObject *)
1141+
PyObject *
11421142
PyImport_GetImporter(PyObject *path) {
11431143
PyObject *importer=NULL, *path_importer_cache=NULL, *path_hooks=NULL;
11441144

Diff for: Python/pystrhex.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include "Python.h"
44

5+
#include "pystrhex.h"
6+
57
static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
68
int return_bytes)
79
{
@@ -48,14 +50,14 @@ static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
4850
return retval;
4951
}
5052

51-
PyAPI_FUNC(PyObject *) _Py_strhex(const char* argbuf, const Py_ssize_t arglen)
53+
PyObject * _Py_strhex(const char* argbuf, const Py_ssize_t arglen)
5254
{
5355
return _Py_strhex_impl(argbuf, arglen, 0);
5456
}
5557

5658
/* Same as above but returns a bytes() instead of str() to avoid the
5759
* need to decode the str() when bytes are needed. */
58-
PyAPI_FUNC(PyObject *) _Py_strhex_bytes(const char* argbuf, const Py_ssize_t arglen)
60+
PyObject * _Py_strhex_bytes(const char* argbuf, const Py_ssize_t arglen)
5961
{
6062
return _Py_strhex_impl(argbuf, arglen, 1);
6163
}

Diff for: Python/pystrtod.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ _PyOS_ascii_formatd(char *buffer,
791791

792792
/* The fallback code to use if _Py_dg_dtoa is not available. */
793793

794-
PyAPI_FUNC(char *) PyOS_double_to_string(double val,
794+
char * PyOS_double_to_string(double val,
795795
char format_code,
796796
int precision,
797797
int flags,
@@ -1238,7 +1238,7 @@ format_float_short(double d, char format_code,
12381238
}
12391239

12401240

1241-
PyAPI_FUNC(char *) PyOS_double_to_string(double val,
1241+
char * PyOS_double_to_string(double val,
12421242
char format_code,
12431243
int precision,
12441244
int flags,

Diff for: Python/pythonrun.c

+16-16
Original file line numberDiff line numberDiff line change
@@ -1492,115 +1492,115 @@ PyOS_CheckStack(void)
14921492
/* Deprecated C API functions still provided for binary compatibility */
14931493

14941494
#undef PyParser_SimpleParseFile
1495-
PyAPI_FUNC(node *)
1495+
node *
14961496
PyParser_SimpleParseFile(FILE *fp, const char *filename, int start)
14971497
{
14981498
return PyParser_SimpleParseFileFlags(fp, filename, start, 0);
14991499
}
15001500

15011501
#undef PyParser_SimpleParseString
1502-
PyAPI_FUNC(node *)
1502+
node *
15031503
PyParser_SimpleParseString(const char *str, int start)
15041504
{
15051505
return PyParser_SimpleParseStringFlags(str, start, 0);
15061506
}
15071507

15081508
#undef PyRun_AnyFile
1509-
PyAPI_FUNC(int)
1509+
int
15101510
PyRun_AnyFile(FILE *fp, const char *name)
15111511
{
15121512
return PyRun_AnyFileExFlags(fp, name, 0, NULL);
15131513
}
15141514

15151515
#undef PyRun_AnyFileEx
1516-
PyAPI_FUNC(int)
1516+
int
15171517
PyRun_AnyFileEx(FILE *fp, const char *name, int closeit)
15181518
{
15191519
return PyRun_AnyFileExFlags(fp, name, closeit, NULL);
15201520
}
15211521

15221522
#undef PyRun_AnyFileFlags
1523-
PyAPI_FUNC(int)
1523+
int
15241524
PyRun_AnyFileFlags(FILE *fp, const char *name, PyCompilerFlags *flags)
15251525
{
15261526
return PyRun_AnyFileExFlags(fp, name, 0, flags);
15271527
}
15281528

15291529
#undef PyRun_File
1530-
PyAPI_FUNC(PyObject *)
1530+
PyObject *
15311531
PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l)
15321532
{
15331533
return PyRun_FileExFlags(fp, p, s, g, l, 0, NULL);
15341534
}
15351535

15361536
#undef PyRun_FileEx
1537-
PyAPI_FUNC(PyObject *)
1537+
PyObject *
15381538
PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c)
15391539
{
15401540
return PyRun_FileExFlags(fp, p, s, g, l, c, NULL);
15411541
}
15421542

15431543
#undef PyRun_FileFlags
1544-
PyAPI_FUNC(PyObject *)
1544+
PyObject *
15451545
PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l,
15461546
PyCompilerFlags *flags)
15471547
{
15481548
return PyRun_FileExFlags(fp, p, s, g, l, 0, flags);
15491549
}
15501550

15511551
#undef PyRun_SimpleFile
1552-
PyAPI_FUNC(int)
1552+
int
15531553
PyRun_SimpleFile(FILE *f, const char *p)
15541554
{
15551555
return PyRun_SimpleFileExFlags(f, p, 0, NULL);
15561556
}
15571557

15581558
#undef PyRun_SimpleFileEx
1559-
PyAPI_FUNC(int)
1559+
int
15601560
PyRun_SimpleFileEx(FILE *f, const char *p, int c)
15611561
{
15621562
return PyRun_SimpleFileExFlags(f, p, c, NULL);
15631563
}
15641564

15651565

15661566
#undef PyRun_String
1567-
PyAPI_FUNC(PyObject *)
1567+
PyObject *
15681568
PyRun_String(const char *str, int s, PyObject *g, PyObject *l)
15691569
{
15701570
return PyRun_StringFlags(str, s, g, l, NULL);
15711571
}
15721572

15731573
#undef PyRun_SimpleString
1574-
PyAPI_FUNC(int)
1574+
int
15751575
PyRun_SimpleString(const char *s)
15761576
{
15771577
return PyRun_SimpleStringFlags(s, NULL);
15781578
}
15791579

15801580
#undef Py_CompileString
1581-
PyAPI_FUNC(PyObject *)
1581+
PyObject *
15821582
Py_CompileString(const char *str, const char *p, int s)
15831583
{
15841584
return Py_CompileStringExFlags(str, p, s, NULL, -1);
15851585
}
15861586

15871587
#undef Py_CompileStringFlags
1588-
PyAPI_FUNC(PyObject *)
1588+
PyObject *
15891589
Py_CompileStringFlags(const char *str, const char *p, int s,
15901590
PyCompilerFlags *flags)
15911591
{
15921592
return Py_CompileStringExFlags(str, p, s, flags, -1);
15931593
}
15941594

15951595
#undef PyRun_InteractiveOne
1596-
PyAPI_FUNC(int)
1596+
int
15971597
PyRun_InteractiveOne(FILE *f, const char *p)
15981598
{
15991599
return PyRun_InteractiveOneFlags(f, p, NULL);
16001600
}
16011601

16021602
#undef PyRun_InteractiveLoop
1603-
PyAPI_FUNC(int)
1603+
int
16041604
PyRun_InteractiveLoop(FILE *f, const char *p)
16051605
{
16061606
return PyRun_InteractiveLoopFlags(f, p, NULL);

0 commit comments

Comments
 (0)