summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorCharles-Francois Natali <cf.natali@gmail.com>2013-05-20 17:13:19 (GMT)
committerCharles-Francois Natali <cf.natali@gmail.com>2013-05-20 17:13:19 (GMT)
commit74ca886788fd116b026fdaa5980a48f09bce9bef (patch)
treee28c3c619a57f1cb35659b51adfdb53c2d68b68f /Modules
parentd66b10e165d784ae7ea0d875f11153f1dff76fd8 (diff)
downloadcpython-74ca886788fd116b026fdaa5980a48f09bce9bef.zip
cpython-74ca886788fd116b026fdaa5980a48f09bce9bef.tar.gz
cpython-74ca886788fd116b026fdaa5980a48f09bce9bef.tar.bz2
Issue #17917: Use PyModule_AddIntMacro() instead of PyModule_AddIntConstant()
when applicable.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_datetimemodule.c4
-rw-r--r--Modules/_testbuffer.c60
-rw-r--r--Modules/fcntlmodule.c165
-rw-r--r--Modules/posixmodule.c244
-rw-r--r--Modules/resource.c34
-rw-r--r--Modules/selectmodule.c50
-rw-r--r--Modules/socketmodule.c650
-rw-r--r--Modules/symtablemodule.c32
-rw-r--r--Modules/syslogmodule.c66
-rw-r--r--Modules/zlibmodule.c28
10 files changed, 653 insertions, 680 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 7c7170d..8f60972 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -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);
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index 316666e..a4e1643 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -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_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_AddIntConstant(m, "PyBUF_READ", PyBUF_READ);
- PyModule_AddIntConstant(m, "PyBUF_WRITE", PyBUF_WRITE);
+ 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_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_AddIntMacro(m, PyBUF_READ);
+ PyModule_AddIntMacro(m, PyBUF_WRITE);
return m;
}
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c
index bc2c181..38ef55f 100644
--- a/Modules/fcntlmodule.c
+++ b/Modules/fcntlmodule.c
@@ -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);
-#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_GWROPT)) return -1;
+#endif
+ 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;
}
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 5772854..615ff82 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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;
diff --git a/Modules/resource.c b/Modules/resource.c
index b294a8c..4411225 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -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)
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 10d043b..ac44985 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -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 */
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index e4c1edd..20db3d9 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -5556,184 +5556,184 @@ PyInit__socket(void)
/* Address families (we only support AF_INET and AF_UNIX) */
#ifdef AF_UNSPEC
- PyModule_AddIntConstant(m, "AF_UNSPEC", AF_UNSPEC);
+ PyModule_AddIntMacro(m, AF_UNSPEC);
#endif
- PyModule_AddIntConstant(m, "AF_INET", AF_INET);
+ PyModule_AddIntMacro(m, AF_INET);
#ifdef AF_INET6
- PyModule_AddIntConstant(m, "AF_INET6", AF_INET6);
+ PyModule_AddIntMacro(m, AF_INET6);
#endif /* AF_INET6 */
#if defined(AF_UNIX)
- PyModule_AddIntConstant(m, "AF_UNIX", AF_UNIX);
+ PyModule_AddIntMacro(m, AF_UNIX);
#endif /* AF_UNIX */
#ifdef AF_AX25
/* Amateur Radio AX.25 */
- PyModule_AddIntConstant(m, "AF_AX25", AF_AX25);
+ PyModule_AddIntMacro(m, AF_AX25);
#endif
#ifdef AF_IPX
- PyModule_AddIntConstant(m, "AF_IPX", AF_IPX); /* Novell IPX */
+ PyModule_AddIntMacro(m, AF_IPX); /* Novell IPX */
#endif
#ifdef AF_APPLETALK
/* Appletalk DDP */
- PyModule_AddIntConstant(m, "AF_APPLETALK", AF_APPLETALK);
+ PyModule_AddIntMacro(m, AF_APPLETALK);
#endif
#ifdef AF_NETROM
/* Amateur radio NetROM */
- PyModule_AddIntConstant(m, "AF_NETROM", AF_NETROM);
+ PyModule_AddIntMacro(m, AF_NETROM);
#endif
#ifdef AF_BRIDGE
/* Multiprotocol bridge */
- PyModule_AddIntConstant(m, "AF_BRIDGE", AF_BRIDGE);
+ PyModule_AddIntMacro(m, AF_BRIDGE);
#endif
#ifdef AF_ATMPVC
/* ATM PVCs */
- PyModule_AddIntConstant(m, "AF_ATMPVC", AF_ATMPVC);
+ PyModule_AddIntMacro(m, AF_ATMPVC);
#endif
#ifdef AF_AAL5
/* Reserved for Werner's ATM */
- PyModule_AddIntConstant(m, "AF_AAL5", AF_AAL5);
+ PyModule_AddIntMacro(m, AF_AAL5);
#endif
#ifdef AF_X25
/* Reserved for X.25 project */
- PyModule_AddIntConstant(m, "AF_X25", AF_X25);
+ PyModule_AddIntMacro(m, AF_X25);
#endif
#ifdef AF_INET6
- PyModule_AddIntConstant(m, "AF_INET6", AF_INET6); /* IP version 6 */
+ PyModule_AddIntMacro(m, AF_INET6); /* IP version 6 */
#endif
#ifdef AF_ROSE
/* Amateur Radio X.25 PLP */
- PyModule_AddIntConstant(m, "AF_ROSE", AF_ROSE);
+ PyModule_AddIntMacro(m, AF_ROSE);
#endif
#ifdef AF_DECnet
/* Reserved for DECnet project */
- PyModule_AddIntConstant(m, "AF_DECnet", AF_DECnet);
+ PyModule_AddIntMacro(m, AF_DECnet);
#endif
#ifdef AF_NETBEUI
/* Reserved for 802.2LLC project */
- PyModule_AddIntConstant(m, "AF_NETBEUI", AF_NETBEUI);
+ PyModule_AddIntMacro(m, AF_NETBEUI);
#endif
#ifdef AF_SECURITY
/* Security callback pseudo AF */
- PyModule_AddIntConstant(m, "AF_SECURITY", AF_SECURITY);
+ PyModule_AddIntMacro(m, AF_SECURITY);
#endif
#ifdef AF_KEY
/* PF_KEY key management API */
- PyModule_AddIntConstant(m, "AF_KEY", AF_KEY);
+ PyModule_AddIntMacro(m, AF_KEY);
#endif
#ifdef AF_NETLINK
/* */
- PyModule_AddIntConstant(m, "AF_NETLINK", AF_NETLINK);
- PyModule_AddIntConstant(m, "NETLINK_ROUTE", NETLINK_ROUTE);
+ PyModule_AddIntMacro(m, AF_NETLINK);
+ PyModule_AddIntMacro(m, NETLINK_ROUTE);
#ifdef NETLINK_SKIP
- PyModule_AddIntConstant(m, "NETLINK_SKIP", NETLINK_SKIP);
+ PyModule_AddIntMacro(m, NETLINK_SKIP);
#endif
#ifdef NETLINK_W1
- PyModule_AddIntConstant(m, "NETLINK_W1", NETLINK_W1);
+ PyModule_AddIntMacro(m, NETLINK_W1);
#endif
- PyModule_AddIntConstant(m, "NETLINK_USERSOCK", NETLINK_USERSOCK);
- PyModule_AddIntConstant(m, "NETLINK_FIREWALL", NETLINK_FIREWALL);
+ PyModule_AddIntMacro(m, NETLINK_USERSOCK);
+ PyModule_AddIntMacro(m, NETLINK_FIREWALL);
#ifdef NETLINK_TCPDIAG
- PyModule_AddIntConstant(m, "NETLINK_TCPDIAG", NETLINK_TCPDIAG);
+ PyModule_AddIntMacro(m, NETLINK_TCPDIAG);
#endif
#ifdef NETLINK_NFLOG
- PyModule_AddIntConstant(m, "NETLINK_NFLOG", NETLINK_NFLOG);
+ PyModule_AddIntMacro(m, NETLINK_NFLOG);
#endif
#ifdef NETLINK_XFRM
- PyModule_AddIntConstant(m, "NETLINK_XFRM", NETLINK_XFRM);
+ PyModule_AddIntMacro(m, NETLINK_XFRM);
#endif
#ifdef NETLINK_ARPD
- PyModule_AddIntConstant(m, "NETLINK_ARPD", NETLINK_ARPD);
+ PyModule_AddIntMacro(m, NETLINK_ARPD);
#endif
#ifdef NETLINK_ROUTE6
- PyModule_AddIntConstant(m, "NETLINK_ROUTE6", NETLINK_ROUTE6);
+ PyModule_AddIntMacro(m, NETLINK_ROUTE6);
#endif
- PyModule_AddIntConstant(m, "NETLINK_IP6_FW", NETLINK_IP6_FW);
+ PyModule_AddIntMacro(m, NETLINK_IP6_FW);
#ifdef NETLINK_DNRTMSG
- PyModule_AddIntConstant(m, "NETLINK_DNRTMSG", NETLINK_DNRTMSG);
+ PyModule_AddIntMacro(m, NETLINK_DNRTMSG);
#endif
#ifdef NETLINK_TAPBASE
- PyModule_AddIntConstant(m, "NETLINK_TAPBASE", NETLINK_TAPBASE);
+ PyModule_AddIntMacro(m, NETLINK_TAPBASE);
#endif
#endif /* AF_NETLINK */
#ifdef AF_ROUTE
/* Alias to emulate 4.4BSD */
- PyModule_AddIntConstant(m, "AF_ROUTE", AF_ROUTE);
+ PyModule_AddIntMacro(m, AF_ROUTE);
#endif
#ifdef AF_ASH
/* Ash */
- PyModule_AddIntConstant(m, "AF_ASH", AF_ASH);
+ PyModule_AddIntMacro(m, AF_ASH);
#endif
#ifdef AF_ECONET
/* Acorn Econet */
- PyModule_AddIntConstant(m, "AF_ECONET", AF_ECONET);
+ PyModule_AddIntMacro(m, AF_ECONET);
#endif
#ifdef AF_ATMSVC
/* ATM SVCs */
- PyModule_AddIntConstant(m, "AF_ATMSVC", AF_ATMSVC);
+ PyModule_AddIntMacro(m, AF_ATMSVC);
#endif
#ifdef AF_SNA
/* Linux SNA Project (nutters!) */
- PyModule_AddIntConstant(m, "AF_SNA", AF_SNA);
+ PyModule_AddIntMacro(m, AF_SNA);
#endif
#ifdef AF_IRDA
/* IRDA sockets */
- PyModule_AddIntConstant(m, "AF_IRDA", AF_IRDA);
+ PyModule_AddIntMacro(m, AF_IRDA);
#endif
#ifdef AF_PPPOX
/* PPPoX sockets */
- PyModule_AddIntConstant(m, "AF_PPPOX", AF_PPPOX);
+ PyModule_AddIntMacro(m, AF_PPPOX);
#endif
#ifdef AF_WANPIPE
/* Wanpipe API Sockets */
- PyModule_AddIntConstant(m, "AF_WANPIPE", AF_WANPIPE);
+ PyModule_AddIntMacro(m, AF_WANPIPE);
#endif
#ifdef AF_LLC
/* Linux LLC */
- PyModule_AddIntConstant(m, "AF_LLC", AF_LLC);
+ PyModule_AddIntMacro(m, AF_LLC);
#endif
#ifdef USE_BLUETOOTH
- PyModule_AddIntConstant(m, "AF_BLUETOOTH", AF_BLUETOOTH);
- PyModule_AddIntConstant(m, "BTPROTO_L2CAP", BTPROTO_L2CAP);
- PyModule_AddIntConstant(m, "BTPROTO_HCI", BTPROTO_HCI);
- PyModule_AddIntConstant(m, "SOL_HCI", SOL_HCI);
+ PyModule_AddIntMacro(m, AF_BLUETOOTH);
+ PyModule_AddIntMacro(m, BTPROTO_L2CAP);
+ PyModule_AddIntMacro(m, BTPROTO_HCI);
+ PyModule_AddIntMacro(m, SOL_HCI);
#if !defined(__NetBSD__) && !defined(__DragonFly__)
- PyModule_AddIntConstant(m, "HCI_FILTER", HCI_FILTER);
+ PyModule_AddIntMacro(m, HCI_FILTER);
#endif
#if !defined(__FreeBSD__)
#if !defined(__NetBSD__) && !defined(__DragonFly__)
- PyModule_AddIntConstant(m, "HCI_TIME_STAMP", HCI_TIME_STAMP);
+ PyModule_AddIntMacro(m, HCI_TIME_STAMP);
#endif
- PyModule_AddIntConstant(m, "HCI_DATA_DIR", HCI_DATA_DIR);
- PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO);
+ PyModule_AddIntMacro(m, HCI_DATA_DIR);
+ PyModule_AddIntMacro(m, BTPROTO_SCO);
#endif
- PyModule_AddIntConstant(m, "BTPROTO_RFCOMM", BTPROTO_RFCOMM);
+ PyModule_AddIntMacro(m, BTPROTO_RFCOMM);
PyModule_AddStringConstant(m, "BDADDR_ANY", "00:00:00:00:00:00");
PyModule_AddStringConstant(m, "BDADDR_LOCAL", "00:00:00:FF:FF:FF");
#endif
#ifdef AF_CAN
/* Controller Area Network */
- PyModule_AddIntConstant(m, "AF_CAN", AF_CAN);
+ PyModule_AddIntMacro(m, AF_CAN);
#endif
#ifdef PF_CAN
/* Controller Area Network */
- PyModule_AddIntConstant(m, "PF_CAN", PF_CAN);
+ PyModule_AddIntMacro(m, PF_CAN);
#endif
/* Reliable Datagram Sockets */
#ifdef AF_RDS
- PyModule_AddIntConstant(m, "AF_RDS", AF_RDS);
+ PyModule_AddIntMacro(m, AF_RDS);
#endif
#ifdef PF_RDS
- PyModule_AddIntConstant(m, "PF_RDS", PF_RDS);
+ PyModule_AddIntMacro(m, PF_RDS);
#endif
/* Kernel event messages */
#ifdef PF_SYSTEM
- PyModule_AddIntConstant(m, "PF_SYSTEM", PF_SYSTEM);
+ PyModule_AddIntMacro(m, PF_SYSTEM);
#endif
#ifdef AF_SYSTEM
- PyModule_AddIntConstant(m, "AF_SYSTEM", AF_SYSTEM);
+ PyModule_AddIntMacro(m, AF_SYSTEM);
#endif
#ifdef AF_PACKET
@@ -5765,134 +5765,129 @@ PyInit__socket(void)
#endif
#ifdef HAVE_LINUX_TIPC_H
- PyModule_AddIntConstant(m, "AF_TIPC", AF_TIPC);
+ PyModule_AddIntMacro(m, AF_TIPC);
/* for addresses */
- PyModule_AddIntConstant(m, "TIPC_ADDR_NAMESEQ", TIPC_ADDR_NAMESEQ);
- PyModule_AddIntConstant(m, "TIPC_ADDR_NAME", TIPC_ADDR_NAME);
- PyModule_AddIntConstant(m, "TIPC_ADDR_ID", TIPC_ADDR_ID);
+ PyModule_AddIntMacro(m, TIPC_ADDR_NAMESEQ);
+ PyModule_AddIntMacro(m, TIPC_ADDR_NAME);
+ PyModule_AddIntMacro(m, TIPC_ADDR_ID);
- PyModule_AddIntConstant(m, "TIPC_ZONE_SCOPE", TIPC_ZONE_SCOPE);
- PyModule_AddIntConstant(m, "TIPC_CLUSTER_SCOPE", TIPC_CLUSTER_SCOPE);
- PyModule_AddIntConstant(m, "TIPC_NODE_SCOPE", TIPC_NODE_SCOPE);
+ PyModule_AddIntMacro(m, TIPC_ZONE_SCOPE);
+ PyModule_AddIntMacro(m, TIPC_CLUSTER_SCOPE);
+ PyModule_AddIntMacro(m, TIPC_NODE_SCOPE);
/* for setsockopt() */
- PyModule_AddIntConstant(m, "SOL_TIPC", SOL_TIPC);
- PyModule_AddIntConstant(m, "TIPC_IMPORTANCE", TIPC_IMPORTANCE);
- PyModule_AddIntConstant(m, "TIPC_SRC_DROPPABLE", TIPC_SRC_DROPPABLE);
- PyModule_AddIntConstant(m, "TIPC_DEST_DROPPABLE",
- TIPC_DEST_DROPPABLE);
- PyModule_AddIntConstant(m, "TIPC_CONN_TIMEOUT", TIPC_CONN_TIMEOUT);
-
- PyModule_AddIntConstant(m, "TIPC_LOW_IMPORTANCE",
- TIPC_LOW_IMPORTANCE);
- PyModule_AddIntConstant(m, "TIPC_MEDIUM_IMPORTANCE",
- TIPC_MEDIUM_IMPORTANCE);
- PyModule_AddIntConstant(m, "TIPC_HIGH_IMPORTANCE",
- TIPC_HIGH_IMPORTANCE);
- PyModule_AddIntConstant(m, "TIPC_CRITICAL_IMPORTANCE",
- TIPC_CRITICAL_IMPORTANCE);
+ PyModule_AddIntMacro(m, SOL_TIPC);
+ PyModule_AddIntMacro(m, TIPC_IMPORTANCE);
+ PyModule_AddIntMacro(m, TIPC_SRC_DROPPABLE);
+ PyModule_AddIntMacro(m, TIPC_DEST_DROPPABLE);
+ PyModule_AddIntMacro(m, TIPC_CONN_TIMEOUT);
+
+ PyModule_AddIntMacro(m, TIPC_LOW_IMPORTANCE);
+ PyModule_AddIntMacro(m, TIPC_MEDIUM_IMPORTANCE);
+ PyModule_AddIntMacro(m, TIPC_HIGH_IMPORTANCE);
+ PyModule_AddIntMacro(m, TIPC_CRITICAL_IMPORTANCE);
/* for subscriptions */
- PyModule_AddIntConstant(m, "TIPC_SUB_PORTS", TIPC_SUB_PORTS);
- PyModule_AddIntConstant(m, "TIPC_SUB_SERVICE", TIPC_SUB_SERVICE);
+ PyModule_AddIntMacro(m, TIPC_SUB_PORTS);
+ PyModule_AddIntMacro(m, TIPC_SUB_SERVICE);
#ifdef TIPC_SUB_CANCEL
/* doesn't seem to be available everywhere */
- PyModule_AddIntConstant(m, "TIPC_SUB_CANCEL", TIPC_SUB_CANCEL);
+ PyModule_AddIntMacro(m, TIPC_SUB_CANCEL);
#endif
- PyModule_AddIntConstant(m, "TIPC_WAIT_FOREVER", TIPC_WAIT_FOREVER);
- PyModule_AddIntConstant(m, "TIPC_PUBLISHED", TIPC_PUBLISHED);
- PyModule_AddIntConstant(m, "TIPC_WITHDRAWN", TIPC_WITHDRAWN);
- PyModule_AddIntConstant(m, "TIPC_SUBSCR_TIMEOUT", TIPC_SUBSCR_TIMEOUT);
- PyModule_AddIntConstant(m, "TIPC_CFG_SRV", TIPC_CFG_SRV);
- PyModule_AddIntConstant(m, "TIPC_TOP_SRV", TIPC_TOP_SRV);
+ PyModule_AddIntMacro(m, TIPC_WAIT_FOREVER);
+ PyModule_AddIntMacro(m, TIPC_PUBLISHED);
+ PyModule_AddIntMacro(m, TIPC_WITHDRAWN);
+ PyModule_AddIntMacro(m, TIPC_SUBSCR_TIMEOUT);
+ PyModule_AddIntMacro(m, TIPC_CFG_SRV);
+ PyModule_AddIntMacro(m, TIPC_TOP_SRV);
#endif
/* Socket types */
- PyModule_AddIntConstant(m, "SOCK_STREAM", SOCK_STREAM);
- PyModule_AddIntConstant(m, "SOCK_DGRAM", SOCK_DGRAM);
+ PyModule_AddIntMacro(m, SOCK_STREAM);
+ PyModule_AddIntMacro(m, SOCK_DGRAM);
/* We have incomplete socket support. */
- PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW);
- PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET);
+ PyModule_AddIntMacro(m, SOCK_RAW);
+ PyModule_AddIntMacro(m, SOCK_SEQPACKET);
#if defined(SOCK_RDM)
- PyModule_AddIntConstant(m, "SOCK_RDM", SOCK_RDM);
+ PyModule_AddIntMacro(m, SOCK_RDM);
#endif
#ifdef SOCK_CLOEXEC
- PyModule_AddIntConstant(m, "SOCK_CLOEXEC", SOCK_CLOEXEC);
+ PyModule_AddIntMacro(m, SOCK_CLOEXEC);
#endif
#ifdef SOCK_NONBLOCK
- PyModule_AddIntConstant(m, "SOCK_NONBLOCK", SOCK_NONBLOCK);
+ PyModule_AddIntMacro(m, SOCK_NONBLOCK);
#endif
#ifdef SO_DEBUG
- PyModule_AddIntConstant(m, "SO_DEBUG", SO_DEBUG);
+ PyModule_AddIntMacro(m, SO_DEBUG);
#endif
#ifdef SO_ACCEPTCONN
- PyModule_AddIntConstant(m, "SO_ACCEPTCONN", SO_ACCEPTCONN);
+ PyModule_AddIntMacro(m, SO_ACCEPTCONN);
#endif
#ifdef SO_REUSEADDR
- PyModule_AddIntConstant(m, "SO_REUSEADDR", SO_REUSEADDR);
+ PyModule_AddIntMacro(m, SO_REUSEADDR);
#endif
#ifdef SO_EXCLUSIVEADDRUSE
- PyModule_AddIntConstant(m, "SO_EXCLUSIVEADDRUSE", SO_EXCLUSIVEADDRUSE);
+ PyModule_AddIntMacro(m, SO_EXCLUSIVEADDRUSE);
#endif
#ifdef SO_KEEPALIVE
- PyModule_AddIntConstant(m, "SO_KEEPALIVE", SO_KEEPALIVE);
+ PyModule_AddIntMacro(m, SO_KEEPALIVE);
#endif
#ifdef SO_DONTROUTE
- PyModule_AddIntConstant(m, "SO_DONTROUTE", SO_DONTROUTE);
+ PyModule_AddIntMacro(m, SO_DONTROUTE);
#endif
#ifdef SO_BROADCAST
- PyModule_AddIntConstant(m, "SO_BROADCAST", SO_BROADCAST);
+ PyModule_AddIntMacro(m, SO_BROADCAST);
#endif
#ifdef SO_USELOOPBACK
- PyModule_AddIntConstant(m, "SO_USELOOPBACK", SO_USELOOPBACK);
+ PyModule_AddIntMacro(m, SO_USELOOPBACK);
#endif
#ifdef SO_LINGER
- PyModule_AddIntConstant(m, "SO_LINGER", SO_LINGER);
+ PyModule_AddIntMacro(m, SO_LINGER);
#endif
#ifdef SO_OOBINLINE
- PyModule_AddIntConstant(m, "SO_OOBINLINE", SO_OOBINLINE);
+ PyModule_AddIntMacro(m, SO_OOBINLINE);
#endif
#ifdef SO_REUSEPORT
- PyModule_AddIntConstant(m, "SO_REUSEPORT", SO_REUSEPORT);
+ PyModule_AddIntMacro(m, SO_REUSEPORT);
#endif
#ifdef SO_SNDBUF
- PyModule_AddIntConstant(m, "SO_SNDBUF", SO_SNDBUF);
+ PyModule_AddIntMacro(m, SO_SNDBUF);
#endif
#ifdef SO_RCVBUF
- PyModule_AddIntConstant(m, "SO_RCVBUF", SO_RCVBUF);
+ PyModule_AddIntMacro(m, SO_RCVBUF);
#endif
#ifdef SO_SNDLOWAT
- PyModule_AddIntConstant(m, "SO_SNDLOWAT", SO_SNDLOWAT);
+ PyModule_AddIntMacro(m, SO_SNDLOWAT);
#endif
#ifdef SO_RCVLOWAT
- PyModule_AddIntConstant(m, "SO_RCVLOWAT", SO_RCVLOWAT);
+ PyModule_AddIntMacro(m, SO_RCVLOWAT);
#endif
#ifdef SO_SNDTIMEO
- PyModule_AddIntConstant(m, "SO_SNDTIMEO", SO_SNDTIMEO);
+ PyModule_AddIntMacro(m, SO_SNDTIMEO);
#endif
#ifdef SO_RCVTIMEO
- PyModule_AddIntConstant(m, "SO_RCVTIMEO", SO_RCVTIMEO);
+ PyModule_AddIntMacro(m, SO_RCVTIMEO);
#endif
#ifdef SO_ERROR
- PyModule_AddIntConstant(m, "SO_ERROR", SO_ERROR);
+ PyModule_AddIntMacro(m, SO_ERROR);
#endif
#ifdef SO_TYPE
- PyModule_AddIntConstant(m, "SO_TYPE", SO_TYPE);
+ PyModule_AddIntMacro(m, SO_TYPE);
#endif
#ifdef SO_SETFIB
- PyModule_AddIntConstant(m, "SO_SETFIB", SO_SETFIB);
+ PyModule_AddIntMacro(m, SO_SETFIB);
#endif
#ifdef SO_PASSCRED
- PyModule_AddIntConstant(m, "SO_PASSCRED", SO_PASSCRED);
+ PyModule_AddIntMacro(m, SO_PASSCRED);
#endif
#ifdef SO_PEERCRED
- PyModule_AddIntConstant(m, "SO_PEERCRED", SO_PEERCRED);
+ PyModule_AddIntMacro(m, SO_PEERCRED);
#endif
#ifdef LOCAL_PEERCRED
- PyModule_AddIntConstant(m, "LOCAL_PEERCRED", LOCAL_PEERCRED);
+ PyModule_AddIntMacro(m, LOCAL_PEERCRED);
#endif
#ifdef SO_BINDTODEVICE
PyModule_AddIntMacro(m, SO_BINDTODEVICE);
@@ -5900,142 +5895,142 @@ PyInit__socket(void)
/* Maximum number of connections for "listen" */
#ifdef SOMAXCONN
- PyModule_AddIntConstant(m, "SOMAXCONN", SOMAXCONN);
+ PyModule_AddIntMacro(m, SOMAXCONN);
#else
PyModule_AddIntConstant(m, "SOMAXCONN", 5); /* Common value */
#endif
/* Ancilliary message types */
#ifdef SCM_RIGHTS
- PyModule_AddIntConstant(m, "SCM_RIGHTS", SCM_RIGHTS);
+ PyModule_AddIntMacro(m, SCM_RIGHTS);
#endif
#ifdef SCM_CREDENTIALS
- PyModule_AddIntConstant(m, "SCM_CREDENTIALS", SCM_CREDENTIALS);
+ PyModule_AddIntMacro(m, SCM_CREDENTIALS);
#endif
#ifdef SCM_CREDS
- PyModule_AddIntConstant(m, "SCM_CREDS", SCM_CREDS);
+ PyModule_AddIntMacro(m, SCM_CREDS);
#endif
/* Flags for send, recv */
#ifdef MSG_OOB
- PyModule_AddIntConstant(m, "MSG_OOB", MSG_OOB);
+ PyModule_AddIntMacro(m, MSG_OOB);
#endif
#ifdef MSG_PEEK
- PyModule_AddIntConstant(m, "MSG_PEEK", MSG_PEEK);
+ PyModule_AddIntMacro(m, MSG_PEEK);
#endif
#ifdef MSG_DONTROUTE
- PyModule_AddIntConstant(m, "MSG_DONTROUTE", MSG_DONTROUTE);
+ PyModule_AddIntMacro(m, MSG_DONTROUTE);
#endif
#ifdef MSG_DONTWAIT
- PyModule_AddIntConstant(m, "MSG_DONTWAIT", MSG_DONTWAIT);
+ PyModule_AddIntMacro(m, MSG_DONTWAIT);
#endif
#ifdef MSG_EOR
- PyModule_AddIntConstant(m, "MSG_EOR", MSG_EOR);
+ PyModule_AddIntMacro(m, MSG_EOR);
#endif
#ifdef MSG_TRUNC
- PyModule_AddIntConstant(m, "MSG_TRUNC", MSG_TRUNC);
+ PyModule_AddIntMacro(m, MSG_TRUNC);
#endif
#ifdef MSG_CTRUNC
- PyModule_AddIntConstant(m, "MSG_CTRUNC", MSG_CTRUNC);
+ PyModule_AddIntMacro(m, MSG_CTRUNC);
#endif
#ifdef MSG_WAITALL
- PyModule_AddIntConstant(m, "MSG_WAITALL", MSG_WAITALL);
+ PyModule_AddIntMacro(m, MSG_WAITALL);
#endif
#ifdef MSG_BTAG
- PyModule_AddIntConstant(m, "MSG_BTAG", MSG_BTAG);
+ PyModule_AddIntMacro(m, MSG_BTAG);
#endif
#ifdef MSG_ETAG
- PyModule_AddIntConstant(m, "MSG_ETAG", MSG_ETAG);
+ PyModule_AddIntMacro(m, MSG_ETAG);
#endif
#ifdef MSG_NOSIGNAL
- PyModule_AddIntConstant(m, "MSG_NOSIGNAL", MSG_NOSIGNAL);
+ PyModule_AddIntMacro(m, MSG_NOSIGNAL);
#endif
#ifdef MSG_NOTIFICATION
- PyModule_AddIntConstant(m, "MSG_NOTIFICATION", MSG_NOTIFICATION);
+ PyModule_AddIntMacro(m, MSG_NOTIFICATION);
#endif
#ifdef MSG_CMSG_CLOEXEC
- PyModule_AddIntConstant(m, "MSG_CMSG_CLOEXEC", MSG_CMSG_CLOEXEC);
+ PyModule_AddIntMacro(m, MSG_CMSG_CLOEXEC);
#endif
#ifdef MSG_ERRQUEUE
- PyModule_AddIntConstant(m, "MSG_ERRQUEUE", MSG_ERRQUEUE);
+ PyModule_AddIntMacro(m, MSG_ERRQUEUE);
#endif
#ifdef MSG_CONFIRM
- PyModule_AddIntConstant(m, "MSG_CONFIRM", MSG_CONFIRM);
+ PyModule_AddIntMacro(m, MSG_CONFIRM);
#endif
#ifdef MSG_MORE
- PyModule_AddIntConstant(m, "MSG_MORE", MSG_MORE);
+ PyModule_AddIntMacro(m, MSG_MORE);
#endif
#ifdef MSG_EOF
- PyModule_AddIntConstant(m, "MSG_EOF", MSG_EOF);
+ PyModule_AddIntMacro(m, MSG_EOF);
#endif
#ifdef MSG_BCAST
- PyModule_AddIntConstant(m, "MSG_BCAST", MSG_BCAST);
+ PyModule_AddIntMacro(m, MSG_BCAST);
#endif
#ifdef MSG_MCAST
- PyModule_AddIntConstant(m, "MSG_MCAST", MSG_MCAST);
+ PyModule_AddIntMacro(m, MSG_MCAST);
#endif
#ifdef MSG_FASTOPEN
- PyModule_AddIntConstant(m, "MSG_FASTOPEN", MSG_FASTOPEN);
+ PyModule_AddIntMacro(m, MSG_FASTOPEN);
#endif
/* Protocol level and numbers, usable for [gs]etsockopt */
#ifdef SOL_SOCKET
- PyModule_AddIntConstant(m, "SOL_SOCKET", SOL_SOCKET);
+ PyModule_AddIntMacro(m, SOL_SOCKET);
#endif
#ifdef SOL_IP
- PyModule_AddIntConstant(m, "SOL_IP", SOL_IP);
+ PyModule_AddIntMacro(m, SOL_IP);
#else
PyModule_AddIntConstant(m, "SOL_IP", 0);
#endif
#ifdef SOL_IPX
- PyModule_AddIntConstant(m, "SOL_IPX", SOL_IPX);
+ PyModule_AddIntMacro(m, SOL_IPX);
#endif
#ifdef SOL_AX25
- PyModule_AddIntConstant(m, "SOL_AX25", SOL_AX25);
+ PyModule_AddIntMacro(m, SOL_AX25);
#endif
#ifdef SOL_ATALK
- PyModule_AddIntConstant(m, "SOL_ATALK", SOL_ATALK);
+ PyModule_AddIntMacro(m, SOL_ATALK);
#endif
#ifdef SOL_NETROM
- PyModule_AddIntConstant(m, "SOL_NETROM", SOL_NETROM);
+ PyModule_AddIntMacro(m, SOL_NETROM);
#endif
#ifdef SOL_ROSE
- PyModule_AddIntConstant(m, "SOL_ROSE", SOL_ROSE);
+ PyModule_AddIntMacro(m, SOL_ROSE);
#endif
#ifdef SOL_TCP
- PyModule_AddIntConstant(m, "SOL_TCP", SOL_TCP);
+ PyModule_AddIntMacro(m, SOL_TCP);
#else
PyModule_AddIntConstant(m, "SOL_TCP", 6);
#endif
#ifdef SOL_UDP
- PyModule_AddIntConstant(m, "SOL_UDP", SOL_UDP);
+ PyModule_AddIntMacro(m, SOL_UDP);
#else
PyModule_AddIntConstant(m, "SOL_UDP", 17);
#endif
#ifdef SOL_CAN_BASE
- PyModule_AddIntConstant(m, "SOL_CAN_BASE", SOL_CAN_BASE);
+ PyModule_AddIntMacro(m, SOL_CAN_BASE);
#endif
#ifdef SOL_CAN_RAW
- PyModule_AddIntConstant(m, "SOL_CAN_RAW", SOL_CAN_RAW);
- PyModule_AddIntConstant(m, "CAN_RAW", CAN_RAW);
+ PyModule_AddIntMacro(m, SOL_CAN_RAW);
+ PyModule_AddIntMacro(m, CAN_RAW);
#endif
#ifdef HAVE_LINUX_CAN_H
- PyModule_AddIntConstant(m, "CAN_EFF_FLAG", CAN_EFF_FLAG);
- PyModule_AddIntConstant(m, "CAN_RTR_FLAG", CAN_RTR_FLAG);
- PyModule_AddIntConstant(m, "CAN_ERR_FLAG", CAN_ERR_FLAG);
+ PyModule_AddIntMacro(m, CAN_EFF_FLAG);
+ PyModule_AddIntMacro(m, CAN_RTR_FLAG);
+ PyModule_AddIntMacro(m, CAN_ERR_FLAG);
- PyModule_AddIntConstant(m, "CAN_SFF_MASK", CAN_SFF_MASK);
- PyModule_AddIntConstant(m, "CAN_EFF_MASK", CAN_EFF_MASK);
- PyModule_AddIntConstant(m, "CAN_ERR_MASK", CAN_ERR_MASK);
+ PyModule_AddIntMacro(m, CAN_SFF_MASK);
+ PyModule_AddIntMacro(m, CAN_EFF_MASK);
+ PyModule_AddIntMacro(m, CAN_ERR_MASK);
#endif
#ifdef HAVE_LINUX_CAN_RAW_H
- PyModule_AddIntConstant(m, "CAN_RAW_FILTER", CAN_RAW_FILTER);
- PyModule_AddIntConstant(m, "CAN_RAW_ERR_FILTER", CAN_RAW_ERR_FILTER);
- PyModule_AddIntConstant(m, "CAN_RAW_LOOPBACK", CAN_RAW_LOOPBACK);
- PyModule_AddIntConstant(m, "CAN_RAW_RECV_OWN_MSGS", CAN_RAW_RECV_OWN_MSGS);
+ PyModule_AddIntMacro(m, CAN_RAW_FILTER);
+ PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER);
+ PyModule_AddIntMacro(m, CAN_RAW_LOOPBACK);
+ PyModule_AddIntMacro(m, CAN_RAW_RECV_OWN_MSGS);
#endif
#ifdef HAVE_LINUX_CAN_BCM_H
- PyModule_AddIntConstant(m, "CAN_BCM", CAN_BCM);
+ PyModule_AddIntMacro(m, CAN_BCM);
PyModule_AddIntConstant(m, "CAN_BCM_TX_SETUP", TX_SETUP);
PyModule_AddIntConstant(m, "CAN_BCM_TX_DELETE", TX_DELETE);
PyModule_AddIntConstant(m, "CAN_BCM_TX_READ", TX_READ);
@@ -6050,180 +6045,180 @@ PyInit__socket(void)
PyModule_AddIntConstant(m, "CAN_BCM_RX_CHANGED", RX_CHANGED);
#endif
#ifdef SOL_RDS
- PyModule_AddIntConstant(m, "SOL_RDS", SOL_RDS);
+ PyModule_AddIntMacro(m, SOL_RDS);
#endif
#ifdef RDS_CANCEL_SENT_TO
- PyModule_AddIntConstant(m, "RDS_CANCEL_SENT_TO", RDS_CANCEL_SENT_TO);
+ PyModule_AddIntMacro(m, RDS_CANCEL_SENT_TO);
#endif
#ifdef RDS_GET_MR
- PyModule_AddIntConstant(m, "RDS_GET_MR", RDS_GET_MR);
+ PyModule_AddIntMacro(m, RDS_GET_MR);
#endif
#ifdef RDS_FREE_MR
- PyModule_AddIntConstant(m, "RDS_FREE_MR", RDS_FREE_MR);
+ PyModule_AddIntMacro(m, RDS_FREE_MR);
#endif
#ifdef RDS_RECVERR
- PyModule_AddIntConstant(m, "RDS_RECVERR", RDS_RECVERR);
+ PyModule_AddIntMacro(m, RDS_RECVERR);
#endif
#ifdef RDS_CONG_MONITOR
- PyModule_AddIntConstant(m, "RDS_CONG_MONITOR", RDS_CONG_MONITOR);
+ PyModule_AddIntMacro(m, RDS_CONG_MONITOR);
#endif
#ifdef RDS_GET_MR_FOR_DEST
- PyModule_AddIntConstant(m, "RDS_GET_MR_FOR_DEST", RDS_GET_MR_FOR_DEST);
+ PyModule_AddIntMacro(m, RDS_GET_MR_FOR_DEST);
#endif
#ifdef IPPROTO_IP
- PyModule_AddIntConstant(m, "IPPROTO_IP", IPPROTO_IP);
+ PyModule_AddIntMacro(m, IPPROTO_IP);
#else
PyModule_AddIntConstant(m, "IPPROTO_IP", 0);
#endif
#ifdef IPPROTO_HOPOPTS
- PyModule_AddIntConstant(m, "IPPROTO_HOPOPTS", IPPROTO_HOPOPTS);
+ PyModule_AddIntMacro(m, IPPROTO_HOPOPTS);
#endif
#ifdef IPPROTO_ICMP
- PyModule_AddIntConstant(m, "IPPROTO_ICMP", IPPROTO_ICMP);
+ PyModule_AddIntMacro(m, IPPROTO_ICMP);
#else
PyModule_AddIntConstant(m, "IPPROTO_ICMP", 1);
#endif
#ifdef IPPROTO_IGMP
- PyModule_AddIntConstant(m, "IPPROTO_IGMP", IPPROTO_IGMP);
+ PyModule_AddIntMacro(m, IPPROTO_IGMP);
#endif
#ifdef IPPROTO_GGP
- PyModule_AddIntConstant(m, "IPPROTO_GGP", IPPROTO_GGP);
+ PyModule_AddIntMacro(m, IPPROTO_GGP);
#endif
#ifdef IPPROTO_IPV4
- PyModule_AddIntConstant(m, "IPPROTO_IPV4", IPPROTO_IPV4);
+ PyModule_AddIntMacro(m, IPPROTO_IPV4);
#endif
#ifdef IPPROTO_IPV6
- PyModule_AddIntConstant(m, "IPPROTO_IPV6", IPPROTO_IPV6);
+ PyModule_AddIntMacro(m, IPPROTO_IPV6);
#endif
#ifdef IPPROTO_IPIP
- PyModule_AddIntConstant(m, "IPPROTO_IPIP", IPPROTO_IPIP);
+ PyModule_AddIntMacro(m, IPPROTO_IPIP);
#endif
#ifdef IPPROTO_TCP
- PyModule_AddIntConstant(m, "IPPROTO_TCP", IPPROTO_TCP);
+ PyModule_AddIntMacro(m, IPPROTO_TCP);
#else
PyModule_AddIntConstant(m, "IPPROTO_TCP", 6);
#endif
#ifdef IPPROTO_EGP
- PyModule_AddIntConstant(m, "IPPROTO_EGP", IPPROTO_EGP);
+ PyModule_AddIntMacro(m, IPPROTO_EGP);
#endif
#ifdef IPPROTO_PUP
- PyModule_AddIntConstant(m, "IPPROTO_PUP", IPPROTO_PUP);
+ PyModule_AddIntMacro(m, IPPROTO_PUP);
#endif
#ifdef IPPROTO_UDP
- PyModule_AddIntConstant(m, "IPPROTO_UDP", IPPROTO_UDP);
+ PyModule_AddIntMacro(m, IPPROTO_UDP);
#else
PyModule_AddIntConstant(m, "IPPROTO_UDP", 17);
#endif
#ifdef IPPROTO_IDP
- PyModule_AddIntConstant(m, "IPPROTO_IDP", IPPROTO_IDP);
+ PyModule_AddIntMacro(m, IPPROTO_IDP);
#endif
#ifdef IPPROTO_HELLO
- PyModule_AddIntConstant(m, "IPPROTO_HELLO", IPPROTO_HELLO);
+ PyModule_AddIntMacro(m, IPPROTO_HELLO);
#endif
#ifdef IPPROTO_ND
- PyModule_AddIntConstant(m, "IPPROTO_ND", IPPROTO_ND);
+ PyModule_AddIntMacro(m, IPPROTO_ND);
#endif
#ifdef IPPROTO_TP
- PyModule_AddIntConstant(m, "IPPROTO_TP", IPPROTO_TP);
+ PyModule_AddIntMacro(m, IPPROTO_TP);
#endif
#ifdef IPPROTO_IPV6
- PyModule_AddIntConstant(m, "IPPROTO_IPV6", IPPROTO_IPV6);
+ PyModule_AddIntMacro(m, IPPROTO_IPV6);
#endif
#ifdef IPPROTO_ROUTING
- PyModule_AddIntConstant(m, "IPPROTO_ROUTING", IPPROTO_ROUTING);
+ PyModule_AddIntMacro(m, IPPROTO_ROUTING);
#endif
#ifdef IPPROTO_FRAGMENT
- PyModule_AddIntConstant(m, "IPPROTO_FRAGMENT", IPPROTO_FRAGMENT);
+ PyModule_AddIntMacro(m, IPPROTO_FRAGMENT);
#endif
#ifdef IPPROTO_RSVP
- PyModule_AddIntConstant(m, "IPPROTO_RSVP", IPPROTO_RSVP);
+ PyModule_AddIntMacro(m, IPPROTO_RSVP);
#endif
#ifdef IPPROTO_GRE
- PyModule_AddIntConstant(m, "IPPROTO_GRE", IPPROTO_GRE);
+ PyModule_AddIntMacro(m, IPPROTO_GRE);
#endif
#ifdef IPPROTO_ESP
- PyModule_AddIntConstant(m, "IPPROTO_ESP", IPPROTO_ESP);
+ PyModule_AddIntMacro(m, IPPROTO_ESP);
#endif
#ifdef IPPROTO_AH
- PyModule_AddIntConstant(m, "IPPROTO_AH", IPPROTO_AH);
+ PyModule_AddIntMacro(m, IPPROTO_AH);
#endif
#ifdef IPPROTO_MOBILE
- PyModule_AddIntConstant(m, "IPPROTO_MOBILE", IPPROTO_MOBILE);
+ PyModule_AddIntMacro(m, IPPROTO_MOBILE);
#endif
#ifdef IPPROTO_ICMPV6
- PyModule_AddIntConstant(m, "IPPROTO_ICMPV6", IPPROTO_ICMPV6);
+ PyModule_AddIntMacro(m, IPPROTO_ICMPV6);
#endif
#ifdef IPPROTO_NONE
- PyModule_AddIntConstant(m, "IPPROTO_NONE", IPPROTO_NONE);
+ PyModule_AddIntMacro(m, IPPROTO_NONE);
#endif
#ifdef IPPROTO_DSTOPTS
- PyModule_AddIntConstant(m, "IPPROTO_DSTOPTS", IPPROTO_DSTOPTS);
+ PyModule_AddIntMacro(m, IPPROTO_DSTOPTS);
#endif
#ifdef IPPROTO_XTP
- PyModule_AddIntConstant(m, "IPPROTO_XTP", IPPROTO_XTP);
+ PyModule_AddIntMacro(m, IPPROTO_XTP);
#endif
#ifdef IPPROTO_EON
- PyModule_AddIntConstant(m, "IPPROTO_EON", IPPROTO_EON);
+ PyModule_AddIntMacro(m, IPPROTO_EON);
#endif
#ifdef IPPROTO_PIM
- PyModule_AddIntConstant(m, "IPPROTO_PIM", IPPROTO_PIM);
+ PyModule_AddIntMacro(m, IPPROTO_PIM);
#endif
#ifdef IPPROTO_IPCOMP
- PyModule_AddIntConstant(m, "IPPROTO_IPCOMP", IPPROTO_IPCOMP);
+ PyModule_AddIntMacro(m, IPPROTO_IPCOMP);
#endif
#ifdef IPPROTO_VRRP
- PyModule_AddIntConstant(m, "IPPROTO_VRRP", IPPROTO_VRRP);
+ PyModule_AddIntMacro(m, IPPROTO_VRRP);
#endif
#ifdef IPPROTO_SCTP
- PyModule_AddIntConstant(m, "IPPROTO_SCTP", IPPROTO_SCTP);
+ PyModule_AddIntMacro(m, IPPROTO_SCTP);
#endif
#ifdef IPPROTO_BIP
- PyModule_AddIntConstant(m, "IPPROTO_BIP", IPPROTO_BIP);
+ PyModule_AddIntMacro(m, IPPROTO_BIP);
#endif
/**/
#ifdef IPPROTO_RAW
- PyModule_AddIntConstant(m, "IPPROTO_RAW", IPPROTO_RAW);
+ PyModule_AddIntMacro(m, IPPROTO_RAW);
#else
PyModule_AddIntConstant(m, "IPPROTO_RAW", 255);
#endif
#ifdef IPPROTO_MAX
- PyModule_AddIntConstant(m, "IPPROTO_MAX", IPPROTO_MAX);
+ PyModule_AddIntMacro(m, IPPROTO_MAX);
#endif
#ifdef SYSPROTO_CONTROL
- PyModule_AddIntConstant(m, "SYSPROTO_CONTROL", SYSPROTO_CONTROL);
+ PyModule_AddIntMacro(m, SYSPROTO_CONTROL);
#endif
/* Some port configuration */
#ifdef IPPORT_RESERVED
- PyModule_AddIntConstant(m, "IPPORT_RESERVED", IPPORT_RESERVED);
+ PyModule_AddIntMacro(m, IPPORT_RESERVED);
#else
PyModule_AddIntConstant(m, "IPPORT_RESERVED", 1024);
#endif
#ifdef IPPORT_USERRESERVED
- PyModule_AddIntConstant(m, "IPPORT_USERRESERVED", IPPORT_USERRESERVED);
+ PyModule_AddIntMacro(m, IPPORT_USERRESERVED);
#else
PyModule_AddIntConstant(m, "IPPORT_USERRESERVED", 5000);
#endif
/* Some reserved IP v.4 addresses */
#ifdef INADDR_ANY
- PyModule_AddIntConstant(m, "INADDR_ANY", INADDR_ANY);
+ PyModule_AddIntMacro(m, INADDR_ANY);
#else
PyModule_AddIntConstant(m, "INADDR_ANY", 0x00000000);
#endif
#ifdef INADDR_BROADCAST
- PyModule_AddIntConstant(m, "INADDR_BROADCAST", INADDR_BROADCAST);
+ PyModule_AddIntMacro(m, INADDR_BROADCAST);
#else
PyModule_AddIntConstant(m, "INADDR_BROADCAST", 0xffffffff);
#endif
#ifdef INADDR_LOOPBACK
- PyModule_AddIntConstant(m, "INADDR_LOOPBACK", INADDR_LOOPBACK);
+ PyModule_AddIntMacro(m, INADDR_LOOPBACK);
#else
PyModule_AddIntConstant(m, "INADDR_LOOPBACK", 0x7F000001);
#endif
#ifdef INADDR_UNSPEC_GROUP
- PyModule_AddIntConstant(m, "INADDR_UNSPEC_GROUP", INADDR_UNSPEC_GROUP);
+ PyModule_AddIntMacro(m, INADDR_UNSPEC_GROUP);
#else
PyModule_AddIntConstant(m, "INADDR_UNSPEC_GROUP", 0xe0000000);
#endif
@@ -6234,356 +6229,353 @@ PyInit__socket(void)
PyModule_AddIntConstant(m, "INADDR_ALLHOSTS_GROUP", 0xe0000001);
#endif
#ifdef INADDR_MAX_LOCAL_GROUP
- PyModule_AddIntConstant(m, "INADDR_MAX_LOCAL_GROUP",
- INADDR_MAX_LOCAL_GROUP);
+ PyModule_AddIntMacro(m, INADDR_MAX_LOCAL_GROUP);
#else
PyModule_AddIntConstant(m, "INADDR_MAX_LOCAL_GROUP", 0xe00000ff);
#endif
#ifdef INADDR_NONE
- PyModule_AddIntConstant(m, "INADDR_NONE", INADDR_NONE);
+ PyModule_AddIntMacro(m, INADDR_NONE);
#else
PyModule_AddIntConstant(m, "INADDR_NONE", 0xffffffff);
#endif
/* IPv4 [gs]etsockopt options */
#ifdef IP_OPTIONS
- PyModule_AddIntConstant(m, "IP_OPTIONS", IP_OPTIONS);
+ PyModule_AddIntMacro(m, IP_OPTIONS);
#endif
#ifdef IP_HDRINCL
- PyModule_AddIntConstant(m, "IP_HDRINCL", IP_HDRINCL);
+ PyModule_AddIntMacro(m, IP_HDRINCL);
#endif
#ifdef IP_TOS
- PyModule_AddIntConstant(m, "IP_TOS", IP_TOS);
+ PyModule_AddIntMacro(m, IP_TOS);
#endif
#ifdef IP_TTL
- PyModule_AddIntConstant(m, "IP_TTL", IP_TTL);
+ PyModule_AddIntMacro(m, IP_TTL);
#endif
#ifdef IP_RECVOPTS
- PyModule_AddIntConstant(m, "IP_RECVOPTS", IP_RECVOPTS);
+ PyModule_AddIntMacro(m, IP_RECVOPTS);
#endif
#ifdef IP_RECVRETOPTS
- PyModule_AddIntConstant(m, "IP_RECVRETOPTS", IP_RECVRETOPTS);
+ PyModule_AddIntMacro(m, IP_RECVRETOPTS);
#endif
#ifdef IP_RECVDSTADDR
- PyModule_AddIntConstant(m, "IP_RECVDSTADDR", IP_RECVDSTADDR);
+ PyModule_AddIntMacro(m, IP_RECVDSTADDR);
#endif
#ifdef IP_RETOPTS
- PyModule_AddIntConstant(m, "IP_RETOPTS", IP_RETOPTS);
+ PyModule_AddIntMacro(m, IP_RETOPTS);
#endif
#ifdef IP_MULTICAST_IF
- PyModule_AddIntConstant(m, "IP_MULTICAST_IF", IP_MULTICAST_IF);
+ PyModule_AddIntMacro(m, IP_MULTICAST_IF);
#endif
#ifdef IP_MULTICAST_TTL
- PyModule_AddIntConstant(m, "IP_MULTICAST_TTL", IP_MULTICAST_TTL);
+ PyModule_AddIntMacro(m, IP_MULTICAST_TTL);
#endif
#ifdef IP_MULTICAST_LOOP
- PyModule_AddIntConstant(m, "IP_MULTICAST_LOOP", IP_MULTICAST_LOOP);
+ PyModule_AddIntMacro(m, IP_MULTICAST_LOOP);
#endif
#ifdef IP_ADD_MEMBERSHIP
- PyModule_AddIntConstant(m, "IP_ADD_MEMBERSHIP", IP_ADD_MEMBERSHIP);
+ PyModule_AddIntMacro(m, IP_ADD_MEMBERSHIP);
#endif
#ifdef IP_DROP_MEMBERSHIP
- PyModule_AddIntConstant(m, "IP_DROP_MEMBERSHIP", IP_DROP_MEMBERSHIP);
+ PyModule_AddIntMacro(m, IP_DROP_MEMBERSHIP);
#endif
#ifdef IP_DEFAULT_MULTICAST_TTL
- PyModule_AddIntConstant(m, "IP_DEFAULT_MULTICAST_TTL",
- IP_DEFAULT_MULTICAST_TTL);
+ PyModule_AddIntMacro(m, IP_DEFAULT_MULTICAST_TTL);
#endif
#ifdef IP_DEFAULT_MULTICAST_LOOP
- PyModule_AddIntConstant(m, "IP_DEFAULT_MULTICAST_LOOP",
- IP_DEFAULT_MULTICAST_LOOP);
+ PyModule_AddIntMacro(m, IP_DEFAULT_MULTICAST_LOOP);
#endif
#ifdef IP_MAX_MEMBERSHIPS
- PyModule_AddIntConstant(m, "IP_MAX_MEMBERSHIPS", IP_MAX_MEMBERSHIPS);
+ PyModule_AddIntMacro(m, IP_MAX_MEMBERSHIPS);
#endif
#ifdef IP_TRANSPARENT
- PyModule_AddIntConstant(m, "IP_TRANSPARENT", IP_TRANSPARENT);
+ PyModule_AddIntMacro(m, IP_TRANSPARENT);
#endif
/* IPv6 [gs]etsockopt options, defined in RFC2553 */
#ifdef IPV6_JOIN_GROUP
- PyModule_AddIntConstant(m, "IPV6_JOIN_GROUP", IPV6_JOIN_GROUP);
+ PyModule_AddIntMacro(m, IPV6_JOIN_GROUP);
#endif
#ifdef IPV6_LEAVE_GROUP
- PyModule_AddIntConstant(m, "IPV6_LEAVE_GROUP", IPV6_LEAVE_GROUP);
+ PyModule_AddIntMacro(m, IPV6_LEAVE_GROUP);
#endif
#ifdef IPV6_MULTICAST_HOPS
- PyModule_AddIntConstant(m, "IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS);
+ PyModule_AddIntMacro(m, IPV6_MULTICAST_HOPS);
#endif
#ifdef IPV6_MULTICAST_IF
- PyModule_AddIntConstant(m, "IPV6_MULTICAST_IF", IPV6_MULTICAST_IF);
+ PyModule_AddIntMacro(m, IPV6_MULTICAST_IF);
#endif
#ifdef IPV6_MULTICAST_LOOP
- PyModule_AddIntConstant(m, "IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP);
+ PyModule_AddIntMacro(m, IPV6_MULTICAST_LOOP);
#endif
#ifdef IPV6_UNICAST_HOPS
- PyModule_AddIntConstant(m, "IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS);
+ PyModule_AddIntMacro(m, IPV6_UNICAST_HOPS);
#endif
/* Additional IPV6 socket options, defined in RFC 3493 */
#ifdef IPV6_V6ONLY
- PyModule_AddIntConstant(m, "IPV6_V6ONLY", IPV6_V6ONLY);
+ PyModule_AddIntMacro(m, IPV6_V6ONLY);
#endif
/* Advanced IPV6 socket options, from RFC 3542 */
#ifdef IPV6_CHECKSUM
- PyModule_AddIntConstant(m, "IPV6_CHECKSUM", IPV6_CHECKSUM);
+ PyModule_AddIntMacro(m, IPV6_CHECKSUM);
#endif
#ifdef IPV6_DONTFRAG
- PyModule_AddIntConstant(m, "IPV6_DONTFRAG", IPV6_DONTFRAG);
+ PyModule_AddIntMacro(m, IPV6_DONTFRAG);
#endif
#ifdef IPV6_DSTOPTS
- PyModule_AddIntConstant(m, "IPV6_DSTOPTS", IPV6_DSTOPTS);
+ PyModule_AddIntMacro(m, IPV6_DSTOPTS);
#endif
#ifdef IPV6_HOPLIMIT
- PyModule_AddIntConstant(m, "IPV6_HOPLIMIT", IPV6_HOPLIMIT);
+ PyModule_AddIntMacro(m, IPV6_HOPLIMIT);
#endif
#ifdef IPV6_HOPOPTS
- PyModule_AddIntConstant(m, "IPV6_HOPOPTS", IPV6_HOPOPTS);
+ PyModule_AddIntMacro(m, IPV6_HOPOPTS);
#endif
#ifdef IPV6_NEXTHOP
- PyModule_AddIntConstant(m, "IPV6_NEXTHOP", IPV6_NEXTHOP);
+ PyModule_AddIntMacro(m, IPV6_NEXTHOP);
#endif
#ifdef IPV6_PATHMTU
- PyModule_AddIntConstant(m, "IPV6_PATHMTU", IPV6_PATHMTU);
+ PyModule_AddIntMacro(m, IPV6_PATHMTU);
#endif
#ifdef IPV6_PKTINFO
- PyModule_AddIntConstant(m, "IPV6_PKTINFO", IPV6_PKTINFO);
+ PyModule_AddIntMacro(m, IPV6_PKTINFO);
#endif
#ifdef IPV6_RECVDSTOPTS
- PyModule_AddIntConstant(m, "IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS);
+ PyModule_AddIntMacro(m, IPV6_RECVDSTOPTS);
#endif
#ifdef IPV6_RECVHOPLIMIT
- PyModule_AddIntConstant(m, "IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT);
+ PyModule_AddIntMacro(m, IPV6_RECVHOPLIMIT);
#endif
#ifdef IPV6_RECVHOPOPTS
- PyModule_AddIntConstant(m, "IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS);
+ PyModule_AddIntMacro(m, IPV6_RECVHOPOPTS);
#endif
#ifdef IPV6_RECVPKTINFO
- PyModule_AddIntConstant(m, "IPV6_RECVPKTINFO", IPV6_RECVPKTINFO);
+ PyModule_AddIntMacro(m, IPV6_RECVPKTINFO);
#endif
#ifdef IPV6_RECVRTHDR
- PyModule_AddIntConstant(m, "IPV6_RECVRTHDR", IPV6_RECVRTHDR);
+ PyModule_AddIntMacro(m, IPV6_RECVRTHDR);
#endif
#ifdef IPV6_RECVTCLASS
- PyModule_AddIntConstant(m, "IPV6_RECVTCLASS", IPV6_RECVTCLASS);
+ PyModule_AddIntMacro(m, IPV6_RECVTCLASS);
#endif
#ifdef IPV6_RTHDR
- PyModule_AddIntConstant(m, "IPV6_RTHDR", IPV6_RTHDR);
+ PyModule_AddIntMacro(m, IPV6_RTHDR);
#endif
#ifdef IPV6_RTHDRDSTOPTS
- PyModule_AddIntConstant(m, "IPV6_RTHDRDSTOPTS", IPV6_RTHDRDSTOPTS);
+ PyModule_AddIntMacro(m, IPV6_RTHDRDSTOPTS);
#endif
#ifdef IPV6_RTHDR_TYPE_0
- PyModule_AddIntConstant(m, "IPV6_RTHDR_TYPE_0", IPV6_RTHDR_TYPE_0);
+ PyModule_AddIntMacro(m, IPV6_RTHDR_TYPE_0);
#endif
#ifdef IPV6_RECVPATHMTU
- PyModule_AddIntConstant(m, "IPV6_RECVPATHMTU", IPV6_RECVPATHMTU);
+ PyModule_AddIntMacro(m, IPV6_RECVPATHMTU);
#endif
#ifdef IPV6_TCLASS
- PyModule_AddIntConstant(m, "IPV6_TCLASS", IPV6_TCLASS);
+ PyModule_AddIntMacro(m, IPV6_TCLASS);
#endif
#ifdef IPV6_USE_MIN_MTU
- PyModule_AddIntConstant(m, "IPV6_USE_MIN_MTU", IPV6_USE_MIN_MTU);
+ PyModule_AddIntMacro(m, IPV6_USE_MIN_MTU);
#endif
/* TCP options */
#ifdef TCP_NODELAY
- PyModule_AddIntConstant(m, "TCP_NODELAY", TCP_NODELAY);
+ PyModule_AddIntMacro(m, TCP_NODELAY);
#endif
#ifdef TCP_MAXSEG
- PyModule_AddIntConstant(m, "TCP_MAXSEG", TCP_MAXSEG);
+ PyModule_AddIntMacro(m, TCP_MAXSEG);
#endif
#ifdef TCP_CORK
- PyModule_AddIntConstant(m, "TCP_CORK", TCP_CORK);
+ PyModule_AddIntMacro(m, TCP_CORK);
#endif
#ifdef TCP_KEEPIDLE
- PyModule_AddIntConstant(m, "TCP_KEEPIDLE", TCP_KEEPIDLE);
+ PyModule_AddIntMacro(m, TCP_KEEPIDLE);
#endif
#ifdef TCP_KEEPINTVL
- PyModule_AddIntConstant(m, "TCP_KEEPINTVL", TCP_KEEPINTVL);
+ PyModule_AddIntMacro(m, TCP_KEEPINTVL);
#endif
#ifdef TCP_KEEPCNT
- PyModule_AddIntConstant(m, "TCP_KEEPCNT", TCP_KEEPCNT);
+ PyModule_AddIntMacro(m, TCP_KEEPCNT);
#endif
#ifdef TCP_SYNCNT
- PyModule_AddIntConstant(m, "TCP_SYNCNT", TCP_SYNCNT);
+ PyModule_AddIntMacro(m, TCP_SYNCNT);
#endif
#ifdef TCP_LINGER2
- PyModule_AddIntConstant(m, "TCP_LINGER2", TCP_LINGER2);
+ PyModule_AddIntMacro(m, TCP_LINGER2);
#endif
#ifdef TCP_DEFER_ACCEPT
- PyModule_AddIntConstant(m, "TCP_DEFER_ACCEPT", TCP_DEFER_ACCEPT);
+ PyModule_AddIntMacro(m, TCP_DEFER_ACCEPT);
#endif
#ifdef TCP_WINDOW_CLAMP
- PyModule_AddIntConstant(m, "TCP_WINDOW_CLAMP", TCP_WINDOW_CLAMP);
+ PyModule_AddIntMacro(m, TCP_WINDOW_CLAMP);
#endif
#ifdef TCP_INFO
- PyModule_AddIntConstant(m, "TCP_INFO", TCP_INFO);
+ PyModule_AddIntMacro(m, TCP_INFO);
#endif
#ifdef TCP_QUICKACK
- PyModule_AddIntConstant(m, "TCP_QUICKACK", TCP_QUICKACK);
+ PyModule_AddIntMacro(m, TCP_QUICKACK);
#endif
#ifdef TCP_FASTOPEN
- PyModule_AddIntConstant(m, "TCP_FASTOPEN", TCP_FASTOPEN);
+ PyModule_AddIntMacro(m, TCP_FASTOPEN);
#endif
/* IPX options */
#ifdef IPX_TYPE
- PyModule_AddIntConstant(m, "IPX_TYPE", IPX_TYPE);
+ PyModule_AddIntMacro(m, IPX_TYPE);
#endif
/* Reliable Datagram Sockets */
#ifdef RDS_CMSG_RDMA_ARGS
- PyModule_AddIntConstant(m, "RDS_CMSG_RDMA_ARGS", RDS_CMSG_RDMA_ARGS);
+ PyModule_AddIntMacro(m, RDS_CMSG_RDMA_ARGS);
#endif
#ifdef RDS_CMSG_RDMA_DEST
- PyModule_AddIntConstant(m, "RDS_CMSG_RDMA_DEST", RDS_CMSG_RDMA_DEST);
+ PyModule_AddIntMacro(m, RDS_CMSG_RDMA_DEST);
#endif
#ifdef RDS_CMSG_RDMA_MAP
- PyModule_AddIntConstant(m, "RDS_CMSG_RDMA_MAP", RDS_CMSG_RDMA_MAP);
+ PyModule_AddIntMacro(m, RDS_CMSG_RDMA_MAP);
#endif
#ifdef RDS_CMSG_RDMA_STATUS
- PyModule_AddIntConstant(m, "RDS_CMSG_RDMA_STATUS", RDS_CMSG_RDMA_STATUS);
+ PyModule_AddIntMacro(m, RDS_CMSG_RDMA_STATUS);
#endif
#ifdef RDS_CMSG_RDMA_UPDATE
- PyModule_AddIntConstant(m, "RDS_CMSG_RDMA_UPDATE", RDS_CMSG_RDMA_UPDATE);
+ PyModule_AddIntMacro(m, RDS_CMSG_RDMA_UPDATE);
#endif
#ifdef RDS_RDMA_READWRITE
- PyModule_AddIntConstant(m, "RDS_RDMA_READWRITE", RDS_RDMA_READWRITE);
+ PyModule_AddIntMacro(m, RDS_RDMA_READWRITE);
#endif
#ifdef RDS_RDMA_FENCE
- PyModule_AddIntConstant(m, "RDS_RDMA_FENCE", RDS_RDMA_FENCE);
+ PyModule_AddIntMacro(m, RDS_RDMA_FENCE);
#endif
#ifdef RDS_RDMA_INVALIDATE
- PyModule_AddIntConstant(m, "RDS_RDMA_INVALIDATE", RDS_RDMA_INVALIDATE);
+ PyModule_AddIntMacro(m, RDS_RDMA_INVALIDATE);
#endif
#ifdef RDS_RDMA_USE_ONCE
- PyModule_AddIntConstant(m, "RDS_RDMA_USE_ONCE", RDS_RDMA_USE_ONCE);
+ PyModule_AddIntMacro(m, RDS_RDMA_USE_ONCE);
#endif
#ifdef RDS_RDMA_DONTWAIT
- PyModule_AddIntConstant(m, "RDS_RDMA_DONTWAIT", RDS_RDMA_DONTWAIT);
+ PyModule_AddIntMacro(m, RDS_RDMA_DONTWAIT);
#endif
#ifdef RDS_RDMA_NOTIFY_ME
- PyModule_AddIntConstant(m, "RDS_RDMA_NOTIFY_ME", RDS_RDMA_NOTIFY_ME);
+ PyModule_AddIntMacro(m, RDS_RDMA_NOTIFY_ME);
#endif
#ifdef RDS_RDMA_SILENT
- PyModule_AddIntConstant(m, "RDS_RDMA_SILENT", RDS_RDMA_SILENT);
+ PyModule_AddIntMacro(m, RDS_RDMA_SILENT);
#endif
/* get{addr,name}info parameters */
#ifdef EAI_ADDRFAMILY
- PyModule_AddIntConstant(m, "EAI_ADDRFAMILY", EAI_ADDRFAMILY);
+ PyModule_AddIntMacro(m, EAI_ADDRFAMILY);
#endif
#ifdef EAI_AGAIN
- PyModule_AddIntConstant(m, "EAI_AGAIN", EAI_AGAIN);
+ PyModule_AddIntMacro(m, EAI_AGAIN);
#endif
#ifdef EAI_BADFLAGS
- PyModule_AddIntConstant(m, "EAI_BADFLAGS", EAI_BADFLAGS);
+ PyModule_AddIntMacro(m, EAI_BADFLAGS);
#endif
#ifdef EAI_FAIL
- PyModule_AddIntConstant(m, "EAI_FAIL", EAI_FAIL);
+ PyModule_AddIntMacro(m, EAI_FAIL);
#endif
#ifdef EAI_FAMILY
- PyModule_AddIntConstant(m, "EAI_FAMILY", EAI_FAMILY);
+ PyModule_AddIntMacro(m, EAI_FAMILY);
#endif
#ifdef EAI_MEMORY
- PyModule_AddIntConstant(m, "EAI_MEMORY", EAI_MEMORY);
+ PyModule_AddIntMacro(m, EAI_MEMORY);
#endif
#ifdef EAI_NODATA
- PyModule_AddIntConstant(m, "EAI_NODATA", EAI_NODATA);
+ PyModule_AddIntMacro(m, EAI_NODATA);
#endif
#ifdef EAI_NONAME
- PyModule_AddIntConstant(m, "EAI_NONAME", EAI_NONAME);
+ PyModule_AddIntMacro(m, EAI_NONAME);
#endif
#ifdef EAI_OVERFLOW
- PyModule_AddIntConstant(m, "EAI_OVERFLOW", EAI_OVERFLOW);
+ PyModule_AddIntMacro(m, EAI_OVERFLOW);
#endif
#ifdef EAI_SERVICE
- PyModule_AddIntConstant(m, "EAI_SERVICE", EAI_SERVICE);
+ PyModule_AddIntMacro(m, EAI_SERVICE);
#endif
#ifdef EAI_SOCKTYPE
- PyModule_AddIntConstant(m, "EAI_SOCKTYPE", EAI_SOCKTYPE);
+ PyModule_AddIntMacro(m, EAI_SOCKTYPE);
#endif
#ifdef EAI_SYSTEM
- PyModule_AddIntConstant(m, "EAI_SYSTEM", EAI_SYSTEM);
+ PyModule_AddIntMacro(m, EAI_SYSTEM);
#endif
#ifdef EAI_BADHINTS
- PyModule_AddIntConstant(m, "EAI_BADHINTS", EAI_BADHINTS);
+ PyModule_AddIntMacro(m, EAI_BADHINTS);
#endif
#ifdef EAI_PROTOCOL
- PyModule_AddIntConstant(m, "EAI_PROTOCOL", EAI_PROTOCOL);
+ PyModule_AddIntMacro(m, EAI_PROTOCOL);
#endif
#ifdef EAI_MAX
- PyModule_AddIntConstant(m, "EAI_MAX", EAI_MAX);
+ PyModule_AddIntMacro(m, EAI_MAX);
#endif
#ifdef AI_PASSIVE
- PyModule_AddIntConstant(m, "AI_PASSIVE", AI_PASSIVE);
+ PyModule_AddIntMacro(m, AI_PASSIVE);
#endif
#ifdef AI_CANONNAME
- PyModule_AddIntConstant(m, "AI_CANONNAME", AI_CANONNAME);
+ PyModule_AddIntMacro(m, AI_CANONNAME);
#endif
#ifdef AI_NUMERICHOST
- PyModule_AddIntConstant(m, "AI_NUMERICHOST", AI_NUMERICHOST);
+ PyModule_AddIntMacro(m, AI_NUMERICHOST);
#endif
#ifdef AI_NUMERICSERV
- PyModule_AddIntConstant(m, "AI_NUMERICSERV", AI_NUMERICSERV);
+ PyModule_AddIntMacro(m, AI_NUMERICSERV);
#endif
#ifdef AI_MASK
- PyModule_AddIntConstant(m, "AI_MASK", AI_MASK);
+ PyModule_AddIntMacro(m, AI_MASK);
#endif
#ifdef AI_ALL
- PyModule_AddIntConstant(m, "AI_ALL", AI_ALL);
+ PyModule_AddIntMacro(m, AI_ALL);
#endif
#ifdef AI_V4MAPPED_CFG
- PyModule_AddIntConstant(m, "AI_V4MAPPED_CFG", AI_V4MAPPED_CFG);
+ PyModule_AddIntMacro(m, AI_V4MAPPED_CFG);
#endif
#ifdef AI_ADDRCONFIG
- PyModule_AddIntConstant(m, "AI_ADDRCONFIG", AI_ADDRCONFIG);
+ PyModule_AddIntMacro(m, AI_ADDRCONFIG);
#endif
#ifdef AI_V4MAPPED
- PyModule_AddIntConstant(m, "AI_V4MAPPED", AI_V4MAPPED);
+ PyModule_AddIntMacro(m, AI_V4MAPPED);
#endif
#ifdef AI_DEFAULT
- PyModule_AddIntConstant(m, "AI_DEFAULT", AI_DEFAULT);
+ PyModule_AddIntMacro(m, AI_DEFAULT);
#endif
#ifdef NI_MAXHOST
- PyModule_AddIntConstant(m, "NI_MAXHOST", NI_MAXHOST);
+ PyModule_AddIntMacro(m, NI_MAXHOST);
#endif
#ifdef NI_MAXSERV
- PyModule_AddIntConstant(m, "NI_MAXSERV", NI_MAXSERV);
+ PyModule_AddIntMacro(m, NI_MAXSERV);
#endif
#ifdef NI_NOFQDN
- PyModule_AddIntConstant(m, "NI_NOFQDN", NI_NOFQDN);
+ PyModule_AddIntMacro(m, NI_NOFQDN);
#endif
#ifdef NI_NUMERICHOST
- PyModule_AddIntConstant(m, "NI_NUMERICHOST", NI_NUMERICHOST);
+ PyModule_AddIntMacro(m, NI_NUMERICHOST);
#endif
#ifdef NI_NAMEREQD
- PyModule_AddIntConstant(m, "NI_NAMEREQD", NI_NAMEREQD);
+ PyModule_AddIntMacro(m, NI_NAMEREQD);
#endif
#ifdef NI_NUMERICSERV
- PyModule_AddIntConstant(m, "NI_NUMERICSERV", NI_NUMERICSERV);
+ PyModule_AddIntMacro(m, NI_NUMERICSERV);
#endif
#ifdef NI_DGRAM
- PyModule_AddIntConstant(m, "NI_DGRAM", NI_DGRAM);
+ PyModule_AddIntMacro(m, NI_DGRAM);
#endif
/* shutdown() parameters */
#ifdef SHUT_RD
- PyModule_AddIntConstant(m, "SHUT_RD", SHUT_RD);
+ PyModule_AddIntMacro(m, SHUT_RD);
#elif defined(SD_RECEIVE)
PyModule_AddIntConstant(m, "SHUT_RD", SD_RECEIVE);
#else
PyModule_AddIntConstant(m, "SHUT_RD", 0);
#endif
#ifdef SHUT_WR
- PyModule_AddIntConstant(m, "SHUT_WR", SHUT_WR);
+ PyModule_AddIntMacro(m, SHUT_WR);
#elif defined(SD_SEND)
PyModule_AddIntConstant(m, "SHUT_WR", SD_SEND);
#else
PyModule_AddIntConstant(m, "SHUT_WR", 1);
#endif
#ifdef SHUT_RDWR
- PyModule_AddIntConstant(m, "SHUT_RDWR", SHUT_RDWR);
+ PyModule_AddIntMacro(m, SHUT_RDWR);
#elif defined(SD_BOTH)
PyModule_AddIntConstant(m, "SHUT_RDWR", SD_BOTH);
#else
@@ -6603,14 +6595,14 @@ PyInit__socket(void)
PyModule_AddObject(m, names[i], tmp);
}
}
- PyModule_AddIntConstant(m, "RCVALL_OFF", RCVALL_OFF);
- PyModule_AddIntConstant(m, "RCVALL_ON", RCVALL_ON);
- PyModule_AddIntConstant(m, "RCVALL_SOCKETLEVELONLY", RCVALL_SOCKETLEVELONLY);
+ PyModule_AddIntMacro(m, RCVALL_OFF);
+ PyModule_AddIntMacro(m, RCVALL_ON);
+ PyModule_AddIntMacro(m, RCVALL_SOCKETLEVELONLY);
#ifdef RCVALL_IPLEVEL
- PyModule_AddIntConstant(m, "RCVALL_IPLEVEL", RCVALL_IPLEVEL);
+ PyModule_AddIntMacro(m, RCVALL_IPLEVEL);
#endif
#ifdef RCVALL_MAX
- PyModule_AddIntConstant(m, "RCVALL_MAX", RCVALL_MAX);
+ PyModule_AddIntMacro(m, RCVALL_MAX);
#endif
#endif /* _MSTCPIP_ */
diff --git a/Modules/symtablemodule.c b/Modules/symtablemodule.c
index 02a81f1..fbc1ff6 100644
--- a/Modules/symtablemodule.c
+++ b/Modules/symtablemodule.c
@@ -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);
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index 8b877cf..9d79eec 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -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;
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index b40e081..0b0d887 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -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_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, 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_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)