Issue #17917: Use PyModule_AddIntMacro() instead of PyModule_AddIntConstant()

when applicable.
This commit is contained in:
Charles-Francois Natali 2013-05-20 19:13:19 +02:00
parent d66b10e165
commit 74ca886788
12 changed files with 681 additions and 708 deletions

View File

@ -5299,8 +5299,8 @@ PyInit__datetime(void)
return NULL; return NULL;
/* module initialization */ /* module initialization */
PyModule_AddIntConstant(m, "MINYEAR", MINYEAR); PyModule_AddIntMacro(m, MINYEAR);
PyModule_AddIntConstant(m, "MAXYEAR", MAXYEAR); PyModule_AddIntMacro(m, MAXYEAR);
Py_INCREF(&PyDateTime_DateType); Py_INCREF(&PyDateTime_DateType);
PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType); PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType);

View File

@ -2837,36 +2837,36 @@ PyInit__testbuffer(void)
if (simple_format == NULL) if (simple_format == NULL)
return NULL; return NULL;
PyModule_AddIntConstant(m, "ND_MAX_NDIM", ND_MAX_NDIM); PyModule_AddIntMacro(m, ND_MAX_NDIM);
PyModule_AddIntConstant(m, "ND_VAREXPORT", ND_VAREXPORT); PyModule_AddIntMacro(m, ND_VAREXPORT);
PyModule_AddIntConstant(m, "ND_WRITABLE", ND_WRITABLE); PyModule_AddIntMacro(m, ND_WRITABLE);
PyModule_AddIntConstant(m, "ND_FORTRAN", ND_FORTRAN); PyModule_AddIntMacro(m, ND_FORTRAN);
PyModule_AddIntConstant(m, "ND_SCALAR", ND_SCALAR); PyModule_AddIntMacro(m, ND_SCALAR);
PyModule_AddIntConstant(m, "ND_PIL", ND_PIL); PyModule_AddIntMacro(m, ND_PIL);
PyModule_AddIntConstant(m, "ND_GETBUF_FAIL", ND_GETBUF_FAIL); PyModule_AddIntMacro(m, ND_GETBUF_FAIL);
PyModule_AddIntConstant(m, "ND_GETBUF_UNDEFINED", ND_GETBUF_UNDEFINED); PyModule_AddIntMacro(m, ND_GETBUF_UNDEFINED);
PyModule_AddIntConstant(m, "ND_REDIRECT", ND_REDIRECT); PyModule_AddIntMacro(m, ND_REDIRECT);
PyModule_AddIntConstant(m, "PyBUF_SIMPLE", PyBUF_SIMPLE); PyModule_AddIntMacro(m, PyBUF_SIMPLE);
PyModule_AddIntConstant(m, "PyBUF_WRITABLE", PyBUF_WRITABLE); PyModule_AddIntMacro(m, PyBUF_WRITABLE);
PyModule_AddIntConstant(m, "PyBUF_FORMAT", PyBUF_FORMAT); PyModule_AddIntMacro(m, PyBUF_FORMAT);
PyModule_AddIntConstant(m, "PyBUF_ND", PyBUF_ND); PyModule_AddIntMacro(m, PyBUF_ND);
PyModule_AddIntConstant(m, "PyBUF_STRIDES", PyBUF_STRIDES); PyModule_AddIntMacro(m, PyBUF_STRIDES);
PyModule_AddIntConstant(m, "PyBUF_INDIRECT", PyBUF_INDIRECT); PyModule_AddIntMacro(m, PyBUF_INDIRECT);
PyModule_AddIntConstant(m, "PyBUF_C_CONTIGUOUS", PyBUF_C_CONTIGUOUS); PyModule_AddIntMacro(m, PyBUF_C_CONTIGUOUS);
PyModule_AddIntConstant(m, "PyBUF_F_CONTIGUOUS", PyBUF_F_CONTIGUOUS); PyModule_AddIntMacro(m, PyBUF_F_CONTIGUOUS);
PyModule_AddIntConstant(m, "PyBUF_ANY_CONTIGUOUS", PyBUF_ANY_CONTIGUOUS); PyModule_AddIntMacro(m, PyBUF_ANY_CONTIGUOUS);
PyModule_AddIntConstant(m, "PyBUF_FULL", PyBUF_FULL); PyModule_AddIntMacro(m, PyBUF_FULL);
PyModule_AddIntConstant(m, "PyBUF_FULL_RO", PyBUF_FULL_RO); PyModule_AddIntMacro(m, PyBUF_FULL_RO);
PyModule_AddIntConstant(m, "PyBUF_RECORDS", PyBUF_RECORDS); PyModule_AddIntMacro(m, PyBUF_RECORDS);
PyModule_AddIntConstant(m, "PyBUF_RECORDS_RO", PyBUF_RECORDS_RO); PyModule_AddIntMacro(m, PyBUF_RECORDS_RO);
PyModule_AddIntConstant(m, "PyBUF_STRIDED", PyBUF_STRIDED); PyModule_AddIntMacro(m, PyBUF_STRIDED);
PyModule_AddIntConstant(m, "PyBUF_STRIDED_RO", PyBUF_STRIDED_RO); PyModule_AddIntMacro(m, PyBUF_STRIDED_RO);
PyModule_AddIntConstant(m, "PyBUF_CONTIG", PyBUF_CONTIG); PyModule_AddIntMacro(m, PyBUF_CONTIG);
PyModule_AddIntConstant(m, "PyBUF_CONTIG_RO", PyBUF_CONTIG_RO); PyModule_AddIntMacro(m, PyBUF_CONTIG_RO);
PyModule_AddIntConstant(m, "PyBUF_READ", PyBUF_READ); PyModule_AddIntMacro(m, PyBUF_READ);
PyModule_AddIntConstant(m, "PyBUF_WRITE", PyBUF_WRITE); PyModule_AddIntMacro(m, PyBUF_WRITE);
return m; return m;
} }

View File

