8000 Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype · python/cpython@fe51c6d · GitHub
[go: up one dir, main page]

Skip to content

Commit fe51c6d

Browse files
committed
Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches.
1 parent d3c884d commit fe51c6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+71
-61
lines changed

Include/pythonrun.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ DL_IMPORT(void) Py_Exit(int);
7878

7979
DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *);
8080

81+
/* Bootstrap */
82+
PyAPI_FUNC(int) Py_Main(int argc, char **argv);
83+
8184
/* In getpath.c */
8285
PyAPI_FUNC(char *) Py_GetProgramFullPath(void);
8386
PyAPI_FUNC(char *) Py_GetPrefix(void);

Modules/_codecsmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ static PyMethodDef _codecs_functions[] = {
703703
{NULL, NULL} /* sentinel */
704704
};
705705

706-
DL_EXPORT(void)
706+
PyMODINIT_FUNC
707707
init_codecs(void)
708708
{
709709
Py_InitModule("_codecs", _codecs_functions);

Modules/_curses_panel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ static PyMethodDef PyCurses_methods[] = {
445445

446446
/* Initialization function for the module */
447447

448-
DL_EXPORT(void)
448+
PyMODINIT_FUNC
449449
init_curses_panel(void)
450450
{
451451
PyObject *m, *d, *v;

Modules/_cursesmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2474,7 +2474,7 @@ static PyMethodDef PyCurses_methods[] = {
24742474

24752475
/* Initialization function for the module */
24762476

2477-
DL_EXPORT(void)
2477+
PyMODINIT_FUNC
24782478
init_curses(void)
24792479
{
24802480
PyObject *m, *d, *v, *c_api_object;

Modules/_localemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static struct PyMethodDef PyLocale_Methods[] = {
649649
{NULL, NULL}
650650
};
651651

652-
DL_EXPORT(void)
652+
PyMODINIT_FUNC
653653
init_locale(void)
654654
{
655655
PyObject *m, *d, *x;

Modules/_ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ PyDoc_STRVAR(module_doc,
473473
"Implementation module for SSL socket operations. See the socket module\n\
474474
for documentation.");
475475

476-
DL_EXPORT(void)
476+
PyMODINIT_FUNC
477477
init_ssl(void)
478478
{
479479
PyObject *m, *d;

Modules/_weakref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ weakref_functions[] = {
109109
};
110110

111111

112-
DL_EXPORT(void)
112+
PyMODINIT_FUNC
113113
init_weakref(void)
114114
{
115115
PyObject *m;

Modules/arraymodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,7 @@ static PyMethodDef a_methods[] = {
19081908
};
19091909

19101910

1911-
DL_EXPORT(void)
1911+
PyMODINIT_FUNC
19121912
initarray(void)
19131913
{
19141914
PyObject *m;

Modules/audioop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ static PyMethodDef audioop_methods[] = {
13691369
{ 0, 0 }
13701370
};
13711371

1372-
DL_EXPORT(void)
1372+
PyMODINIT_FUNC
13731373
initaudioop(void)
13741374
{
13751375
PyObject *m, *d;

Modules/binascii.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ static struct PyMethodDef binascii_module_methods[] = {
13131313
/* Initialization function for the module (*must* be called initbinascii) */
13141314
PyDoc_STRVAR(doc_binascii, "Conversion between binary data and ASCII");
13151315

1316-
DL_EXPORT(void)
1316+
PyMODINIT_FUNC
13171317
initbinascii(void)
13181318
{
13191319
PyObject *m, *d, *x;

Modules/cPickle.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4789,10 +4789,10 @@ init_stuff(PyObject *module_dict)
47894789
return 0;
47904790
}
47914791

4792-
#ifndef DL_EXPORT /* declarations for DLL import/export */
4793-
#define DL_EXPORT(RTYPE) RTYPE
4792+
#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
4793+
#define PyMODINIT_FUNC void
47944794
#endif
4795-
DL_EXPORT(void)
4795+
PyMODINIT_FUNC
47964796
initcPickle(void)
47974797
{
47984798
PyObject *m, *d, *di, *v, *k;

Modules/cStringIO.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,10 +701,10 @@ static struct PycStringIO_CAPI CAPI = {
701701
&Otype,
702702
};
703703

704-
#ifndef DL_EXPORT /* declarations for DLL import/export */
705-
#define DL_EXPORT(RTYPE) RTYPE
704+
#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
705+
#define PyMODINIT_FUNC void
706706
#endif
707-
DL_EXPORT(void)
707+
PyMODINIT_FUNC
708708
initcStringIO(void) {
709709
PyObject *m, *d, *v;
710710

Modules/cmathmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ static PyMethodDef cmath_methods[] = {
391391
{NULL, NULL} /* sentinel */
392392
};
393393

394-
DL_EXPORT(void)
394+
PyMODINIT_FUNC
395395
initcmath(void)
396396
{
397397
PyObject *m;

Modules/cryptmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static PyMethodDef crypt_methods[] = {
3737
{NULL, NULL} /* sentinel */
3838
};
3939

40-
DL_EXPORT(void)
40+
PyMODINIT_FUNC
4141
initcrypt(void)
4242
{
4343
Py_InitModule("crypt", crypt_methods);

Modules/dbmmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static PyMethodDef dbmmodule_methods[] = {
339339
{ 0, 0 },
340340
};
341341

342-
DL_EXPORT(void)
342+
PyMODINIT_FUNC
343343
initdbm(void) {
344344
PyObject *m, *d, *s;
345345

Modules/dlmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ insint(PyObject *d, char *name, int value)
209209
Py_XDECREF(v);
210210
}
211211

212-
DL_EXPORT(void)
212+
PyMODINIT_FUNC
213213
initdl(void)
214214
{
215215
PyObject *m, *d, *x;

Modules/errnomodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Symbols that are not relevant to the underlying system are not defined.\n\
5757
To map error codes to error messages, use the function os.strerror(),\n\
5858
e.g. os.strerror(2) could return 'No such file or directory'.");
5959

60-
DL_EXPORT(void)
60+
PyMODINIT_FUNC
6161
initerrno(void)
6262
{
6363
PyObject *m, *d, *de;

Modules/fcntlmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ all_ins(PyObject* d)
462462
return 0;
463463
}
464464

465-
DL_EXPORT(void)
465+
PyMODINIT_FUNC
466466
initfcntl(void)
467467
{
468468
PyObject *m, *d;

Modules/flmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2126,7 +2126,7 @@ static PyMethodDef forms_methods[] = {
21262126
{NULL, NULL} /* sentinel */
21272127
};
21282128

2129-
DL_EXPORT(void)
2129+
PyMODINIT_FUNC
21302130
initfl(void)
21312131
{
21322132
Py_InitModule("fl", forms_methods);

Modules/fpectlmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static Sigfunc sigfpe_handler;
8686
static void fpe_reset(Sigfunc *);
8787

8888
static PyObject *fpe_error;
89-
DL_EXPORT(void) initfpectl(void);
89+
PyMODINIT_FUNC initfpectl(void);
9090
static PyObject *turnon_sigfpe (PyObject *self,PyObject *args);
9191
static PyObject *turnoff_sigfpe (PyObject *self,PyObject *args);
9292

@@ -249,7 +249,7 @@ static void sigfpe_handler(int signo)
249249
}
250250
}
251251

252-
DL_EXPORT(void) initfpectl(void)
252+
PyMODINIT_FUNC initfpectl(void)
253253
{
254254
PyObject *m, *d;
255255
m = Py_InitModule("fpectl", fpectl_methods);

Modules/fpetestmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include "Python.h"
4545

4646
static PyObject *fpe_error;
47-
DL_EXPORT(void) initfpetest(void);
47+
PyMODINIT_FUNC initfpetest(void);
4848
static PyObject *test(PyObject *self,PyObject *args);
4949
static double db0(double);
5050
static double overflow(double);
@@ -172,7 +172,7 @@ static double overflow(double b)
172172
return a;
173173
}
174174

175-
DL_EXPORT(void) initfpetest(void)
175+
PyMODINIT_FUNC initfpetest(void)
176176
{
177177
PyObject *m, *d;
178178

Modules/gdbmmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ static PyMethodDef dbmmodule_methods[] = {
504504
{ 0, 0 },
505505
};
506506

507-
DL_EXPORT(void)
507+
PyMODINIT_FUNC
508508
initgdbm(void) {
509509
PyObject *m, *d, *s;
510510

Modules/grpmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ according to the password database. Check both databases to get\n\
156156
complete membership information.)");
157157

158158

159-
DL_EXPORT(void)
159+
PyMODINIT_FUNC
160160
initgrp(void)
161161
{
162162
PyObject *m, *d;

Modules/imageop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ static PyMethodDef imageop_methods[] = {
696696
};
697697

698698

699-
DL_EXPORT(void)
699+
PyMODINIT_FUNC
700700
initimageop(void)
701701
{
702702
PyObject *m, *d;

Modules/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ usage(int exitcode, char* program)
105105

106106
/* Main program */
107107

108-
DL_EXPORT(int)
108+
int
109109
Py_Main(int argc, char **argv)
110110
{
111111
int c;

Modules/mathmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ PyDoc_STRVAR(module_doc,
334334
"This module is always available. It provides access to the\n"
335335
"mathematical functions defined by the C standard.");
336336

337-
DL_EXPORT(void)
337+
PyMODINIT_FUNC
338338
initmath(void)
339339
{
340340
PyObject *m, *d, *v;

Modules/md5module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ static PyMethodDef md5_functions[] = {
253253

254254
/* Initialize this module. */
255255

256-
DL_EXPORT(void)
256+
PyMODINIT_FUNC
257257
initmd5(void)
258258
{
259259
PyObject *m, *d;

Modules/mpzmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,7 @@ void mp_free(void *ptr, size_t size)
16441644

16451645
/* Initialize this module. */
16461646

1647-
DL_EXPORT(void)
1647+
PyMODINIT_FUNC
16481648
initmpz(void)
16491649
{
16501650
PyObject *module;

Modules/operator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ spam2(ge,__ge__, "ge(a, b) -- Same as a>=b.")
219219

220220
/* Initialization function for the module (*must* be called initoperator) */
221221

222-
DL_EXPORT(void)
222+
PyMODINIT_FUNC
223223
initoperator(void)
224224
{
225225
/* Create the module and add the functions */

Modules/pcremodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ insint(PyObject *d, char *name, int value)
610610

611611
/* Initialization function for the module (*must* be called initpcre) */
612612

613-
DL_EXPORT(void)
613+
PyMODINIT_FUNC
614614
initpcre(void)
615615
{
616616
PyObject *m, *d;

Modules/posixmodule.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3211,6 +3211,7 @@ _PyPopenCreateProcess(char *cmdstring,
32113211
{
32123212
PROCESS_INFORMATION piProcInfo;
32133213
STARTUPINFO siStartInfo;
3214+
DWORD dwProcessFlags = 0; /* no NEW_CONSOLE by default for Ctrl+C handling */
32143215
char *s1,*s2, *s3 = " /c ";
32153216
const char *szConsoleSpawn = "w9xpopen.exe";
32163217
int i;
@@ -3303,6 +3304,16 @@ _PyPopenCreateProcess(char *cmdstring,
33033304
s1,
33043305
s3,
33053306
cmdstring);
3307+
/* Not passing CREATE_NEW_CONSOLE has been known to
3308+
cause random failures on win9x. Specifically a
3309+
dialog:
3310+
"Your program accessed mem currently in use at xxx"
3311+
and a hopeful warning about the stability of your
3312+
system.
3313+
Cost is Ctrl+C wont kill children, but anyone
3314+
who cares can have a go!
3315+
*/
3316+
dwProcessFlags |= CREATE_NEW_CONSOLE;
33063317
}
33073318
}
33083319

@@ -3328,7 +3339,7 @@ _PyPopenCreateProcess(char *cmdstring,
33283339
NULL,
33293340
NULL,
33303341
TRUE,
3331-
0, /* no new console so Ctrl+C kills child too */
3342+
dwProcessFlags,
33323343
NULL,
33333344
NULL,
33343345
&siStartInfo,
@@ -6746,7 +6757,7 @@ all_ins(PyObject *d)
67466757
#define MODNAME "posix"
67476758
#endif
67486759

6749-
DL_EXPORT(void)
6760+
PyMODINIT_FUNC
67506761
INITFUNC(void)
67516762
{
67526763
PyObject *m, *v;

Modules/pwdmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static PyMethodDef pwd_methods[] = {
157157
{NULL, NULL} /* sentinel */
158158
};
159159

160-
DL_EXPORT(void)
160+
PyMODINIT_FUNC
161161
initpwd(void)
162162
{
163163
PyObject *m;

Modules/python.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#include "Python.h"
44

5-
extern DL_EXPORT(int) Py_Main(int, char **);
6-
75
int
86
main(int argc, char **argv)
97
{

Modules/readline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ call_readline(char *prompt)
652652
PyDoc_STRVAR(doc_module,
653653
"Importing this module enables command line editing using GNU readline.");
654654

655-
DL_EXPORT(void)
655+
PyMODINIT_FUNC
656656
initreadline(void)
657657
{
658658
PyObject *m;

Modules/regexmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ static struct PyMethodDef regex_global_methods[] = {
642642
{NULL, NULL} /* sentinel */
643643
};
644644

645-
DL_EXPORT(void)
645+
PyMODINIT_FUNC
646646
initregex(void)
647647
{
648648
PyObject *m, *d, *v;

Modules/resource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
< AF3F code class="diff-text-cell hunk">
@@ -210,7 +210,7 @@ resource_methods[] = {
210210

211211
/* Module initialization */
212212

213-
DL_EXPORT(void)
213+
PyMODINIT_FUNC
214214
initresource(void)
215215
{
216216
PyObject *m, *v;

Modules/rgbimgmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ rgbimg_methods[] = {
751751
};
752752

753753

754-
DL_EXPORT(void)
754+
PyMODINIT_FUNC
755755
initrgbimg(void)
756756
{
757757
PyObject *m, *d;

0 commit comments

Comments
 (0)
0