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;
/* module initialization */
PyModule_AddIntConstant(m, "MINYEAR", MINYEAR);
PyModule_AddIntConstant(m, "MAXYEAR", MAXYEAR);
PyModule_AddIntMacro(m, MINYEAR);
PyModule_AddIntMacro(m, MAXYEAR);
Py_INCREF(&PyDateTime_DateType);
PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType);

View File

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

View File

@ -424,191 +424,179 @@ a file or socket object.");
/* 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
all_ins(PyObject* d)
all_ins(PyObject* m)
{
if (ins(d, "LOCK_SH", (long)LOCK_SH)) return -1;
if (ins(d, "LOCK_EX", (long)LOCK_EX)) return -1;
if (ins(d, "LOCK_NB", (long)LOCK_NB)) return -1;
if (ins(d, "LOCK_UN", (long)LOCK_UN)) return -1;
if (PyModule_AddIntMacro(m, LOCK_SH)) return -1;
if (PyModule_AddIntMacro(m, LOCK_EX)) return -1;
if (PyModule_AddIntMacro(m, LOCK_NB)) return -1;
if (PyModule_AddIntMacro(m, LOCK_UN)) return -1;
/* GNU extensions, as of glibc 2.2.4 */
#ifdef LOCK_MAND
if (ins(d, "LOCK_MAND", (long)LOCK_MAND)) return -1;
if (PyModule_AddIntMacro(m, LOCK_MAND)) return -1;
#endif
#ifdef LOCK_READ
if (ins(d, "LOCK_READ", (long)LOCK_READ)) return -1;
if (PyModule_AddIntMacro(m, LOCK_READ)) return -1;
#endif
#ifdef LOCK_WRITE
if (ins(d, "LOCK_WRITE", (long)LOCK_WRITE)) return -1;
if (PyModule_AddIntMacro(m, LOCK_WRITE)) return -1;
#endif
#ifdef LOCK_RW
if (ins(d, "LOCK_RW", (long)LOCK_RW)) return -1;
if (PyModule_AddIntMacro(m, LOCK_RW)) return -1;
#endif
#ifdef F_DUPFD
if (ins(d, "F_DUPFD", (long)F_DUPFD)) return -1;
if (PyModule_AddIntMacro(m, F_DUPFD)) return -1;
#endif
#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
#ifdef F_GETFD
if (ins(d, "F_GETFD", (long)F_GETFD)) return -1;
if (PyModule_AddIntMacro(m, F_GETFD)) return -1;
#endif
#ifdef F_SETFD
if (ins(d, "F_SETFD", (long)F_SETFD)) return -1;
if (PyModule_AddIntMacro(m, F_SETFD)) return -1;
#endif
#ifdef F_GETFL
if (ins(d, "F_GETFL", (long)F_GETFL)) return -1;
if (PyModule_AddIntMacro(m, F_GETFL)) return -1;
#endif
#ifdef F_SETFL
if (ins(d, "F_SETFL", (long)F_SETFL)) return -1;
if (PyModule_AddIntMacro(m, F_SETFL)) return -1;
#endif
#ifdef F_GETLK
if (ins(d, "F_GETLK", (long)F_GETLK)) return -1;
if (PyModule_AddIntMacro(m, F_GETLK)) return -1;
#endif
#ifdef F_SETLK
if (ins(d, "F_SETLK", (long)F_SETLK)) return -1;
if (PyModule_AddIntMacro(m, F_SETLK)) return -1;
#endif
#ifdef F_SETLKW
if (ins(d, "F_SETLKW", (long)F_SETLKW)) return -1;
if (PyModule_AddIntMacro(m, F_SETLKW)) return -1;
#endif
#ifdef F_GETOWN
if (ins(d, "F_GETOWN", (long)F_GETOWN)) return -1;
if (PyModule_AddIntMacro(m, F_GETOWN)) return -1;
#endif
#ifdef F_SETOWN
if (ins(d, "F_SETOWN", (long)F_SETOWN)) return -1;
if (PyModule_AddIntMacro(m, F_SETOWN)) return -1;
#endif
#ifdef F_GETSIG
if (ins(d, "F_GETSIG", (long)F_GETSIG)) return -1;
if (PyModule_AddIntMacro(m, F_GETSIG)) return -1;
#endif
#ifdef F_SETSIG
if (ins(d, "F_SETSIG", (long)F_SETSIG)) return -1;
if (PyModule_AddIntMacro(m, F_SETSIG)) return -1;
#endif
#ifdef F_RDLCK
if (ins(d, "F_RDLCK", (long)F_RDLCK)) return -1;
if (PyModule_AddIntMacro(m, F_RDLCK)) return -1;
#endif
#ifdef F_WRLCK
if (ins(d, "F_WRLCK", (long)F_WRLCK)) return -1;
if (PyModule_AddIntMacro(m, F_WRLCK)) return -1;
#endif
#ifdef F_UNLCK
if (ins(d, "F_UNLCK", (long)F_UNLCK)) return -1;
if (PyModule_AddIntMacro(m, F_UNLCK)) return -1;
#endif
/* LFS constants */
#ifdef F_GETLK64
if (ins(d, "F_GETLK64", (long)F_GETLK64)) return -1;
if (PyModule_AddIntMacro(m, F_GETLK64)) return -1;
#endif
#ifdef F_SETLK64
if (ins(d, "F_SETLK64", (long)F_SETLK64)) return -1;
if (PyModule_AddIntMacro(m, F_SETLK64)) return -1;
#endif
#ifdef F_SETLKW64
if (ins(d, "F_SETLKW64", (long)F_SETLKW64)) return -1;
if (PyModule_AddIntMacro(m, F_SETLKW64)) return -1;
#endif
/* GNU extensions, as of glibc 2.2.4. */
#ifdef FASYNC
if (ins(d, "FASYNC", (long)FASYNC)) return -1;
if (PyModule_AddIntMacro(m, FASYNC)) return -1;
#endif
#ifdef F_SETLEASE
if (ins(d, "F_SETLEASE", (long)F_SETLEASE)) return -1;
if (PyModule_AddIntMacro(m, F_SETLEASE)) return -1;
#endif
#ifdef F_GETLEASE
if (ins(d, "F_GETLEASE", (long)F_GETLEASE)) return -1;
if (PyModule_AddIntMacro(m, F_GETLEASE)) return -1;
#endif
#ifdef F_NOTIFY
if (ins(d, "F_NOTIFY", (long)F_NOTIFY)) return -1;
if (PyModule_AddIntMacro(m, F_NOTIFY)) return -1;
#endif
/* Old BSD flock(). */
#ifdef F_EXLCK
if (ins(d, "F_EXLCK", (long)F_EXLCK)) return -1;
if (PyModule_AddIntMacro(m, F_EXLCK)) return -1;
#endif
#ifdef F_SHLCK
if (ins(d, "F_SHLCK", (long)F_SHLCK)) return -1;
if (PyModule_AddIntMacro(m, F_SHLCK)) return -1;
#endif
/* OS X specifics */
#ifdef F_FULLFSYNC
if (ins(d, "F_FULLFSYNC", (long)F_FULLFSYNC)) return -1;
if (PyModule_AddIntMacro(m, F_FULLFSYNC)) return -1;
#endif
#ifdef F_NOCACHE
if (ins(d, "F_NOCACHE", (long)F_NOCACHE)) return -1;
if (PyModule_AddIntMacro(m, F_NOCACHE)) return -1;
#endif
/* For F_{GET|SET}FL */
#ifdef FD_CLOEXEC
if (ins(d, "FD_CLOEXEC", (long)FD_CLOEXEC)) return -1;
if (PyModule_AddIntMacro(m, FD_CLOEXEC)) return -1;
#endif
/* For F_NOTIFY */
#ifdef DN_ACCESS
if (ins(d, "DN_ACCESS", (long)DN_ACCESS)) return -1;
if (PyModule_AddIntMacro(m, DN_ACCESS)) return -1;
#endif
#ifdef DN_MODIFY
if (ins(d, "DN_MODIFY", (long)DN_MODIFY)) return -1;
if (PyModule_AddIntMacro(m, DN_MODIFY)) return -1;
#endif
#ifdef DN_CREATE
if (ins(d, "DN_CREATE", (long)DN_CREATE)) return -1;
if (PyModule_AddIntMacro(m, DN_CREATE)) return -1;
#endif
#ifdef DN_DELETE
if (ins(d, "DN_DELETE", (long)DN_DELETE)) return -1;
if (PyModule_AddIntMacro(m, DN_DELETE)) return -1;
#endif
#ifdef DN_RENAME
if (ins(d, "DN_RENAME", (long)DN_RENAME)) return -1;
if (PyModule_AddIntMacro(m, DN_RENAME)) return -1;
#endif
#ifdef DN_ATTRIB
if (ins(d, "DN_ATTRIB", (long)DN_ATTRIB)) return -1;
if (PyModule_AddIntMacro(m, DN_ATTRIB)) return -1;
#endif
#ifdef DN_MULTISHOT
if (ins(d, "DN_MULTISHOT", (long)DN_MULTISHOT)) return -1;
if (PyModule_AddIntMacro(m, DN_MULTISHOT)) return -1;
#endif
#ifdef HAVE_STROPTS_H
/* Unix 98 guarantees that these are in stropts.h. */
INS(I_PUSH);
INS(I_POP);
INS(I_LOOK);
INS(I_FLUSH);
INS(I_FLUSHBAND);
INS(I_SETSIG);
INS(I_GETSIG);
INS(I_FIND);
INS(I_PEEK);
INS(I_SRDOPT);
INS(I_GRDOPT);
INS(I_NREAD);
INS(I_FDINSERT);
INS(I_STR);
INS(I_SWROPT);
if (PyModule_AddIntMacro(m, I_PUSH)) return -1;
if (PyModule_AddIntMacro(m, I_POP)) return -1;
if (PyModule_AddIntMacro(m, I_LOOK)) return -1;
if (PyModule_AddIntMacro(m, I_FLUSH)) return -1;
if (PyModule_AddIntMacro(m, I_FLUSHBAND)) return -1;
if (PyModule_AddIntMacro(m, I_SETSIG)) return -1;
if (PyModule_AddIntMacro(m, I_GETSIG)) return -1;
if (PyModule_AddIntMacro(m, I_FIND)) return -1;
if (PyModule_AddIntMacro(m, I_PEEK)) return -1;
if (PyModule_AddIntMacro(m, I_SRDOPT)) return -1;
if (PyModule_AddIntMacro(m, I_GRDOPT)) return -1;
if (PyModule_AddIntMacro(m, I_NREAD)) return -1;
if (PyModule_AddIntMacro(m, I_FDINSERT)) return -1;
if (PyModule_AddIntMacro(m, I_STR)) return -1;
if (PyModule_AddIntMacro(m, I_SWROPT)) return -1;
#ifdef I_GWROPT
/* despite the comment above, old-ish glibcs miss a couple... */
INS(I_GWROPT);
if (PyModule_AddIntMacro(m, I_GWROPT)) return -1;
#endif
INS(I_SENDFD);
INS(I_RECVFD);
INS(I_LIST);
INS(I_ATMARK);
INS(I_CKBAND);
INS(I_GETBAND);
INS(I_CANPUT);
INS(I_SETCLTIME);
if (PyModule_AddIntMacro(m, I_SENDFD)) return -1;
if (PyModule_AddIntMacro(m, I_RECVFD)) return -1;
if (PyModule_AddIntMacro(m, I_LIST)) return -1;
if (PyModule_AddIntMacro(m, I_ATMARK)) return -1;
if (PyModule_AddIntMacro(m, I_CKBAND)) return -1;
if (PyModule_AddIntMacro(m, I_GETBAND)) return -1;
if (PyModule_AddIntMacro(m, I_CANPUT)) return -1;
if (PyModule_AddIntMacro(m, I_SETCLTIME)) return -1;
#ifdef I_GETCLTIME
INS(I_GETCLTIME);
if (PyModule_AddIntMacro(m, I_GETCLTIME)) return -1;
#endif
INS(I_LINK);
INS(I_UNLINK);
INS(I_PLINK);
INS(I_PUNLINK);
if (PyModule_AddIntMacro(m, I_LINK)) return -1;
if (PyModule_AddIntMacro(m, I_UNLINK)) return -1;
if (PyModule_AddIntMacro(m, I_PLINK)) return -1;
if (PyModule_AddIntMacro(m, I_PUNLINK)) return -1;
#endif
return 0;
@ -630,7 +618,7 @@ static struct PyModuleDef fcntlmodule = {
PyMODINIT_FUNC
PyInit_fcntl(void)
{
PyObject *m, *d;
PyObject *m;
/* Create the module and add the functions and documentation */
m = PyModule_Create(&fcntlmodule);
@ -638,7 +626,6 @@ PyInit_fcntl(void)
return NULL;
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
all_ins(d);
all_ins(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)
static int
enable_symlink()
@ -10836,376 +10830,376 @@ enable_symlink()
#endif /* defined(HAVE_SYMLINK) && defined(MS_WINDOWS) */
static int
all_ins(PyObject *d)
all_ins(PyObject *m)
{
#ifdef F_OK
if (ins(d, "F_OK", (long)F_OK)) return -1;
if (PyModule_AddIntMacro(m, F_OK)) return -1;
#endif
#ifdef R_OK
if (ins(d, "R_OK", (long)R_OK)) return -1;
if (PyModule_AddIntMacro(m, R_OK)) return -1;
#endif
#ifdef W_OK
if (ins(d, "W_OK", (long)W_OK)) return -1;
if (PyModule_AddIntMacro(m, W_OK)) return -1;
#endif
#ifdef X_OK
if (ins(d, "X_OK", (long)X_OK)) return -1;
if (PyModule_AddIntMacro(m, X_OK)) return -1;
#endif
#ifdef NGROUPS_MAX
if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1;
if (PyModule_AddIntMacro(m, NGROUPS_MAX)) return -1;
#endif
#ifdef TMP_MAX
if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1;
if (PyModule_AddIntMacro(m, TMP_MAX)) return -1;
#endif
#ifdef WCONTINUED
if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1;
if (PyModule_AddIntMacro(m, WCONTINUED)) return -1;
#endif
#ifdef WNOHANG
if (ins(d, "WNOHANG", (long)WNOHANG)) return -1;
if (PyModule_AddIntMacro(m, WNOHANG)) return -1;
#endif
#ifdef WUNTRACED
if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1;
if (PyModule_AddIntMacro(m, WUNTRACED)) return -1;
#endif
#ifdef O_RDONLY
if (ins(d, "O_RDONLY", (long)O_RDONLY)) return -1;
if (PyModule_AddIntMacro(m, O_RDONLY)) return -1;
#endif
#ifdef O_WRONLY
if (ins(d, "O_WRONLY", (long)O_WRONLY)) return -1;
if (PyModule_AddIntMacro(m, O_WRONLY)) return -1;
#endif
#ifdef O_RDWR
if (ins(d, "O_RDWR", (long)O_RDWR)) return -1;
if (PyModule_AddIntMacro(m, O_RDWR)) return -1;
#endif
#ifdef O_NDELAY
if (ins(d, "O_NDELAY", (long)O_NDELAY)) return -1;
if (PyModule_AddIntMacro(m, O_NDELAY)) return -1;
#endif
#ifdef O_NONBLOCK
if (ins(d, "O_NONBLOCK", (long)O_NONBLOCK)) return -1;
if (PyModule_AddIntMacro(m, O_NONBLOCK)) return -1;
#endif
#ifdef O_APPEND
if (ins(d, "O_APPEND", (long)O_APPEND)) return -1;
if (PyModule_AddIntMacro(m, O_APPEND)) return -1;
#endif
#ifdef O_DSYNC
if (ins(d, "O_DSYNC", (long)O_DSYNC)) return -1;
if (PyModule_AddIntMacro(m, O_DSYNC)) return -1;
#endif
#ifdef O_RSYNC
if (ins(d, "O_RSYNC", (long)O_RSYNC)) return -1;
if (PyModule_AddIntMacro(m, O_RSYNC)) return -1;
#endif
#ifdef O_SYNC
if (ins(d, "O_SYNC", (long)O_SYNC)) return -1;
if (PyModule_AddIntMacro(m, O_SYNC)) return -1;
#endif
#ifdef O_NOCTTY
if (ins(d, "O_NOCTTY", (long)O_NOCTTY)) return -1;
if (PyModule_AddIntMacro(m, O_NOCTTY)) return -1;
#endif
#ifdef O_CREAT
if (ins(d, "O_CREAT", (long)O_CREAT)) return -1;
if (PyModule_AddIntMacro(m, O_CREAT)) return -1;
#endif
#ifdef O_EXCL
if (ins(d, "O_EXCL", (long)O_EXCL)) return -1;
if (PyModule_AddIntMacro(m, O_EXCL)) return -1;
#endif
#ifdef O_TRUNC
if (ins(d, "O_TRUNC", (long)O_TRUNC)) return -1;
if (PyModule_AddIntMacro(m, O_TRUNC)) return -1;
#endif
#ifdef O_BINARY
if (ins(d, "O_BINARY", (long)O_BINARY)) return -1;
if (PyModule_AddIntMacro(m, O_BINARY)) return -1;
#endif
#ifdef O_TEXT
if (ins(d, "O_TEXT", (long)O_TEXT)) return -1;
if (PyModule_AddIntMacro(m, O_TEXT)) return -1;
#endif
#ifdef O_XATTR
if (ins(d, "O_XATTR", (long)O_XATTR)) return -1;
if (PyModule_AddIntMacro(m, O_XATTR)) return -1;
#endif
#ifdef O_LARGEFILE
if (ins(d, "O_LARGEFILE", (long)O_LARGEFILE)) return -1;
if (PyModule_AddIntMacro(m, O_LARGEFILE)) return -1;
#endif
#ifdef O_SHLOCK
if (ins(d, "O_SHLOCK", (long)O_SHLOCK)) return -1;
if (PyModule_AddIntMacro(m, O_SHLOCK)) return -1;
#endif
#ifdef O_EXLOCK
if (ins(d, "O_EXLOCK", (long)O_EXLOCK)) return -1;
if (PyModule_AddIntMacro(m, O_EXLOCK)) return -1;
#endif
#ifdef O_EXEC
if (ins(d, "O_EXEC", (long)O_EXEC)) return -1;
if (PyModule_AddIntMacro(m, O_EXEC)) return -1;
#endif
#ifdef O_SEARCH
if (ins(d, "O_SEARCH", (long)O_SEARCH)) return -1;
if (PyModule_AddIntMacro(m, O_SEARCH)) return -1;
#endif
#ifdef O_PATH
if (ins(d, "O_PATH", (long)O_PATH)) return -1;
if (PyModule_AddIntMacro(m, O_PATH)) return -1;
#endif
#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
#ifdef PRIO_PROCESS
if (ins(d, "PRIO_PROCESS", (long)PRIO_PROCESS)) return -1;
if (PyModule_AddIntMacro(m, PRIO_PROCESS)) return -1;
#endif
#ifdef PRIO_PGRP
if (ins(d, "PRIO_PGRP", (long)PRIO_PGRP)) return -1;
if (PyModule_AddIntMacro(m, PRIO_PGRP)) return -1;
#endif
#ifdef PRIO_USER
if (ins(d, "PRIO_USER", (long)PRIO_USER)) return -1;
if (PyModule_AddIntMacro(m, PRIO_USER)) return -1;
#endif
#ifdef O_CLOEXEC
if (ins(d, "O_CLOEXEC", (long)O_CLOEXEC)) return -1;
if (PyModule_AddIntMacro(m, O_CLOEXEC)) return -1;
#endif
#ifdef O_ACCMODE
if (ins(d, "O_ACCMODE", (long)O_ACCMODE)) return -1;
if (PyModule_AddIntMacro(m, O_ACCMODE)) return -1;
#endif
#ifdef SEEK_HOLE
if (ins(d, "SEEK_HOLE", (long)SEEK_HOLE)) return -1;
if (PyModule_AddIntMacro(m, SEEK_HOLE)) return -1;
#endif
#ifdef SEEK_DATA
if (ins(d, "SEEK_DATA", (long)SEEK_DATA)) return -1;
if (PyModule_AddIntMacro(m, SEEK_DATA)) return -1;
#endif
/* MS Windows */
#ifdef O_NOINHERIT
/* 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
#ifdef _O_SHORT_LIVED
/* Optimize for short life (keep in memory). */
/* 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
#ifdef O_TEMPORARY
/* 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
#ifdef O_RANDOM
/* Optimize for random access. */
if (ins(d, "O_RANDOM", (long)O_RANDOM)) return -1;
if (PyModule_AddIntMacro(m, O_RANDOM)) return -1;
#endif
#ifdef O_SEQUENTIAL
/* Optimize for sequential access. */
if (ins(d, "O_SEQUENTIAL", (long)O_SEQUENTIAL)) return -1;
if (PyModule_AddIntMacro(m, O_SEQUENTIAL)) return -1;
#endif
/* GNU extensions. */
#ifdef O_ASYNC
/* Send a SIGIO signal whenever input or output
becomes available on file descriptor */
if (ins(d, "O_ASYNC", (long)O_ASYNC)) return -1;
if (PyModule_AddIntMacro(m, O_ASYNC)) return -1;
#endif
#ifdef O_DIRECT
/* Direct disk access. */
if (ins(d, "O_DIRECT", (long)O_DIRECT)) return -1;
if (PyModule_AddIntMacro(m, O_DIRECT)) return -1;
#endif
#ifdef O_DIRECTORY
/* Must be a directory. */
if (ins(d, "O_DIRECTORY", (long)O_DIRECTORY)) return -1;
if (PyModule_AddIntMacro(m, O_DIRECTORY)) return -1;
#endif
#ifdef O_NOFOLLOW
/* Do not follow links. */
if (ins(d, "O_NOFOLLOW", (long)O_NOFOLLOW)) return -1;
if (PyModule_AddIntMacro(m, O_NOFOLLOW)) return -1;
#endif
#ifdef O_NOLINKS
/* 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
#ifdef O_NOATIME
/* 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
/* These come from sysexits.h */
#ifdef EX_OK
if (ins(d, "EX_OK", (long)EX_OK)) return -1;
if (PyModule_AddIntMacro(m, EX_OK)) return -1;
#endif /* EX_OK */
#ifdef EX_USAGE
if (ins(d, "EX_USAGE", (long)EX_USAGE)) return -1;
if (PyModule_AddIntMacro(m, EX_USAGE)) return -1;
#endif /* EX_USAGE */
#ifdef EX_DATAERR
if (ins(d, "EX_DATAERR", (long)EX_DATAERR)) return -1;
if (PyModule_AddIntMacro(m, EX_DATAERR)) return -1;
#endif /* EX_DATAERR */
#ifdef EX_NOINPUT
if (ins(d, "EX_NOINPUT", (long)EX_NOINPUT)) return -1;
if (PyModule_AddIntMacro(m, EX_NOINPUT)) return -1;
#endif /* EX_NOINPUT */
#ifdef EX_NOUSER
if (ins(d, "EX_NOUSER", (long)EX_NOUSER)) return -1;
if (PyModule_AddIntMacro(m, EX_NOUSER)) return -1;
#endif /* EX_NOUSER */
#ifdef EX_NOHOST
if (ins(d, "EX_NOHOST", (long)EX_NOHOST)) return -1;
if (PyModule_AddIntMacro(m, EX_NOHOST)) return -1;
#endif /* EX_NOHOST */
#ifdef EX_UNAVAILABLE
if (ins(d, "EX_UNAVAILABLE", (long)EX_UNAVAILABLE)) return -1;
if (PyModule_AddIntMacro(m, EX_UNAVAILABLE)) return -1;
#endif /* EX_UNAVAILABLE */
#ifdef EX_SOFTWARE
if (ins(d, "EX_SOFTWARE", (long)EX_SOFTWARE)) return -1;
if (PyModule_AddIntMacro(m, EX_SOFTWARE)) return -1;
#endif /* EX_SOFTWARE */
#ifdef EX_OSERR
if (ins(d, "EX_OSERR", (long)EX_OSERR)) return -1;
if (PyModule_AddIntMacro(m, EX_OSERR)) return -1;
#endif /* EX_OSERR */
#ifdef EX_OSFILE
if (ins(d, "EX_OSFILE", (long)EX_OSFILE)) return -1;
if (PyModule_AddIntMacro(m, EX_OSFILE)) return -1;
#endif /* EX_OSFILE */
#ifdef EX_CANTCREAT
if (ins(d, "EX_CANTCREAT", (long)EX_CANTCREAT)) return -1;
if (PyModule_AddIntMacro(m, EX_CANTCREAT)) return -1;
#endif /* EX_CANTCREAT */
#ifdef EX_IOERR
if (ins(d, "EX_IOERR", (long)EX_IOERR)) return -1;
if (PyModule_AddIntMacro(m, EX_IOERR)) return -1;
#endif /* EX_IOERR */
#ifdef EX_TEMPFAIL
if (ins(d, "EX_TEMPFAIL", (long)EX_TEMPFAIL)) return -1;
if (PyModule_AddIntMacro(m, EX_TEMPFAIL)) return -1;
#endif /* EX_TEMPFAIL */
#ifdef EX_PROTOCOL
if (ins(d, "EX_PROTOCOL", (long)EX_PROTOCOL)) return -1;
if (PyModule_AddIntMacro(m, EX_PROTOCOL)) return -1;
#endif /* EX_PROTOCOL */
#ifdef EX_NOPERM
if (ins(d, "EX_NOPERM", (long)EX_NOPERM)) return -1;
if (PyModule_AddIntMacro(m, EX_NOPERM)) return -1;
#endif /* EX_NOPERM */
#ifdef EX_CONFIG
if (ins(d, "EX_CONFIG", (long)EX_CONFIG)) return -1;
if (PyModule_AddIntMacro(m, EX_CONFIG)) return -1;
#endif /* EX_CONFIG */
#ifdef EX_NOTFOUND
if (ins(d, "EX_NOTFOUND", (long)EX_NOTFOUND)) return -1;
if (PyModule_AddIntMacro(m, EX_NOTFOUND)) return -1;
#endif /* EX_NOTFOUND */
/* statvfs */
#ifdef ST_RDONLY
if (ins(d, "ST_RDONLY", (long)ST_RDONLY)) return -1;
if (PyModule_AddIntMacro(m, ST_RDONLY)) return -1;
#endif /* ST_RDONLY */
#ifdef ST_NOSUID
if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1;
if (PyModule_AddIntMacro(m, ST_NOSUID)) return -1;
#endif /* ST_NOSUID */
/* FreeBSD sendfile() constants */
#ifdef SF_NODISKIO
if (ins(d, "SF_NODISKIO", (long)SF_NODISKIO)) return -1;
if (PyModule_AddIntMacro(m, SF_NODISKIO)) return -1;
#endif
#ifdef SF_MNOWAIT
if (ins(d, "SF_MNOWAIT", (long)SF_MNOWAIT)) return -1;
if (PyModule_AddIntMacro(m, SF_MNOWAIT)) return -1;
#endif
#ifdef SF_SYNC
if (ins(d, "SF_SYNC", (long)SF_SYNC)) return -1;
if (PyModule_AddIntMacro(m, SF_SYNC)) return -1;
#endif
/* constants for posix_fadvise */
#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
#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
#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
#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
#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
#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
/* constants for waitid */
#if defined(HAVE_SYS_WAIT_H) && defined(HAVE_WAITID)
if (ins(d, "P_PID", (long)P_PID)) return -1;
if (ins(d, "P_PGID", (long)P_PGID)) return -1;
if (ins(d, "P_ALL", (long)P_ALL)) return -1;
if (PyModule_AddIntMacro(m, P_PID)) return -1;
if (PyModule_AddIntMacro(m, P_PGID)) return -1;
if (PyModule_AddIntMacro(m, P_ALL)) return -1;
#endif
#ifdef WEXITED
if (ins(d, "WEXITED", (long)WEXITED)) return -1;
if (PyModule_AddIntMacro(m, WEXITED)) return -1;
#endif
#ifdef WNOWAIT
if (ins(d, "WNOWAIT", (long)WNOWAIT)) return -1;
if (PyModule_AddIntMacro(m, WNOWAIT)) return -1;
#endif
#ifdef WSTOPPED
if (ins(d, "WSTOPPED", (long)WSTOPPED)) return -1;
if (PyModule_AddIntMacro(m, WSTOPPED)) return -1;
#endif
#ifdef CLD_EXITED
if (ins(d, "CLD_EXITED", (long)CLD_EXITED)) return -1;
if (PyModule_AddIntMacro(m, CLD_EXITED)) return -1;
#endif
#ifdef CLD_DUMPED
if (ins(d, "CLD_DUMPED", (long)CLD_DUMPED)) return -1;
if (PyModule_AddIntMacro(m, CLD_DUMPED)) return -1;
#endif
#ifdef CLD_TRAPPED
if (ins(d, "CLD_TRAPPED", (long)CLD_TRAPPED)) return -1;
if (PyModule_AddIntMacro(m, CLD_TRAPPED)) return -1;
#endif
#ifdef CLD_CONTINUED
if (ins(d, "CLD_CONTINUED", (long)CLD_CONTINUED)) return -1;
if (PyModule_AddIntMacro(m, CLD_CONTINUED)) return -1;
#endif
/* constants for lockf */
#ifdef F_LOCK
if (ins(d, "F_LOCK", (long)F_LOCK)) return -1;
if (PyModule_AddIntMacro(m, F_LOCK)) return -1;
#endif
#ifdef F_TLOCK
if (ins(d, "F_TLOCK", (long)F_TLOCK)) return -1;
if (PyModule_AddIntMacro(m, F_TLOCK)) return -1;
#endif
#ifdef F_ULOCK
if (ins(d, "F_ULOCK", (long)F_ULOCK)) return -1;
if (PyModule_AddIntMacro(m, F_ULOCK)) return -1;
#endif
#ifdef F_TEST
if (ins(d, "F_TEST", (long)F_TEST)) return -1;
if (PyModule_AddIntMacro(m, F_TEST)) return -1;
#endif
#ifdef HAVE_SPAWNV
if (ins(d, "P_WAIT", (long)_P_WAIT)) return -1;
if (ins(d, "P_NOWAIT", (long)_P_NOWAIT)) return -1;
if (ins(d, "P_OVERLAY", (long)_OLD_P_OVERLAY)) return -1;
if (ins(d, "P_NOWAITO", (long)_P_NOWAITO)) return -1;
if (ins(d, "P_DETACH", (long)_P_DETACH)) return -1;
if (PyModule_AddIntConstant(m, "P_WAIT", _P_WAIT)) return -1;
if (PyModule_AddIntConstant(m, "P_NOWAIT", _P_NOWAIT)) return -1;
if (PyModule_AddIntConstant(m, "P_OVERLAY", _OLD_P_OVERLAY)) return -1;
if (PyModule_AddIntConstant(m, "P_NOWAITO", _P_NOWAITO)) return -1;
if (PyModule_AddIntConstant(m, "P_DETACH", _P_DETACH)) return -1;
#endif
#ifdef HAVE_SCHED_H
if (ins(d, "SCHED_OTHER", (long)SCHED_OTHER)) return -1;
if (ins(d, "SCHED_FIFO", (long)SCHED_FIFO)) return -1;
if (ins(d, "SCHED_RR", (long)SCHED_RR)) return -1;
if (PyModule_AddIntMacro(m, SCHED_OTHER)) return -1;
if (PyModule_AddIntMacro(m, SCHED_FIFO)) return -1;
if (PyModule_AddIntMacro(m, SCHED_RR)) return -1;
#ifdef SCHED_SPORADIC
if (ins(d, "SCHED_SPORADIC", (long)SCHED_SPORADIC) return -1;
if (PyModule_AddIntMacro(m, SCHED_SPORADIC) return -1;
#endif
#ifdef SCHED_BATCH
if (ins(d, "SCHED_BATCH", (long)SCHED_BATCH)) return -1;
if (PyModule_AddIntMacro(m, SCHED_BATCH)) return -1;
#endif
#ifdef SCHED_IDLE
if (ins(d, "SCHED_IDLE", (long)SCHED_IDLE)) return -1;
if (PyModule_AddIntMacro(m, SCHED_IDLE)) return -1;
#endif
#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
#ifdef SCHED_SYS
if (ins(d, "SCHED_SYS", (long)SCHED_SYS)) return -1;
if (PyModule_AddIntMacro(m, SCHED_SYS)) return -1;
#endif
#ifdef SCHED_IA
if (ins(d, "SCHED_IA", (long)SCHED_IA)) return -1;
if (PyModule_AddIntMacro(m, SCHED_IA)) return -1;
#endif
#ifdef SCHED_FSS
if (ins(d, "SCHED_FSS", (long)SCHED_FSS)) return -1;
if (PyModule_AddIntMacro(m, SCHED_FSS)) return -1;
#endif
#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
#ifdef USE_XATTRS
if (ins(d, "XATTR_CREATE", (long)XATTR_CREATE)) return -1;
if (ins(d, "XATTR_REPLACE", (long)XATTR_REPLACE)) return -1;
if (ins(d, "XATTR_SIZE_MAX", (long)XATTR_SIZE_MAX)) return -1;
if (PyModule_AddIntMacro(m, XATTR_CREATE)) return -1;
if (PyModule_AddIntMacro(m, XATTR_REPLACE)) return -1;
if (PyModule_AddIntMacro(m, XATTR_SIZE_MAX)) return -1;
#endif
#ifdef RTLD_LAZY
if (PyModule_AddIntMacro(d, RTLD_LAZY)) return -1;
if (PyModule_AddIntMacro(m, RTLD_LAZY)) return -1;
#endif
#ifdef RTLD_NOW
if (PyModule_AddIntMacro(d, RTLD_NOW)) return -1;
if (PyModule_AddIntMacro(m, RTLD_NOW)) return -1;
#endif
#ifdef RTLD_GLOBAL
if (PyModule_AddIntMacro(d, RTLD_GLOBAL)) return -1;
if (PyModule_AddIntMacro(m, RTLD_GLOBAL)) return -1;
#endif
#ifdef RTLD_LOCAL
if (PyModule_AddIntMacro(d, RTLD_LOCAL)) return -1;
if (PyModule_AddIntMacro(m, RTLD_LOCAL)) return -1;
#endif
#ifdef RTLD_NODELETE
if (PyModule_AddIntMacro(d, RTLD_NODELETE)) return -1;
if (PyModule_AddIntMacro(m, RTLD_NODELETE)) return -1;
#endif
#ifdef RTLD_NOLOAD
if (PyModule_AddIntMacro(d, RTLD_NOLOAD)) return -1;
if (PyModule_AddIntMacro(m, RTLD_NOLOAD)) return -1;
#endif
#ifdef RTLD_DEEPBIND
if (PyModule_AddIntMacro(d, RTLD_DEEPBIND)) return -1;
if (PyModule_AddIntMacro(m, RTLD_DEEPBIND)) return -1;
#endif
return 0;

View File

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

View File

@ -2183,7 +2183,7 @@ PyInit_select(void)
#undef PIPE_BUF
#define PIPE_BUF 512
#endif
PyModule_AddIntConstant(m, "PIPE_BUF", PIPE_BUF);
PyModule_AddIntMacro(m, PIPE_BUF);
#endif
#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)
@ -2198,27 +2198,27 @@ PyInit_select(void)
#endif
if (PyType_Ready(&poll_Type) < 0)
return NULL;
PyModule_AddIntConstant(m, "POLLIN", POLLIN);
PyModule_AddIntConstant(m, "POLLPRI", POLLPRI);
PyModule_AddIntConstant(m, "POLLOUT", POLLOUT);
PyModule_AddIntConstant(m, "POLLERR", POLLERR);
PyModule_AddIntConstant(m, "POLLHUP", POLLHUP);
PyModule_AddIntConstant(m, "POLLNVAL", POLLNVAL);
PyModule_AddIntMacro(m, POLLIN);
PyModule_AddIntMacro(m, POLLPRI);
PyModule_AddIntMacro(m, POLLOUT);
PyModule_AddIntMacro(m, POLLERR);
PyModule_AddIntMacro(m, POLLHUP);
PyModule_AddIntMacro(m, POLLNVAL);
#ifdef POLLRDNORM
PyModule_AddIntConstant(m, "POLLRDNORM", POLLRDNORM);
PyModule_AddIntMacro(m, POLLRDNORM);
#endif
#ifdef POLLRDBAND
PyModule_AddIntConstant(m, "POLLRDBAND", POLLRDBAND);
PyModule_AddIntMacro(m, POLLRDBAND);
#endif
#ifdef POLLWRNORM
PyModule_AddIntConstant(m, "POLLWRNORM", POLLWRNORM);
PyModule_AddIntMacro(m, POLLWRNORM);
#endif
#ifdef POLLWRBAND
PyModule_AddIntConstant(m, "POLLWRBAND", POLLWRBAND);
PyModule_AddIntMacro(m, POLLWRBAND);
#endif
#ifdef POLLMSG
PyModule_AddIntConstant(m, "POLLMSG", POLLMSG);
PyModule_AddIntMacro(m, POLLMSG);
#endif
}
#endif /* HAVE_POLL */
@ -2236,25 +2236,25 @@ PyInit_select(void)
Py_INCREF(&pyEpoll_Type);
PyModule_AddObject(m, "epoll", (PyObject *) &pyEpoll_Type);
PyModule_AddIntConstant(m, "EPOLLIN", EPOLLIN);
PyModule_AddIntConstant(m, "EPOLLOUT", EPOLLOUT);
PyModule_AddIntConstant(m, "EPOLLPRI", EPOLLPRI);
PyModule_AddIntConstant(m, "EPOLLERR", EPOLLERR);
PyModule_AddIntConstant(m, "EPOLLHUP", EPOLLHUP);
PyModule_AddIntConstant(m, "EPOLLET", EPOLLET);
PyModule_AddIntMacro(m, EPOLLIN);
PyModule_AddIntMacro(m, EPOLLOUT);
PyModule_AddIntMacro(m, EPOLLPRI);
PyModule_AddIntMacro(m, EPOLLERR);
PyModule_AddIntMacro(m, EPOLLHUP);
PyModule_AddIntMacro(m, EPOLLET);
#ifdef EPOLLONESHOT
/* Kernel 2.6.2+ */
PyModule_AddIntConstant(m, "EPOLLONESHOT", EPOLLONESHOT);
PyModule_AddIntMacro(m, EPOLLONESHOT);
#endif
/* PyModule_AddIntConstant(m, "EPOLL_RDHUP", EPOLLRDHUP); */
PyModule_AddIntConstant(m, "EPOLLRDNORM", EPOLLRDNORM);
PyModule_AddIntConstant(m, "EPOLLRDBAND", EPOLLRDBAND);
PyModule_AddIntConstant(m, "EPOLLWRNORM", EPOLLWRNORM);
PyModule_AddIntConstant(m, "EPOLLWRBAND", EPOLLWRBAND);
PyModule_AddIntConstant(m, "EPOLLMSG", EPOLLMSG);
PyModule_AddIntMacro(m, EPOLLRDNORM);
PyModule_AddIntMacro(m, EPOLLRDBAND);
PyModule_AddIntMacro(m, EPOLLWRNORM);
PyModule_AddIntMacro(m, EPOLLWRBAND);
PyModule_AddIntMacro(m, EPOLLMSG);
#ifdef EPOLL_CLOEXEC
PyModule_AddIntConstant(m, "EPOLL_CLOEXEC", EPOLL_CLOEXEC);
PyModule_AddIntMacro(m, EPOLL_CLOEXEC);
#endif
#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);
if (m == NULL)
return NULL;
PyModule_AddIntConstant(m, "USE", USE);
PyModule_AddIntConstant(m, "DEF_GLOBAL", DEF_GLOBAL);
PyModule_AddIntConstant(m, "DEF_LOCAL", DEF_LOCAL);
PyModule_AddIntConstant(m, "DEF_PARAM", DEF_PARAM);
PyModule_AddIntConstant(m, "DEF_FREE", DEF_FREE);
PyModule_AddIntConstant(m, "DEF_FREE_CLASS", DEF_FREE_CLASS);
PyModule_AddIntConstant(m, "DEF_IMPORT", DEF_IMPORT);
PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND);
PyModule_AddIntMacro(m, USE);
PyModule_AddIntMacro(m, DEF_GLOBAL);
PyModule_AddIntMacro(m, DEF_LOCAL);
PyModule_AddIntMacro(m, DEF_PARAM);
PyModule_AddIntMacro(m, DEF_FREE);
PyModule_AddIntMacro(m, DEF_FREE_CLASS);
PyModule_AddIntMacro(m, DEF_IMPORT);
PyModule_AddIntMacro(m, DEF_BOUND);
PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock);
PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock);
PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock);
PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR);
PyModule_AddIntConstant(m, "OPT_TOPLEVEL", OPT_TOPLEVEL);
PyModule_AddIntMacro(m, OPT_IMPORT_STAR);
PyModule_AddIntMacro(m, OPT_TOPLEVEL);
PyModule_AddIntConstant(m, "LOCAL", LOCAL);
PyModule_AddIntConstant(m, "GLOBAL_EXPLICIT", GLOBAL_EXPLICIT);
PyModule_AddIntConstant(m, "GLOBAL_IMPLICIT", GLOBAL_IMPLICIT);
PyModule_AddIntConstant(m, "FREE", FREE);
PyModule_AddIntConstant(m, "CELL", CELL);
PyModule_AddIntMacro(m, LOCAL);
PyModule_AddIntMacro(m, GLOBAL_EXPLICIT);
PyModule_AddIntMacro(m, GLOBAL_IMPLICIT);
PyModule_AddIntMacro(m, FREE);
PyModule_AddIntMacro(m, CELL);
PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFFSET);
PyModule_AddIntConstant(m, "SCOPE_MASK", SCOPE_MASK);
PyModule_AddIntMacro(m, SCOPE_MASK);
if (PyErr_Occurred()) {
Py_DECREF(m);

View File

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

View File

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

View File

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

View File

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