@ -424,191 +424,179 @@ a file or socket object.");
/* Module initialisation */ /* Module initialisation */
static int
ins(PyObject* d, char* symbol, long value)
{
PyObject* v = PyLong_FromLong(value);
if (!v || PyDict_SetItemString(d, symbol, v) < 0)
return -1;
Py_DECREF(v);
return 0;
}
#define INS(x) if (ins(d, #x, (long)x)) return -1
static int static int
all_ins(PyObject* d) all_ins(PyObject* m)
{ {
if (ins(d, "LOCK_SH", (long)LOCK_SH)) return -1; if (PyModule_AddIntMacro(m, LOCK_SH)) return -1;
if (ins(d, "LOCK_EX", (long)LOCK_EX)) return -1; if (PyModule_AddIntMacro(m, LOCK_EX)) return -1;
if (ins(d, "LOCK_NB", (long)LOCK_NB)) return -1; if (PyModule_AddIntMacro(m, LOCK_NB)) return -1;
if (ins(d, "LOCK_UN", (long)LOCK_UN)) return -1; if (PyModule_AddIntMacro(m, LOCK_UN)) return -1;
/* GNU extensions, as of glibc 2.2.4 */ /* GNU extensions, as of glibc 2.2.4 */
#ifdef LOCK_MAND #ifdef LOCK_MAND
if (ins(d, "LOCK_MAND", (long)LOCK_MAND)) return -1; if (PyModule_AddIntMacro(m, LOCK_MAND)) return -1;
#endif #endif
#ifdef LOCK_READ #ifdef LOCK_READ
if (ins(d, "LOCK_READ", (long)LOCK_READ)) return -1; if (PyModule_AddIntMacro(m, LOCK_READ)) return -1;
#endif #endif
#ifdef LOCK_WRITE #ifdef LOCK_WRITE
if (ins(d, "LOCK_WRITE", (long)LOCK_WRITE)) return -1; if (PyModule_AddIntMacro(m, LOCK_WRITE)) return -1;
#endif #endif
#ifdef LOCK_RW #ifdef LOCK_RW
if (ins(d, "LOCK_RW", (long)LOCK_RW)) return -1; if (PyModule_AddIntMacro(m, LOCK_RW)) return -1;
#endif #endif
#ifdef F_DUPFD #ifdef F_DUPFD
if (ins(d, "F_DUPFD", (long)F_DUPFD)) return -1; if (PyModule_AddIntMacro(m, F_DUPFD)) return -1;
#endif #endif
#ifdef F_DUPFD_CLOEXEC #ifdef F_DUPFD_CLOEXEC
if (ins(d, "F_DUPFD_CLOEXEC", (long)F_DUPFD_CLOEXEC)) return -1; if (PyModule_AddIntMacro(m, F_DUPFD_CLOEXEC)) return -1;
#endif #endif
#ifdef F_GETFD #ifdef F_GETFD
if (ins(d, "F_GETFD", (long)F_GETFD)) return -1; if (PyModule_AddIntMacro(m, F_GETFD)) return -1;
#endif #endif
#ifdef F_SETFD #ifdef F_SETFD
if (ins(d, "F_SETFD", (long)F_SETFD)) return -1; if (PyModule_AddIntMacro(m, F_SETFD)) return -1;
#endif #endif
#ifdef F_GETFL #ifdef F_GETFL
if (ins(d, "F_GETFL", (long)F_GETFL)) return -1; if (PyModule_AddIntMacro(m, F_GETFL)) return -1;
#endif #endif
#ifdef F_SETFL #ifdef F_SETFL
if (ins(d, "F_SETFL", (long)F_SETFL)) return -1; if (PyModule_AddIntMacro(m, F_SETFL)) return -1;
#endif #endif
#ifdef F_GETLK #ifdef F_GETLK
if (ins(d, "F_GETLK", (long)F_GETLK)) return -1; if (PyModule_AddIntMacro(m, F_GETLK)) return -1;
#endif #endif
#ifdef F_SETLK #ifdef F_SETLK
if (ins(d, "F_SETLK", (long)F_SETLK)) return -1; if (PyModule_AddIntMacro(m, F_SETLK)) return -1;
#endif #endif
#ifdef F_SETLKW #ifdef F_SETLKW
if (ins(d, "F_SETLKW", (long)F_SETLKW)) return -1; if (PyModule_AddIntMacro(m, F_SETLKW)) return -1;
#endif #endif
#ifdef F_GETOWN #ifdef F_GETOWN
if (ins(d, "F_GETOWN", (long)F_GETOWN)) return -1; if (PyModule_AddIntMacro(m, F_GETOWN)) return -1;
#endif #endif
#ifdef F_SETOWN #ifdef F_SETOWN
if (ins(d, "F_SETOWN", (long)F_SETOWN)) return -1; if (PyModule_AddIntMacro(m, F_SETOWN)) return -1;
#endif #endif
#ifdef F_GETSIG #ifdef F_GETSIG
if (ins(d, "F_GETSIG", (long)F_GETSIG)) return -1; if (PyModule_AddIntMacro(m, F_GETSIG)) return -1;
#endif #endif
#ifdef F_SETSIG #ifdef F_SETSIG
if (ins(d, "F_SETSIG", (long)F_SETSIG)) return -1; if (PyModule_AddIntMacro(m, F_SETSIG)) return -1;
#endif #endif
#ifdef F_RDLCK #ifdef F_RDLCK
if (ins(d, "F_RDLCK", (long)F_RDLCK)) return -1; if (PyModule_AddIntMacro(m, F_RDLCK)) return -1;
#endif #endif
#ifdef F_WRLCK #ifdef F_WRLCK
if (ins(d, "F_WRLCK", (long)F_WRLCK)) return -1; if (PyModule_AddIntMacro(m, F_WRLCK)) return -1;
#endif #endif
#ifdef F_UNLCK #ifdef F_UNLCK
if (ins(d, "F_UNLCK", (long)F_UNLCK)) return -1; if (PyModule_AddIntMacro(m, F_UNLCK)) return -1;
#endif #endif
/* LFS constants */ /* LFS constants */
#ifdef F_GETLK64 #ifdef F_GETLK64
if (ins(d, "F_GETLK64", (long)F_GETLK64)) return -1; if (PyModule_AddIntMacro(m, F_GETLK64)) return -1;
#endif #endif
#ifdef F_SETLK64 #ifdef F_SETLK64
if (ins(d, "F_SETLK64", (long)F_SETLK64)) return -1; if (PyModule_AddIntMacro(m, F_SETLK64)) return -1;
#endif #endif
#ifdef F_SETLKW64 #ifdef F_SETLKW64
if (ins(d, "F_SETLKW64", (long)F_SETLKW64)) return -1; if (PyModule_AddIntMacro(m, F_SETLKW64)) return -1;
#endif #endif
/* GNU extensions, as of glibc 2.2.4. */ /* GNU extensions, as of glibc 2.2.4. */
#ifdef FASYNC #ifdef FASYNC
if (ins(d, "FASYNC", (long)FASYNC)) return -1; if (PyModule_AddIntMacro(m, FASYNC)) return -1;
#endif #endif
#ifdef F_SETLEASE #ifdef F_SETLEASE
if (ins(d, "F_SETLEASE", (long)F_SETLEASE)) return -1; if (PyModule_AddIntMacro(m, F_SETLEASE)) return -1;
#endif #endif
#ifdef F_GETLEASE #ifdef F_GETLEASE
if (ins(d, "F_GETLEASE", (long)F_GETLEASE)) return -1; if (PyModule_AddIntMacro(m, F_GETLEASE)) return -1;
#endif #endif
#ifdef F_NOTIFY #ifdef F_NOTIFY
if (ins(d, "F_NOTIFY", (long)F_NOTIFY)) return -1; if (PyModule_AddIntMacro(m, F_NOTIFY)) return -1;
#endif #endif
/* Old BSD flock(). */ /* Old BSD flock(). */
#ifdef F_EXLCK #ifdef F_EXLCK
if (ins(d, "F_EXLCK", (long)F_EXLCK)) return -1; if (PyModule_AddIntMacro(m, F_EXLCK)) return -1;
#endif #endif
#ifdef F_SHLCK #ifdef F_SHLCK
if (ins(d, "F_SHLCK", (long)F_SHLCK)) return -1; if (PyModule_AddIntMacro(m, F_SHLCK)) return -1;
#endif #endif
/* OS X specifics */ /* OS X specifics */
#ifdef F_FULLFSYNC #ifdef F_FULLFSYNC
if (ins(d, "F_FULLFSYNC", (long)F_FULLFSYNC)) return -1; if (PyModule_AddIntMacro(m, F_FULLFSYNC)) return -1;
#endif #endif
#ifdef F_NOCACHE #ifdef F_NOCACHE
if (ins(d, "F_NOCACHE", (long)F_NOCACHE)) return -1; if (PyModule_AddIntMacro(m, F_NOCACHE)) return -1;
#endif #endif
/* For F_{GET|SET}FL */ /* For F_{GET|SET}FL */
#ifdef FD_CLOEXEC #ifdef FD_CLOEXEC
if (ins(d, "FD_CLOEXEC", (long)FD_CLOEXEC)) return -1; if (PyModule_AddIntMacro(m, FD_CLOEXEC)) return -1;
#endif #endif
/* For F_NOTIFY */ /* For F_NOTIFY */
#ifdef DN_ACCESS #ifdef DN_ACCESS
if (ins(d, "DN_ACCESS", (long)DN_ACCESS)) return -1; if (PyModule_AddIntMacro(m, DN_ACCESS)) return -1;
#endif #endif
#ifdef DN_MODIFY #ifdef DN_MODIFY
if (ins(d, "DN_MODIFY", (long)DN_MODIFY)) return -1; if (PyModule_AddIntMacro(m, DN_MODIFY)) return -1;
#endif #endif
#ifdef DN_CREATE #ifdef DN_CREATE
if (ins(d, "DN_CREATE", (long)DN_CREATE)) return -1; if (PyModule_AddIntMacro(m, DN_CREATE)) return -1;
#endif #endif
#ifdef DN_DELETE #ifdef DN_DELETE
if (ins(d, "DN_DELETE", (long)DN_DELETE)) return -1; if (PyModule_AddIntMacro(m, DN_DELETE)) return -1;
#endif #endif
#ifdef DN_RENAME #ifdef DN_RENAME
if (ins(d, "DN_RENAME", (long)DN_RENAME)) return -1; if (PyModule_AddIntMacro(m, DN_RENAME)) return -1;
#endif #endif
#ifdef DN_ATTRIB #ifdef DN_ATTRIB
if (ins(d, "DN_ATTRIB", (long)DN_ATTRIB)) return -1; if (PyModule_AddIntMacro(m, DN_ATTRIB)) return -1;
#endif #endif
#ifdef DN_MULTISHOT #ifdef DN_MULTISHOT
if (ins(d, "DN_MULTISHOT", (long)DN_MULTISHOT)) return -1; if (PyModule_AddIntMacro(m, DN_MULTISHOT)) return -1;
#endif #endif
#ifdef HAVE_STROPTS_H #ifdef HAVE_STROPTS_H
/* Unix 98 guarantees that these are in stropts.h. */ /* Unix 98 guarantees that these are in stropts.h. */
INS(I_PUSH); if (PyModule_AddIntMacro(m, I_PUSH)) return -1;
INS(I_POP); if (PyModule_AddIntMacro(m, I_POP)) return -1;
INS(I_LOOK); if (PyModule_AddIntMacro(m, I_LOOK)) return -1;
INS(I_FLUSH); if (PyModule_AddIntMacro(m, I_FLUSH)) return -1;
INS(I_FLUSHBAND); if (PyModule_AddIntMacro(m, I_FLUSHBAND)) return -1;
INS(I_SETSIG); if (PyModule_AddIntMacro(m, I_SETSIG)) return -1;
INS(I_GETSIG); if (PyModule_AddIntMacro(m, I_GETSIG)) return -1;
INS(I_FIND); if (PyModule_AddIntMacro(m, I_FIND)) return -1;
INS(I_PEEK); if (PyModule_AddIntMacro(m, I_PEEK)) return -1;
INS(I_SRDOPT); if (PyModule_AddIntMacro(m, I_SRDOPT)) return -1;
INS(I_GRDOPT); if (PyModule_AddIntMacro(m, I_GRDOPT)) return -1;
INS(I_NREAD); if (PyModule_AddIntMacro(m, I_NREAD)) return -1;
INS(I_FDINSERT); if (PyModule_AddIntMacro(m, I_FDINSERT)) return -1;
INS(I_STR); if (PyModule_AddIntMacro(m, I_STR)) return -1;
INS(I_SWROPT); if (PyModule_AddIntMacro(m, I_SWROPT)) return -1;
#ifdef I_GWROPT #ifdef I_GWROPT
/* despite the comment above, old-ish glibcs miss a couple... */ /* despite the comment above, old-ish glibcs miss a couple... */
INS(I_GWROPT); if (PyModule_AddIntMacro(m, I_GWROPT)) return -1;
#endif #endif
INS(I_SENDFD); if (PyModule_AddIntMacro(m, I_SENDFD)) return -1;
INS(I_RECVFD); if (PyModule_AddIntMacro(m, I_RECVFD)) return -1;
INS(I_LIST); if (PyModule_AddIntMacro(m, I_LIST)) return -1;
INS(I_ATMARK); if (PyModule_AddIntMacro(m, I_ATMARK)) return -1;
INS(I_CKBAND); if (PyModule_AddIntMacro(m, I_CKBAND)) return -1;
INS(I_GETBAND); if (PyModule_AddIntMacro(m, I_GETBAND)) return -1;
INS(I_CANPUT); if (PyModule_AddIntMacro(m, I_CANPUT)) return -1;
INS(I_SETCLTIME); if (PyModule_AddIntMacro(m, I_SETCLTIME)) return -1;
#ifdef I_GETCLTIME #ifdef I_GETCLTIME
INS(I_GETCLTIME); if (PyModule_AddIntMacro(m, I_GETCLTIME)) return -1;
#endif #endif
INS(I_LINK); if (PyModule_AddIntMacro(m, I_LINK)) return -1;
INS(I_UNLINK); if (PyModule_AddIntMacro(m, I_UNLINK)) return -1;
INS(I_PLINK); if (PyModule_AddIntMacro(m, I_PLINK)) return -1;
INS(I_PUNLINK); if (PyModule_AddIntMacro(m, I_PUNLINK)) return -1;
#endif #endif
return 0; return 0;
@ -630,7 +618,7 @@ static struct PyModuleDef fcntlmodule = {
PyMODINIT_FUNC PyMODINIT_FUNC
PyInit_fcntl(void) PyInit_fcntl(void)
{ {
PyObject *m, *d; PyObject *m;
/* Create the module and add the functions and documentation */ /* Create the module and add the functions and documentation */
m = PyModule_Create(&fcntlmodule); m = PyModule_Create(&fcntlmodule);
@ -638,7 +626,6 @@ PyInit_fcntl(void)
return NULL; return NULL;
/* Add some symbolic constants to the module */ /* Add some symbolic constants to the module */
d = PyModule_GetDict(m); all_ins(m);
all_ins(d);
return m; return m;
} }

View File

@ -10800,12 +10800,6 @@ static PyMethodDef posix_methods[] = {
}; };
static int
ins(PyObject *module, char *symbol, long value)
{
return PyModule_AddIntConstant(module, symbol, value);
}
#if defined(HAVE_SYMLINK) && defined(MS_WINDOWS) #if defined(HAVE_SYMLINK) && defined(MS_WINDOWS)
static int static int
enable_symlink() enable_symlink()
@ -10836,376 +10830,376 @@ enable_symlink()
#endif /* defined(HAVE_SYMLINK) && defined(MS_WINDOWS) */ #endif /* defined(HAVE_SYMLINK) && defined(MS_WINDOWS) */
static int static int
all_ins(PyObject *d) all_ins(PyObject *m)
{ {
#ifdef F_OK #ifdef F_OK
if (ins(d, "F_OK", (long)F_OK)) return -1; if (PyModule_AddIntMacro(m, F_OK)) return -1;
#endif #endif
#ifdef R_OK #ifdef R_OK
if (ins(d, "R_OK", (long)R_OK)) return -1; if (PyModule_AddIntMacro(m, R_OK)) return -1;
#endif #endif
#ifdef W_OK #ifdef W_OK
if (ins(d, "W_OK", (long)W_OK)) return -1; if (PyModule_AddIntMacro(m, W_OK)) return -1;
#endif #endif
#ifdef X_OK #ifdef X_OK
if (ins(d, "X_OK", (long)X_OK)) return -1; if (PyModule_AddIntMacro(m, X_OK)) return -1;
#endif #endif
#ifdef NGROUPS_MAX #ifdef NGROUPS_MAX
if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1; if (PyModule_AddIntMacro(m, NGROUPS_MAX)) return -1;
#endif #endif
#ifdef TMP_MAX #ifdef TMP_MAX
if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; if (PyModule_AddIntMacro(m, TMP_MAX)) return -1;
#endif #endif
#ifdef WCONTINUED #ifdef WCONTINUED
if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1; if (PyModule_AddIntMacro(m, WCONTINUED)) return -1;
#endif #endif
#ifdef WNOHANG #ifdef WNOHANG
if (ins(d, "WNOHANG", (long)WNOHANG)) return -1; if (PyModule_AddIntMacro(m, WNOHANG)) return -1;
#endif #endif
#ifdef WUNTRACED #ifdef WUNTRACED
if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1; if (PyModule_AddIntMacro(m, WUNTRACED)) return -1;
#endif #endif
#ifdef O_RDONLY #ifdef O_RDONLY
if (ins(d, "O_RDONLY", (long)O_RDONLY)) return -1; if (PyModule_AddIntMacro(m, O_RDONLY)) return -1;
#endif #endif
#ifdef O_WRONLY #ifdef O_WRONLY
if (ins(d, "O_WRONLY", (long)O_WRONLY)) return -1; if (PyModule_AddIntMacro(m, O_WRONLY)) return -1;
#endif #endif
#ifdef O_RDWR #ifdef O_RDWR
if (ins(d, "O_RDWR", (long)O_RDWR)) return -1; if (PyModule_AddIntMacro(m, O_RDWR)) return -1;
#endif #endif
#ifdef O_NDELAY #ifdef O_NDELAY
if (ins(d, "O_NDELAY", (long)O_NDELAY)) return -1; if (PyModule_AddIntMacro(m, O_NDELAY)) return -1;
#endif #endif
#ifdef O_NONBLOCK #ifdef O_NONBLOCK
if (ins(d, "O_NONBLOCK", (long)O_NONBLOCK)) return -1; if (PyModule_AddIntMacro(m, O_NONBLOCK)) return -1;
#endif #endif
#ifdef O_APPEND #ifdef O_APPEND
if (ins(d, "O_APPEND", (long)O_APPEND)) return -1; if (PyModule_AddIntMacro(m, O_APPEND)) return -1;
#endif #endif
#ifdef O_DSYNC #ifdef O_DSYNC
if (ins(d, "O_DSYNC", (long)O_DSYNC)) return -1; if (PyModule_AddIntMacro(m, O_DSYNC)) return -1;
#endif #endif
#ifdef O_RSYNC #ifdef O_RSYNC
if (ins(d, "O_RSYNC", (long)O_RSYNC)) return -1; if (PyModule_AddIntMacro(m, O_RSYNC)) return -1;
#endif #endif
#ifdef O_SYNC #ifdef O_SYNC
if (ins(d, "O_SYNC", (long)O_SYNC)) return -1; if (PyModule_AddIntMacro(m, O_SYNC)) return -1;
#endif #endif
#ifdef O_NOCTTY #ifdef O_NOCTTY
if (ins(d, "O_NOCTTY", (long)O_NOCTTY)) return -1; if (PyModule_AddIntMacro(m, O_NOCTTY)) return -1;
#endif #endif
#ifdef O_CREAT #ifdef O_CREAT
if (ins(d, "O_CREAT", (long)O_CREAT)) return -1; if (PyModule_AddIntMacro(m, O_CREAT)) return -1;
#endif #endif
#ifdef O_EXCL #ifdef O_EXCL
if (ins(d, "O_EXCL", (long)O_EXCL)) return -1; if (PyModule_AddIntMacro(m, O_EXCL)) return -1;
#endif #endif
#ifdef O_TRUNC #ifdef O_TRUNC
if (ins(d, "O_TRUNC", (long)O_TRUNC)) return -1; if (PyModule_AddIntMacro(m, O_TRUNC)) return -1;
#endif #endif
#ifdef O_BINARY #ifdef O_BINARY
if (ins(d, "O_BINARY", (long)O_BINARY)) return -1; if (PyModule_AddIntMacro(m, O_BINARY)) return -1;
#endif #endif
#ifdef O_TEXT #ifdef O_TEXT
if (ins(d, "O_TEXT", (long)O_TEXT)) return -1; if (PyModule_AddIntMacro(m, O_TEXT)) return -1;
#endif #endif
#ifdef O_XATTR #ifdef O_XATTR
if (ins(d, "O_XATTR", (long)O_XATTR)) return -1; if (PyModule_AddIntMacro(m, O_XATTR)) return -1;
#endif #endif
#ifdef O_LARGEFILE #ifdef O_LARGEFILE
if (ins(d, "O_LARGEFILE", (long)O_LARGEFILE)) return -1; if (PyModule_AddIntMacro(m, O_LARGEFILE)) return -1;
#endif #endif
#ifdef O_SHLOCK #ifdef O_SHLOCK
if (ins(d, "O_SHLOCK", (long)O_SHLOCK)) return -1; if (PyModule_AddIntMacro(m, O_SHLOCK)) return -1;
#endif #endif
#ifdef O_EXLOCK #ifdef O_EXLOCK
if (ins(d, "O_EXLOCK", (long)O_EXLOCK)) return -1; if (PyModule_AddIntMacro(m, O_EXLOCK)) return -1;
#endif #endif
#ifdef O_EXEC #ifdef O_EXEC
if (ins(d, "O_EXEC", (long)O_EXEC)) return -1; if (PyModule_AddIntMacro(m, O_EXEC)) return -1;
#endif #endif
#ifdef O_SEARCH #ifdef O_SEARCH
if (ins(d, "O_SEARCH", (long)O_SEARCH)) return -1; if (PyModule_AddIntMacro(m, O_SEARCH)) return -1;
#endif #endif
#ifdef O_PATH #ifdef O_PATH
if (ins(d, "O_PATH", (long)O_PATH)) return -1; if (PyModule_AddIntMacro(m, O_PATH)) return -1;
#endif #endif
#ifdef O_TTY_INIT #ifdef O_TTY_INIT
if (ins(d, "O_TTY_INIT", (long)O_TTY_INIT)) return -1; if (PyModule_AddIntMacro(m, O_TTY_INIT)) return -1;
#endif #endif
#ifdef PRIO_PROCESS #ifdef PRIO_PROCESS
if (ins(d, "PRIO_PROCESS", (long)PRIO_PROCESS)) return -1; if (PyModule_AddIntMacro(m, PRIO_PROCESS)) return -1;
#endif #endif
#ifdef PRIO_PGRP #ifdef PRIO_PGRP
if (ins(d, "PRIO_PGRP", (long)PRIO_PGRP)) return -1; if (PyModule_AddIntMacro(m, PRIO_PGRP)) return -1;
#endif #endif
#ifdef PRIO_USER #ifdef PRIO_USER
if (ins(d, "PRIO_USER", (long)PRIO_USER)) return -1; if (PyModule_AddIntMacro(m, PRIO_USER)) return -1;
#endif #endif
#ifdef O_CLOEXEC #ifdef O_CLOEXEC
if (ins(d, "O_CLOEXEC", (long)O_CLOEXEC)) return -1; if (PyModule_AddIntMacro(m, O_CLOEXEC)) return -1;
#endif #endif
#ifdef O_ACCMODE #ifdef O_ACCMODE
if (ins(d, "O_ACCMODE", (long)O_ACCMODE)) return -1; if (PyModule_AddIntMacro(m, O_ACCMODE)) return -1;
#endif #endif
#ifdef SEEK_HOLE #ifdef SEEK_HOLE
if (ins(d, "SEEK_HOLE", (long)SEEK_HOLE)) return -1; if (PyModule_AddIntMacro(m, SEEK_HOLE)) return -1;
#endif #endif
#ifdef SEEK_DATA #ifdef SEEK_DATA
if (ins(d, "SEEK_DATA", (long)SEEK_DATA)) return -1; if (PyModule_AddIntMacro(m, SEEK_DATA)) return -1;
#endif #endif
/* MS Windows */ /* MS Windows */
#ifdef O_NOINHERIT #ifdef O_NOINHERIT
/* Don't inherit in child processes. */ /* Don't inherit in child processes. */
if (ins(d, "O_NOINHERIT", (long)O_NOINHERIT)) return -1; if (PyModule_AddIntMacro(m, O_NOINHERIT)) return -1;
#endif #endif
#ifdef _O_SHORT_LIVED #ifdef _O_SHORT_LIVED
/* Optimize for short life (keep in memory). */ /* Optimize for short life (keep in memory). */
/* MS forgot to define this one with a non-underscore form too. */ /* MS forgot to define this one with a non-underscore form too. */
if (ins(d, "O_SHORT_LIVED", (long)_O_SHORT_LIVED)) return -1; if (PyModule_AddIntConstant(m, "O_SHORT_LIVED", _O_SHORT_LIVED)) return -1;
#endif #endif
#ifdef O_TEMPORARY #ifdef O_TEMPORARY
/* Automatically delete when last handle is closed. */ /* Automatically delete when last handle is closed. */
if (ins(d, "O_TEMPORARY", (long)O_TEMPORARY)) return -1; if (PyModule_AddIntMacro(m, O_TEMPORARY)) return -1;
#endif #endif
#ifdef O_RANDOM #ifdef O_RANDOM
/* Optimize for random access. */ /* Optimize for random access. */
if (ins(d, "O_RANDOM", (long)O_RANDOM)) return -1; if (PyModule_AddIntMacro(m, O_RANDOM)) return -1;
#endif #endif
#ifdef O_SEQUENTIAL #ifdef O_SEQUENTIAL
/* Optimize for sequential access. */ /* Optimize for sequential access. */
if (ins(d, "O_SEQUENTIAL", (long)O_SEQUENTIAL)) return -1; if (PyModule_AddIntMacro(m, O_SEQUENTIAL)) return -1;
#endif #endif
/* GNU extensions. */ /* GNU extensions. */
#ifdef O_ASYNC #ifdef O_ASYNC
/* Send a SIGIO signal whenever input or output /* Send a SIGIO signal whenever input or output
becomes available on file descriptor */ becomes available on file descriptor */
if (ins(d, "O_ASYNC", (long)O_ASYNC)) return -1; if (PyModule_AddIntMacro(m, O_ASYNC)) return -1;
#endif #endif
#ifdef O_DIRECT #ifdef O_DIRECT
/* Direct disk access. */ /* Direct disk access. */
if (ins(d, "O_DIRECT", (long)O_DIRECT)) return -1; if (PyModule_AddIntMacro(m, O_DIRECT)) return -1;
#endif #endif
#ifdef O_DIRECTORY #ifdef O_DIRECTORY
/* Must be a directory. */ /* Must be a directory. */
if (ins(d, "O_DIRECTORY", (long)O_DIRECTORY)) return -1; if (PyModule_AddIntMacro(m, O_DIRECTORY)) return -1;
#endif #endif
#ifdef O_NOFOLLOW #ifdef O_NOFOLLOW
/* Do not follow links. */ /* Do not follow links. */
if (ins(d, "O_NOFOLLOW", (long)O_NOFOLLOW)) return -1; if (PyModule_AddIntMacro(m, O_NOFOLLOW)) return -1;
#endif #endif
#ifdef O_NOLINKS #ifdef O_NOLINKS
/* Fails if link count of the named file is greater than 1 */ /* Fails if link count of the named file is greater than 1 */
if (ins(d, "O_NOLINKS", (long)O_NOLINKS)) return -1; if (PyModule_AddIntMacro(m, O_NOLINKS)) return -1;
#endif #endif
#ifdef O_NOATIME #ifdef O_NOATIME
/* Do not update the access time. */ /* Do not update the access time. */
if (ins(d, "O_NOATIME", (long)O_NOATIME)) return -1; if (PyModule_AddIntMacro(m, O_NOATIME)) return -1;
#endif #endif
/* These come from sysexits.h */ /* These come from sysexits.h */
#ifdef EX_OK #ifdef EX_OK
if (ins(d, "EX_OK", (long)EX_OK)) return -1; if (PyModule_AddIntMacro(m, EX_OK)) return -1;
#endif /* EX_OK */ #endif /* EX_OK */
#ifdef EX_USAGE #ifdef EX_USAGE
if (ins(d, "EX_USAGE", (long)EX_USAGE)) return -1; if (PyModule_AddIntMacro(m, EX_USAGE)) return -1;
#endif /* EX_USAGE */ #endif /* EX_USAGE */
#ifdef EX_DATAERR #ifdef EX_DATAERR
if (ins(d, "EX_DATAERR", (long)EX_DATAERR)) return -1; if (PyModule_AddIntMacro(m, EX_DATAERR)) return -1;
#endif /* EX_DATAERR */ #endif /* EX_DATAERR */
#ifdef EX_NOINPUT #ifdef EX_NOINPUT
if (ins(d, "EX_NOINPUT", (long)EX_NOINPUT)) return -1; if (PyModule_AddIntMacro(m, EX_NOINPUT)) return -1;
#endif /* EX_NOINPUT */ #endif /* EX_NOINPUT */
#ifdef EX_NOUSER #ifdef EX_NOUSER
if (ins(d, "EX_NOUSER", (long)EX_NOUSER)) return -1; if (PyModule_AddIntMacro(m, EX_NOUSER)) return -1;
#endif /* EX_NOUSER */ #endif /* EX_NOUSER */
#ifdef EX_NOHOST #ifdef EX_NOHOST
if (ins(d, "EX_NOHOST", (long)EX_NOHOST)) return -1; if (PyModule_AddIntMacro(m, EX_NOHOST)) return -1;
#endif /* EX_NOHOST */ #endif /* EX_NOHOST */
#ifdef EX_UNAVAILABLE #ifdef EX_UNAVAILABLE
if (ins(d, "EX_UNAVAILABLE", (long)EX_UNAVAILABLE)) return -1; if (PyModule_AddIntMacro(m, EX_UNAVAILABLE)) return -1;
#endif /* EX_UNAVAILABLE */ #endif /* EX_UNAVAILABLE */
#ifdef EX_SOFTWARE #ifdef EX_SOFTWARE
if (ins(d, "EX_SOFTWARE", (long)EX_SOFTWARE)) return -1; if (PyModule_AddIntMacro(m, EX_SOFTWARE)) return -1;
#endif /* EX_SOFTWARE */ #endif /* EX_SOFTWARE */
#ifdef EX_OSERR #ifdef EX_OSERR
if (ins(d, "EX_OSERR", (long)EX_OSERR)) return -1; if (PyModule_AddIntMacro(m, EX_OSERR)) return -1;
#endif /* EX_OSERR */ #endif /* EX_OSERR */
#ifdef EX_OSFILE #ifdef EX_OSFILE
if (ins(d, "EX_OSFILE", (long)EX_OSFILE)) return -1; if (PyModule_AddIntMacro(m, EX_OSFILE)) return -1;
#endif /* EX_OSFILE */ #endif /* EX_OSFILE */
#ifdef EX_CANTCREAT #ifdef EX_CANTCREAT
if (ins(d, "EX_CANTCREAT", (long)EX_CANTCREAT)) return -1; if (PyModule_AddIntMacro(m, EX_CANTCREAT)) return -1;
#endif /* EX_CANTCREAT */ #endif /* EX_CANTCREAT */
#ifdef EX_IOERR #ifdef EX_IOERR
if (ins(d, "EX_IOERR", (long)EX_IOERR)) return -1; if (PyModule_AddIntMacro(m, EX_IOERR)) return -1;
#endif /* EX_IOERR */ #endif /* EX_IOERR */
#ifdef EX_TEMPFAIL #ifdef EX_TEMPFAIL
if (ins(d, "EX_TEMPFAIL", (long)EX_TEMPFAIL)) return -1; if (PyModule_AddIntMacro(m, EX_TEMPFAIL)) return -1;
#endif /* EX_TEMPFAIL */ #endif /* EX_TEMPFAIL */
#ifdef EX_PROTOCOL #ifdef EX_PROTOCOL
if (ins(d, "EX_PROTOCOL", (long)EX_PROTOCOL)) return -1; if (PyModule_AddIntMacro(m, EX_PROTOCOL)) return -1;
#endif /* EX_PROTOCOL */ #endif /* EX_PROTOCOL */
#ifdef EX_NOPERM #ifdef EX_NOPERM
if (ins(d, "EX_NOPERM", (long)EX_NOPERM)) return -1; if (PyModule_AddIntMacro(m, EX_NOPERM)) return -1;
#endif /* EX_NOPERM */ #endif /* EX_NOPERM */
#ifdef EX_CONFIG #ifdef EX_CONFIG
if (ins(d, "EX_CONFIG", (long)EX_CONFIG)) return -1; if (PyModule_AddIntMacro(m, EX_CONFIG)) return -1;
#endif /* EX_CONFIG */ #endif /* EX_CONFIG */
#ifdef EX_NOTFOUND #ifdef EX_NOTFOUND
if (ins(d, "EX_NOTFOUND", (long)EX_NOTFOUND)) return -1; if (PyModule_AddIntMacro(m, EX_NOTFOUND)) return -1;
#endif /* EX_NOTFOUND */ #endif /* EX_NOTFOUND */
/* statvfs */ /* statvfs */
#ifdef ST_RDONLY #ifdef ST_RDONLY
if (ins(d, "ST_RDONLY", (long)ST_RDONLY)) return -1; if (PyModule_AddIntMacro(m, ST_RDONLY)) return -1;
#endif /* ST_RDONLY */ #endif /* ST_RDONLY */
#ifdef ST_NOSUID #ifdef ST_NOSUID
if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1; if (PyModule_AddIntMacro(m, ST_NOSUID)) return -1;
#endif /* ST_NOSUID */ #endif /* ST_NOSUID */
/* FreeBSD sendfile() constants */ /* FreeBSD sendfile() constants */
#ifdef SF_NODISKIO #ifdef SF_NODISKIO
if (ins(d, "SF_NODISKIO", (long)SF_NODISKIO)) return -1; if (PyModule_AddIntMacro(m, SF_NODISKIO)) return -1;
#endif #endif
#ifdef SF_MNOWAIT #ifdef SF_MNOWAIT
if (ins(d, "SF_MNOWAIT", (long)SF_MNOWAIT)) return -1; if (PyModule_AddIntMacro(m, SF_MNOWAIT)) return -1;
#endif #endif
#ifdef SF_SYNC #ifdef SF_SYNC
if (ins(d, "SF_SYNC", (long)SF_SYNC)) return -1; if (PyModule_AddIntMacro(m, SF_SYNC)) return -1;
#endif #endif
/* constants for posix_fadvise */ /* constants for posix_fadvise */
#ifdef POSIX_FADV_NORMAL #ifdef POSIX_FADV_NORMAL
if (ins(d, "POSIX_FADV_NORMAL", (long)POSIX_FADV_NORMAL)) return -1; if (PyModule_AddIntMacro(m, POSIX_FADV_NORMAL)) return -1;
#endif #endif
#ifdef POSIX_FADV_SEQUENTIAL #ifdef POSIX_FADV_SEQUENTIAL
if (ins(d, "POSIX_FADV_SEQUENTIAL", (long)POSIX_FADV_SEQUENTIAL)) return -1; if (PyModule_AddIntMacro(m, POSIX_FADV_SEQUENTIAL)) return -1;
#endif #endif
#ifdef POSIX_FADV_RANDOM #ifdef POSIX_FADV_RANDOM
if (ins(d, "POSIX_FADV_RANDOM", (long)POSIX_FADV_RANDOM)) return -1; if (PyModule_AddIntMacro(m, POSIX_FADV_RANDOM)) return -1;
#endif #endif
#ifdef POSIX_FADV_NOREUSE #ifdef POSIX_FADV_NOREUSE
if (ins(d, "POSIX_FADV_NOREUSE", (long)POSIX_FADV_NOREUSE)) return -1; if (PyModule_AddIntMacro(m, POSIX_FADV_NOREUSE)) return -1;
#endif #endif
#ifdef POSIX_FADV_WILLNEED #ifdef POSIX_FADV_WILLNEED
if (ins(d, "POSIX_FADV_WILLNEED", (long)POSIX_FADV_WILLNEED)) return -1; if (PyModule_AddIntMacro(m, POSIX_FADV_WILLNEED)) return -1;
#endif #endif
#ifdef POSIX_FADV_DONTNEED #ifdef POSIX_FADV_DONTNEED
if (ins(d, "POSIX_FADV_DONTNEED", (long)POSIX_FADV_DONTNEED)) return -1; if (PyModule_AddIntMacro(m, POSIX_FADV_DONTNEED)) return -1;
#endif #endif
/* constants for waitid */ /* constants for waitid */
#if defined(HAVE_SYS_WAIT_H) && defined(HAVE_WAITID) #if defined(HAVE_SYS_WAIT_H) && defined(HAVE_WAITID)
if (ins(d, "P_PID", (long)P_PID)) return -1; if (PyModule_AddIntMacro(m, P_PID)) return -1;
if (ins(d, "P_PGID", (long)P_PGID)) return -1; if (PyModule_AddIntMacro(m, P_PGID)) return -1;
if (ins(d, "P_ALL", (long)P_ALL)) return -1; if (PyModule_AddIntMacro(m, P_ALL)) return -1;
#endif #endif
#ifdef WEXITED #ifdef WEXITED
if (ins(d, "WEXITED", (long)WEXITED)) return -1; if (PyModule_AddIntMacro(m, WEXITED)) return -1;
#endif #endif
#ifdef WNOWAIT #ifdef WNOWAIT
if (ins(d, "WNOWAIT", (long)WNOWAIT)) return -1; if (PyModule_AddIntMacro(m, WNOWAIT)) return -1;
#endif #endif
#ifdef WSTOPPED #ifdef WSTOPPED
if (ins(d, "WSTOPPED", (long)WSTOPPED)) return -1; if (PyModule_AddIntMacro(m, WSTOPPED)) return -1;
#endif #endif
#ifdef CLD_EXITED #ifdef CLD_EXITED
if (ins(d, "CLD_EXITED", (long)CLD_EXITED)) return -1; if (PyModule_AddIntMacro(m, CLD_EXITED)) return -1;
#endif #endif
#ifdef CLD_DUMPED #ifdef CLD_DUMPED
if (ins(d, "CLD_DUMPED", (long)CLD_DUMPED)) return -1; if (PyModule_AddIntMacro(m, CLD_DUMPED)) return -1;
#endif #endif
#ifdef CLD_TRAPPED #ifdef CLD_TRAPPED
if (ins(d, "CLD_TRAPPED", (long)CLD_TRAPPED)) return -1; if (PyModule_AddIntMacro(m, CLD_TRAPPED)) return -1;
#endif #endif
#ifdef CLD_CONTINUED #ifdef CLD_CONTINUED
if (ins(d, "CLD_CONTINUED", (long)CLD_CONTINUED)) return -1; if (PyModule_AddIntMacro(m, CLD_CONTINUED)) return -1;
#endif #endif
/* constants for lockf */ /* constants for lockf */
#ifdef F_LOCK #ifdef F_LOCK
if (ins(d, "F_LOCK", (long)F_LOCK)) return -1; if (PyModule_AddIntMacro(m, F_LOCK)) return -1;
#endif #endif
#ifdef F_TLOCK #ifdef F_TLOCK
if (ins(d, "F_TLOCK", (long)F_TLOCK)) return -1; if (PyModule_AddIntMacro(m, F_TLOCK)) return -1;
#endif #endif
#ifdef F_ULOCK #ifdef F_ULOCK
if (ins(d, "F_ULOCK", (long)F_ULOCK)) return -1; if (PyModule_AddIntMacro(m, F_ULOCK)) return -1;
#endif #endif
#ifdef F_TEST #ifdef F_TEST
if (ins(d, "F_TEST", (long)F_TEST)) return -1; if (PyModule_AddIntMacro(m, F_TEST)) return -1;
#endif #endif
#ifdef HAVE_SPAWNV #ifdef HAVE_SPAWNV
if (ins(d, "P_WAIT", (long)_P_WAIT)) return -1; if (PyModule_AddIntConstant(m, "P_WAIT", _P_WAIT)) return -1;
if (ins(d, "P_NOWAIT", (long)_P_NOWAIT)) return -1; if (PyModule_AddIntConstant(m, "P_NOWAIT", _P_NOWAIT)) return -1;
if (ins(d, "P_OVERLAY", (long)_OLD_P_OVERLAY)) return -1; if (PyModule_AddIntConstant(m, "P_OVERLAY", _OLD_P_OVERLAY)) return -1;
if (ins(d, "P_NOWAITO", (long)_P_NOWAITO)) return -1; if (PyModule_AddIntConstant(m, "P_NOWAITO", _P_NOWAITO)) return -1;
if (ins(d, "P_DETACH", (long)_P_DETACH)) return -1; if (PyModule_AddIntConstant(m, "P_DETACH", _P_DETACH)) return -1;
#endif #endif
#ifdef HAVE_SCHED_H #ifdef HAVE_SCHED_H
if (ins(d, "SCHED_OTHER", (long)SCHED_OTHER)) return -1; if (PyModule_AddIntMacro(m, SCHED_OTHER)) return -1;
if (ins(d, "SCHED_FIFO", (long)SCHED_FIFO)) return -1; if (PyModule_AddIntMacro(m, SCHED_FIFO)) return -1;
if (ins(d, "SCHED_RR", (long)SCHED_RR)) return -1; if (PyModule_AddIntMacro(m, SCHED_RR)) return -1;
#ifdef SCHED_SPORADIC #ifdef SCHED_SPORADIC
if (ins(d, "SCHED_SPORADIC", (long)SCHED_SPORADIC) return -1; if (PyModule_AddIntMacro(m, SCHED_SPORADIC) return -1;
#endif #endif
#ifdef SCHED_BATCH #ifdef SCHED_BATCH
if (ins(d, "SCHED_BATCH", (long)SCHED_BATCH)) return -1; if (PyModule_AddIntMacro(m, SCHED_BATCH)) return -1;
#endif #endif
#ifdef SCHED_IDLE #ifdef SCHED_IDLE
if (ins(d, "SCHED_IDLE", (long)SCHED_IDLE)) return -1; if (PyModule_AddIntMacro(m, SCHED_IDLE)) return -1;
#endif #endif
#ifdef SCHED_RESET_ON_FORK #ifdef SCHED_RESET_ON_FORK
if (ins(d, "SCHED_RESET_ON_FORK", (long)SCHED_RESET_ON_FORK)) return -1; if (PyModule_AddIntMacro(m, SCHED_RESET_ON_FORK)) return -1;
#endif #endif
#ifdef SCHED_SYS #ifdef SCHED_SYS
if (ins(d, "SCHED_SYS", (long)SCHED_SYS)) return -1; if (PyModule_AddIntMacro(m, SCHED_SYS)) return -1;
#endif #endif
#ifdef SCHED_IA #ifdef SCHED_IA
if (ins(d, "SCHED_IA", (long)SCHED_IA)) return -1; if (PyModule_AddIntMacro(m, SCHED_IA)) return -1;
#endif #endif
#ifdef SCHED_FSS #ifdef SCHED_FSS
if (ins(d, "SCHED_FSS", (long)SCHED_FSS)) return -1; if (PyModule_AddIntMacro(m, SCHED_FSS)) return -1;
#endif #endif
#ifdef SCHED_FX #ifdef SCHED_FX
if (ins(d, "SCHED_FX", (long)SCHED_FSS)) return -1; if (PyModule_AddIntConstant(m, "SCHED_FX", SCHED_FSS)) return -1;
#endif #endif
#endif #endif
#ifdef USE_XATTRS #ifdef USE_XATTRS
if (ins(d, "XATTR_CREATE", (long)XATTR_CREATE)) return -1; if (PyModule_AddIntMacro(m, XATTR_CREATE)) return -1;
if (ins(d, "XATTR_REPLACE", (long)XATTR_REPLACE)) return -1; if (PyModule_AddIntMacro(m, XATTR_REPLACE)) return -1;
if (ins(d, "XATTR_SIZE_MAX", (long)XATTR_SIZE_MAX)) return -1; if (PyModule_AddIntMacro(m, XATTR_SIZE_MAX)) return -1;
#endif #endif
#ifdef RTLD_LAZY #ifdef RTLD_LAZY
if (PyModule_AddIntMacro(d, RTLD_LAZY)) return -1; if (PyModule_AddIntMacro(m, RTLD_LAZY)) return -1;
#endif #endif
#ifdef RTLD_NOW #ifdef RTLD_NOW
if (PyModule_AddIntMacro(d, RTLD_NOW)) return -1; if (PyModule_AddIntMacro(m, RTLD_NOW)) return -1;
#endif #endif
#ifdef RTLD_GLOBAL #ifdef RTLD_GLOBAL
if (PyModule_AddIntMacro(d, RTLD_GLOBAL)) return -1; if (PyModule_AddIntMacro(m, RTLD_GLOBAL)) return -1;
#endif #endif
#ifdef RTLD_LOCAL #ifdef RTLD_LOCAL
if (PyModule_AddIntMacro(d, RTLD_LOCAL)) return -1; if (PyModule_AddIntMacro(m, RTLD_LOCAL)) return -1;
#endif #endif
#ifdef RTLD_NODELETE #ifdef RTLD_NODELETE
if (PyModule_AddIntMacro(d, RTLD_NODELETE)) return -1; if (PyModule_AddIntMacro(m, RTLD_NODELETE)) return -1;
#endif #endif
#ifdef RTLD_NOLOAD #ifdef RTLD_NOLOAD
if (PyModule_AddIntMacro(d, RTLD_NOLOAD)) return -1; if (PyModule_AddIntMacro(m, RTLD_NOLOAD)) return -1;
#endif #endif
#ifdef RTLD_DEEPBIND #ifdef RTLD_DEEPBIND
if (PyModule_AddIntMacro(d, RTLD_DEEPBIND)) return -1; if (PyModule_AddIntMacro(m, RTLD_DEEPBIND)) return -1;
#endif #endif
return 0; return 0;

View File

@ -272,71 +272,71 @@ PyInit_resource(void)
/* insert constants */ /* insert constants */
#ifdef RLIMIT_CPU #ifdef RLIMIT_CPU
PyModule_AddIntConstant(m, "RLIMIT_CPU", RLIMIT_CPU); PyModule_AddIntMacro(m, RLIMIT_CPU);
#endif #endif
#ifdef RLIMIT_FSIZE #ifdef RLIMIT_FSIZE
PyModule_AddIntConstant(m, "RLIMIT_FSIZE", RLIMIT_FSIZE); PyModule_AddIntMacro(m, RLIMIT_FSIZE);
#endif #endif
#ifdef RLIMIT_DATA #ifdef RLIMIT_DATA
PyModule_AddIntConstant(m, "RLIMIT_DATA", RLIMIT_DATA); PyModule_AddIntMacro(m, RLIMIT_DATA);
#endif #endif
#ifdef RLIMIT_STACK #ifdef RLIMIT_STACK
PyModule_AddIntConstant(m, "RLIMIT_STACK", RLIMIT_STACK); PyModule_AddIntMacro(m, RLIMIT_STACK);
#endif #endif
#ifdef RLIMIT_CORE #ifdef RLIMIT_CORE
PyModule_AddIntConstant(m, "RLIMIT_CORE", RLIMIT_CORE); PyModule_AddIntMacro(m, RLIMIT_CORE);
#endif #endif
#ifdef RLIMIT_NOFILE #ifdef RLIMIT_NOFILE
PyModule_AddIntConstant(m, "RLIMIT_NOFILE", RLIMIT_NOFILE); PyModule_AddIntMacro(m, RLIMIT_NOFILE);
#endif #endif
#ifdef RLIMIT_OFILE #ifdef RLIMIT_OFILE
PyModule_AddIntConstant(m, "RLIMIT_OFILE", RLIMIT_OFILE); PyModule_AddIntMacro(m, RLIMIT_OFILE);
#endif #endif
#ifdef RLIMIT_VMEM #ifdef RLIMIT_VMEM
PyModule_AddIntConstant(m, "RLIMIT_VMEM", RLIMIT_VMEM); PyModule_AddIntMacro(m, RLIMIT_VMEM);
#endif #endif
#ifdef RLIMIT_AS #ifdef RLIMIT_AS
PyModule_AddIntConstant(m, "RLIMIT_AS", RLIMIT_AS); PyModule_AddIntMacro(m, RLIMIT_AS);
#endif #endif
#ifdef RLIMIT_RSS #ifdef RLIMIT_RSS
PyModule_AddIntConstant(m, "RLIMIT_RSS", RLIMIT_RSS); PyModule_AddIntMacro(m, RLIMIT_RSS);
#endif #endif
#ifdef RLIMIT_NPROC #ifdef RLIMIT_NPROC
PyModule_AddIntConstant(m, "RLIMIT_NPROC", RLIMIT_NPROC); PyModule_AddIntMacro(m, RLIMIT_NPROC);
#endif #endif
#ifdef RLIMIT_MEMLOCK #ifdef RLIMIT_MEMLOCK
PyModule_AddIntConstant(m, "RLIMIT_MEMLOCK", RLIMIT_MEMLOCK); PyModule_AddIntMacro(m, RLIMIT_MEMLOCK);
#endif #endif
#ifdef RLIMIT_SBSIZE #ifdef RLIMIT_SBSIZE
PyModule_AddIntConstant(m, "RLIMIT_SBSIZE", RLIMIT_SBSIZE); PyModule_AddIntMacro(m, RLIMIT_SBSIZE);
#endif #endif
#ifdef RUSAGE_SELF #ifdef RUSAGE_SELF
PyModule_AddIntConstant(m, "RUSAGE_SELF", RUSAGE_SELF); PyModule_AddIntMacro(m, RUSAGE_SELF);
#endif #endif
#ifdef RUSAGE_CHILDREN #ifdef RUSAGE_CHILDREN
PyModule_AddIntConstant(m, "RUSAGE_CHILDREN", RUSAGE_CHILDREN); PyModule_AddIntMacro(m, RUSAGE_CHILDREN);
#endif #endif
#ifdef RUSAGE_BOTH #ifdef RUSAGE_BOTH
PyModule_AddIntConstant(m, "RUSAGE_BOTH", RUSAGE_BOTH); PyModule_AddIntMacro(m, RUSAGE_BOTH);
#endif #endif
#ifdef RUSAGE_THREAD #ifdef RUSAGE_THREAD
PyModule_AddIntConstant(m, "RUSAGE_THREAD", RUSAGE_THREAD); PyModule_AddIntMacro(m, RUSAGE_THREAD);
#endif #endif
#if defined(HAVE_LONG_LONG) #if defined(HAVE_LONG_LONG)

View File

@ -2183,7 +2183,7 @@ PyInit_select(void)
#undef PIPE_BUF #undef PIPE_BUF
#define PIPE_BUF 512 #define PIPE_BUF 512
#endif #endif
PyModule_AddIntConstant(m, "PIPE_BUF", PIPE_BUF); PyModule_AddIntMacro(m, PIPE_BUF);
#endif #endif
#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) #if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)
@ -2198,27 +2198,27 @@ PyInit_select(void)
#endif #endif
if (PyType_Ready(&poll_Type) < 0) if (PyType_Ready(&poll_Type) < 0)
return NULL; return NULL;
PyModule_AddIntConstant(m, "POLLIN", POLLIN); PyModule_AddIntMacro(m, POLLIN);
PyModule_AddIntConstant(m, "POLLPRI", POLLPRI); PyModule_AddIntMacro(m, POLLPRI);
PyModule_AddIntConstant(m, "POLLOUT", POLLOUT); PyModule_AddIntMacro(m, POLLOUT);
PyModule_AddIntConstant(m, "POLLERR", POLLERR); PyModule_AddIntMacro(m, POLLERR);
PyModule_AddIntConstant(m, "POLLHUP", POLLHUP); PyModule_AddIntMacro(m, POLLHUP);
PyModule_AddIntConstant(m, "POLLNVAL", POLLNVAL); PyModule_AddIntMacro(m, POLLNVAL);
#ifdef POLLRDNORM #ifdef POLLRDNORM
PyModule_AddIntConstant(m, "POLLRDNORM", POLLRDNORM); PyModule_AddIntMacro(m, POLLRDNORM);
#endif #endif
#ifdef POLLRDBAND #ifdef POLLRDBAND
PyModule_AddIntConstant(m, "POLLRDBAND", POLLRDBAND); PyModule_AddIntMacro(m, POLLRDBAND);
#endif #endif
#ifdef POLLWRNORM #ifdef POLLWRNORM
PyModule_AddIntConstant(m, "POLLWRNORM", POLLWRNORM); PyModule_AddIntMacro(m, POLLWRNORM);
#endif #endif
#ifdef POLLWRBAND #ifdef POLLWRBAND
PyModule_AddIntConstant(m, "POLLWRBAND", POLLWRBAND); PyModule_AddIntMacro(m, POLLWRBAND);
#endif #endif
#ifdef POLLMSG #ifdef POLLMSG
PyModule_AddIntConstant(m, "POLLMSG", POLLMSG); PyModule_AddIntMacro(m, POLLMSG);
#endif #endif
} }
#endif /* HAVE_POLL */ #endif /* HAVE_POLL */
@ -2236,25 +2236,25 @@ PyInit_select(void)
Py_INCREF(&pyEpoll_Type); Py_INCREF(&pyEpoll_Type);
PyModule_AddObject(m, "epoll", (PyObject *) &pyEpoll_Type); PyModule_AddObject(m, "epoll", (PyObject *) &pyEpoll_Type);
PyModule_AddIntConstant(m, "EPOLLIN", EPOLLIN); PyModule_AddIntMacro(m, EPOLLIN);
PyModule_AddIntConstant(m, "EPOLLOUT", EPOLLOUT); PyModule_AddIntMacro(m, EPOLLOUT);
PyModule_AddIntConstant(m, "EPOLLPRI", EPOLLPRI); PyModule_AddIntMacro(m, EPOLLPRI);
PyModule_AddIntConstant(m, "EPOLLERR", EPOLLERR); PyModule_AddIntMacro(m, EPOLLERR);
PyModule_AddIntConstant(m, "EPOLLHUP", EPOLLHUP); PyModule_AddIntMacro(m, EPOLLHUP);
PyModule_AddIntConstant(m, "EPOLLET", EPOLLET); PyModule_AddIntMacro(m, EPOLLET);
#ifdef EPOLLONESHOT #ifdef EPOLLONESHOT
/* Kernel 2.6.2+ */ /* Kernel 2.6.2+ */
PyModule_AddIntConstant(m, "EPOLLONESHOT", EPOLLONESHOT); PyModule_AddIntMacro(m, EPOLLONESHOT);
#endif #endif
/* PyModule_AddIntConstant(m, "EPOLL_RDHUP", EPOLLRDHUP); */ /* PyModule_AddIntConstant(m, "EPOLL_RDHUP", EPOLLRDHUP); */
PyModule_AddIntConstant(m, "EPOLLRDNORM", EPOLLRDNORM); PyModule_AddIntMacro(m, EPOLLRDNORM);
PyModule_AddIntConstant(m, "EPOLLRDBAND", EPOLLRDBAND); PyModule_AddIntMacro(m, EPOLLRDBAND);
PyModule_AddIntConstant(m, "EPOLLWRNORM", EPOLLWRNORM); PyModule_AddIntMacro(m, EPOLLWRNORM);
PyModule_AddIntConstant(m, "EPOLLWRBAND", EPOLLWRBAND); PyModule_AddIntMacro(m, EPOLLWRBAND);
PyModule_AddIntConstant(m, "EPOLLMSG", EPOLLMSG); PyModule_AddIntMacro(m, EPOLLMSG);
#ifdef EPOLL_CLOEXEC #ifdef EPOLL_CLOEXEC
PyModule_AddIntConstant(m, "EPOLL_CLOEXEC", EPOLL_CLOEXEC); PyModule_AddIntMacro(m, EPOLL_CLOEXEC);
#endif #endif
#endif /* HAVE_EPOLL */ #endif /* HAVE_EPOLL */

File diff suppressed because it is too large Load Diff

View File

@ -69,30 +69,30 @@ PyInit__symtable(void)
m = PyModule_Create(&symtablemodule); m = PyModule_Create(&symtablemodule);
if (m == NULL) if (m == NULL)
return NULL; return NULL;
PyModule_AddIntConstant(m, "USE", USE); PyModule_AddIntMacro(m, USE);
PyModule_AddIntConstant(m, "DEF_GLOBAL", DEF_GLOBAL); PyModule_AddIntMacro(m, DEF_GLOBAL);
PyModule_AddIntConstant(m, "DEF_LOCAL", DEF_LOCAL); PyModule_AddIntMacro(m, DEF_LOCAL);
PyModule_AddIntConstant(m, "DEF_PARAM", DEF_PARAM); PyModule_AddIntMacro(m, DEF_PARAM);
PyModule_AddIntConstant(m, "DEF_FREE", DEF_FREE); PyModule_AddIntMacro(m, DEF_FREE);
PyModule_AddIntConstant(m, "DEF_FREE_CLASS", DEF_FREE_CLASS); PyModule_AddIntMacro(m, DEF_FREE_CLASS);
PyModule_AddIntConstant(m, "DEF_IMPORT", DEF_IMPORT); PyModule_AddIntMacro(m, DEF_IMPORT);
PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); PyModule_AddIntMacro(m, DEF_BOUND);
PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock); PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock);
PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock); PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock);
PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock); PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock);
PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR); PyModule_AddIntMacro(m, OPT_IMPORT_STAR);
PyModule_AddIntConstant(m, "OPT_TOPLEVEL", OPT_TOPLEVEL); PyModule_AddIntMacro(m, OPT_TOPLEVEL);
PyModule_AddIntConstant(m, "LOCAL", LOCAL); PyModule_AddIntMacro(m, LOCAL);
PyModule_AddIntConstant(m, "GLOBAL_EXPLICIT", GLOBAL_EXPLICIT); PyModule_AddIntMacro(m, GLOBAL_EXPLICIT);
PyModule_AddIntConstant(m, "GLOBAL_IMPLICIT", GLOBAL_IMPLICIT); PyModule_AddIntMacro(m, GLOBAL_IMPLICIT);
PyModule_AddIntConstant(m, "FREE", FREE); PyModule_AddIntMacro(m, FREE);
PyModule_AddIntConstant(m, "CELL", CELL); PyModule_AddIntMacro(m, CELL);
PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFFSET); PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFFSET);
PyModule_AddIntConstant(m, "SCOPE_MASK", SCOPE_MASK); PyModule_AddIntMacro(m, SCOPE_MASK);
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
Py_DECREF(m); Py_DECREF(m);

View File

@ -278,44 +278,44 @@ PyInit_syslog(void)
/* Add some symbolic constants to the module */ /* Add some symbolic constants to the module */
/* Priorities */ /* Priorities */
PyModule_AddIntConstant(m, "LOG_EMERG", LOG_EMERG); PyModule_AddIntMacro(m, LOG_EMERG);
PyModule_AddIntConstant(m, "LOG_ALERT", LOG_ALERT); PyModule_AddIntMacro(m, LOG_ALERT);
PyModule_AddIntConstant(m, "LOG_CRIT", LOG_CRIT); PyModule_AddIntMacro(m, LOG_CRIT);
PyModule_AddIntConstant(m, "LOG_ERR", LOG_ERR); PyModule_AddIntMacro(m, LOG_ERR);
PyModule_AddIntConstant(m, "LOG_WARNING", LOG_WARNING); PyModule_AddIntMacro(m, LOG_WARNING);
PyModule_AddIntConstant(m, "LOG_NOTICE", LOG_NOTICE); PyModule_AddIntMacro(m, LOG_NOTICE);
PyModule_AddIntConstant(m, "LOG_INFO", LOG_INFO); PyModule_AddIntMacro(m, LOG_INFO);
PyModule_AddIntConstant(m, "LOG_DEBUG", LOG_DEBUG); PyModule_AddIntMacro(m, LOG_DEBUG);
/* openlog() option flags */ /* openlog() option flags */
PyModule_AddIntConstant(m, "LOG_PID", LOG_PID); PyModule_AddIntMacro(m, LOG_PID);
PyModule_AddIntConstant(m, "LOG_CONS", LOG_CONS); PyModule_AddIntMacro(m, LOG_CONS);
PyModule_AddIntConstant(m, "LOG_NDELAY", LOG_NDELAY); PyModule_AddIntMacro(m, LOG_NDELAY);
#ifdef LOG_ODELAY #ifdef LOG_ODELAY
PyModule_AddIntConstant(m, "LOG_ODELAY", LOG_ODELAY); PyModule_AddIntMacro(m, LOG_ODELAY);
#endif #endif
#ifdef LOG_NOWAIT #ifdef LOG_NOWAIT
PyModule_AddIntConstant(m, "LOG_NOWAIT", LOG_NOWAIT); PyModule_AddIntMacro(m, LOG_NOWAIT);
#endif #endif
#ifdef LOG_PERROR #ifdef LOG_PERROR
PyModule_AddIntConstant(m, "LOG_PERROR", LOG_PERROR); PyModule_AddIntMacro(m, LOG_PERROR);
#endif #endif
/* Facilities */ /* Facilities */
PyModule_AddIntConstant(m, "LOG_KERN", LOG_KERN); PyModule_AddIntMacro(m, LOG_KERN);
PyModule_AddIntConstant(m, "LOG_USER", LOG_USER); PyModule_AddIntMacro(m, LOG_USER);
PyModule_AddIntConstant(m, "LOG_MAIL", LOG_MAIL); PyModule_AddIntMacro(m, LOG_MAIL);
PyModule_AddIntConstant(m, "LOG_DAEMON", LOG_DAEMON); PyModule_AddIntMacro(m, LOG_DAEMON);
PyModule_AddIntConstant(m, "LOG_AUTH", LOG_AUTH); PyModule_AddIntMacro(m, LOG_AUTH);
PyModule_AddIntConstant(m, "LOG_LPR", LOG_LPR); PyModule_AddIntMacro(m, LOG_LPR);
PyModule_AddIntConstant(m, "LOG_LOCAL0", LOG_LOCAL0); PyModule_AddIntMacro(m, LOG_LOCAL0);
PyModule_AddIntConstant(m, "LOG_LOCAL1", LOG_LOCAL1); PyModule_AddIntMacro(m, LOG_LOCAL1);
PyModule_AddIntConstant(m, "LOG_LOCAL2", LOG_LOCAL2); PyModule_AddIntMacro(m, LOG_LOCAL2);
PyModule_AddIntConstant(m, "LOG_LOCAL3", LOG_LOCAL3); PyModule_AddIntMacro(m, LOG_LOCAL3);
PyModule_AddIntConstant(m, "LOG_LOCAL4", LOG_LOCAL4); PyModule_AddIntMacro(m, LOG_LOCAL4);
PyModule_AddIntConstant(m, "LOG_LOCAL5", LOG_LOCAL5); PyModule_AddIntMacro(m, LOG_LOCAL5);
PyModule_AddIntConstant(m, "LOG_LOCAL6", LOG_LOCAL6); PyModule_AddIntMacro(m, LOG_LOCAL6);
PyModule_AddIntConstant(m, "LOG_LOCAL7", LOG_LOCAL7); PyModule_AddIntMacro(m, LOG_LOCAL7);
#ifndef LOG_SYSLOG #ifndef LOG_SYSLOG
#define LOG_SYSLOG LOG_DAEMON #define LOG_SYSLOG LOG_DAEMON
@ -330,13 +330,13 @@ PyInit_syslog(void)
#define LOG_CRON LOG_DAEMON #define LOG_CRON LOG_DAEMON
#endif #endif
PyModule_AddIntConstant(m, "LOG_SYSLOG", LOG_SYSLOG); PyModule_AddIntMacro(m, LOG_SYSLOG);
PyModule_AddIntConstant(m, "LOG_CRON", LOG_CRON); PyModule_AddIntMacro(m, LOG_CRON);
PyModule_AddIntConstant(m, "LOG_UUCP", LOG_UUCP); PyModule_AddIntMacro(m, LOG_UUCP);
PyModule_AddIntConstant(m, "LOG_NEWS", LOG_NEWS); PyModule_AddIntMacro(m, LOG_NEWS);
#ifdef LOG_AUTHPRIV #ifdef LOG_AUTHPRIV
PyModule_AddIntConstant(m, "LOG_AUTHPRIV", LOG_AUTHPRIV); PyModule_AddIntMacro(m, LOG_AUTHPRIV);
#endif #endif
return m; return m;

View File

@ -1266,20 +1266,20 @@ PyInit_zlib(void)
Py_INCREF(ZlibError); Py_INCREF(ZlibError);
PyModule_AddObject(m, "error", ZlibError); PyModule_AddObject(m, "error", ZlibError);
} }
PyModule_AddIntConstant(m, "MAX_WBITS", MAX_WBITS); PyModule_AddIntMacro(m, MAX_WBITS);
PyModule_AddIntConstant(m, "DEFLATED", DEFLATED); PyModule_AddIntMacro(m, DEFLATED);
PyModule_AddIntConstant(m, "DEF_MEM_LEVEL", DEF_MEM_LEVEL); PyModule_AddIntMacro(m, DEF_MEM_LEVEL);
PyModule_AddIntConstant(m, "Z_BEST_SPEED", Z_BEST_SPEED); PyModule_AddIntMacro(m, Z_BEST_SPEED);
PyModule_AddIntConstant(m, "Z_BEST_COMPRESSION", Z_BEST_COMPRESSION); PyModule_AddIntMacro(m, Z_BEST_COMPRESSION);
PyModule_AddIntConstant(m, "Z_DEFAULT_COMPRESSION", Z_DEFAULT_COMPRESSION); PyModule_AddIntMacro(m, Z_DEFAULT_COMPRESSION);
PyModule_AddIntConstant(m, "Z_FILTERED", Z_FILTERED); PyModule_AddIntMacro(m, Z_FILTERED);
PyModule_AddIntConstant(m, "Z_HUFFMAN_ONLY", Z_HUFFMAN_ONLY); PyModule_AddIntMacro(m, Z_HUFFMAN_ONLY);
PyModule_AddIntConstant(m, "Z_DEFAULT_STRATEGY", Z_DEFAULT_STRATEGY); PyModule_AddIntMacro(m, Z_DEFAULT_STRATEGY);
PyModule_AddIntConstant(m, "Z_FINISH", Z_FINISH); PyModule_AddIntMacro(m, Z_FINISH);
PyModule_AddIntConstant(m, "Z_NO_FLUSH", Z_NO_FLUSH); PyModule_AddIntMacro(m, Z_NO_FLUSH);
PyModule_AddIntConstant(m, "Z_SYNC_FLUSH", Z_SYNC_FLUSH); PyModule_AddIntMacro(m, Z_SYNC_FLUSH);
PyModule_AddIntConstant(m, "Z_FULL_FLUSH", Z_FULL_FLUSH); PyModule_AddIntMacro(m, Z_FULL_FLUSH);
ver = PyUnicode_FromString(ZLIB_VERSION); ver = PyUnicode_FromString(ZLIB_VERSION);
if (ver != NULL) if (ver != NULL)

View File

@ -1030,40 +1030,40 @@ PyInit__msi(void)
PyModule_AddIntConstant(m, "MSIDBOPEN_TRANSACT", (int)MSIDBOPEN_TRANSACT); PyModule_AddIntConstant(m, "MSIDBOPEN_TRANSACT", (int)MSIDBOPEN_TRANSACT);
PyModule_AddIntConstant(m, "MSIDBOPEN_PATCHFILE", (int)MSIDBOPEN_PATCHFILE); PyModule_AddIntConstant(m, "MSIDBOPEN_PATCHFILE", (int)MSIDBOPEN_PATCHFILE);
PyModule_AddIntConstant(m, "MSICOLINFO_NAMES", MSICOLINFO_NAMES); PyModule_AddIntMacro(m, MSICOLINFO_NAMES);
PyModule_AddIntConstant(m, "MSICOLINFO_TYPES", MSICOLINFO_TYPES); PyModule_AddIntMacro(m, MSICOLINFO_TYPES);
PyModule_AddIntConstant(m, "MSIMODIFY_SEEK", MSIMODIFY_SEEK); PyModule_AddIntMacro(m, MSIMODIFY_SEEK);
PyModule_AddIntConstant(m, "MSIMODIFY_REFRESH", MSIMODIFY_REFRESH); PyModule_AddIntMacro(m, MSIMODIFY_REFRESH);
PyModule_AddIntConstant(m, "MSIMODIFY_INSERT", MSIMODIFY_INSERT); PyModule_AddIntMacro(m, MSIMODIFY_INSERT);
PyModule_AddIntConstant(m, "MSIMODIFY_UPDATE", MSIMODIFY_UPDATE); PyModule_AddIntMacro(m, MSIMODIFY_UPDATE);
PyModule_AddIntConstant(m, "MSIMODIFY_ASSIGN", MSIMODIFY_ASSIGN); PyModule_AddIntMacro(m, MSIMODIFY_ASSIGN);
PyModule_AddIntConstant(m, "MSIMODIFY_REPLACE", MSIMODIFY_REPLACE); PyModule_AddIntMacro(m, MSIMODIFY_REPLACE);
PyModule_AddIntConstant(m, "MSIMODIFY_MERGE", MSIMODIFY_MERGE); PyModule_AddIntMacro(m, MSIMODIFY_MERGE);
PyModule_AddIntConstant(m, "MSIMODIFY_DELETE", MSIMODIFY_DELETE); PyModule_AddIntMacro(m, MSIMODIFY_DELETE);
PyModule_AddIntConstant(m, "MSIMODIFY_INSERT_TEMPORARY", MSIMODIFY_INSERT_TEMPORARY); PyModule_AddIntMacro(m, MSIMODIFY_INSERT_TEMPORARY);
PyModule_AddIntConstant(m, "MSIMODIFY_VALIDATE", MSIMODIFY_VALIDATE); PyModule_AddIntMacro(m, MSIMODIFY_VALIDATE);
PyModule_AddIntConstant(m, "MSIMODIFY_VALIDATE_NEW", MSIMODIFY_VALIDATE_NEW); PyModule_AddIntMacro(m, MSIMODIFY_VALIDATE_NEW);
PyModule_AddIntConstant(m, "MSIMODIFY_VALIDATE_FIELD", MSIMODIFY_VALIDATE_FIELD); PyModule_AddIntMacro(m, MSIMODIFY_VALIDATE_FIELD);
PyModule_AddIntConstant(m, "MSIMODIFY_VALIDATE_DELETE", MSIMODIFY_VALIDATE_DELETE); PyModule_AddIntMacro(m, MSIMODIFY_VALIDATE_DELETE);
PyModule_AddIntConstant(m, "PID_CODEPAGE", PID_CODEPAGE); PyModule_AddIntMacro(m, PID_CODEPAGE);
PyModule_AddIntConstant(m, "PID_TITLE", PID_TITLE); PyModule_AddIntMacro(m, PID_TITLE);
PyModule_AddIntConstant(m, "PID_SUBJECT", PID_SUBJECT); PyModule_AddIntMacro(m, PID_SUBJECT);
PyModule_AddIntConstant(m, "PID_AUTHOR", PID_AUTHOR); PyModule_AddIntMacro(m, PID_AUTHOR);
PyModule_AddIntConstant(m, "PID_KEYWORDS", PID_KEYWORDS); PyModule_AddIntMacro(m, PID_KEYWORDS);
PyModule_AddIntConstant(m, "PID_COMMENTS", PID_COMMENTS); PyModule_AddIntMacro(m, PID_COMMENTS);
PyModule_AddIntConstant(m, "PID_TEMPLATE", PID_TEMPLATE); PyModule_AddIntMacro(m, PID_TEMPLATE);
PyModule_AddIntConstant(m, "PID_LASTAUTHOR", PID_LASTAUTHOR); PyModule_AddIntMacro(m, PID_LASTAUTHOR);
PyModule_AddIntConstant(m, "PID_REVNUMBER", PID_REVNUMBER); PyModule_AddIntMacro(m, PID_REVNUMBER);
PyModule_AddIntConstant(m, "PID_LASTPRINTED", PID_LASTPRINTED); PyModule_AddIntMacro(m, PID_LASTPRINTED);
PyModule_AddIntConstant(m, "PID_CREATE_DTM", PID_CREATE_DTM); PyModule_AddIntMacro(m, PID_CREATE_DTM);
PyModule_AddIntConstant(m, "PID_LASTSAVE_DTM", PID_LASTSAVE_DTM); PyModule_AddIntMacro(m, PID_LASTSAVE_DTM);
PyModule_AddIntConstant(m, "PID_PAGECOUNT", PID_PAGECOUNT); PyModule_AddIntMacro(m, PID_PAGECOUNT);
PyModule_AddIntConstant(m, "PID_WORDCOUNT", PID_WORDCOUNT); PyModule_AddIntMacro(m, PID_WORDCOUNT);
PyModule_AddIntConstant(m, "PID_CHARCOUNT", PID_CHARCOUNT); PyModule_AddIntMacro(m, PID_CHARCOUNT);
PyModule_AddIntConstant(m, "PID_APPNAME", PID_APPNAME); PyModule_AddIntMacro(m, PID_APPNAME);
PyModule_AddIntConstant(m, "PID_SECURITY", PID_SECURITY); PyModule_AddIntMacro(m, PID_SECURITY);
MSIError = PyErr_NewException ("_msi.MSIError", NULL, NULL); MSIError = PyErr_NewException ("_msi.MSIError", NULL, NULL);
if (!MSIError) if (!MSIError)

View File

@ -6977,7 +6977,7 @@ PyInit__ast(void)
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return
NULL; NULL;
if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0)
return NULL; return NULL;
if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return
NULL; NULL;