diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-24 22:27:39 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-24 22:27:39 (GMT) |
commit | 29ac3cb7eda5491074cff52d2c923bce62975986 (patch) | |
tree | fb48b212b0f63a5e842f177118ebd28ee9b488aa /Modules/resource.c | |
parent | 153cc0fddc33415c35a071d351442e5cb889b5d7 (diff) | |
download | cpython-29ac3cb7eda5491074cff52d2c923bce62975986.zip cpython-29ac3cb7eda5491074cff52d2c923bce62975986.tar.gz cpython-29ac3cb7eda5491074cff52d2c923bce62975986.tar.bz2 |
Expose RLIM_INFINITY constant. Closes SF patch 489066.
Diffstat (limited to 'Modules/resource.c')
-rw-r--r-- | Modules/resource.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/resource.c b/Modules/resource.c index 3d553b1..ecd992e 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -160,7 +160,7 @@ resource_methods[] = { DL_EXPORT(void) initresource(void) { - PyObject *m; + PyObject *m, *v; /* Create the module and add the functions */ m = Py_InitModule("resource", resource_methods); @@ -233,4 +233,16 @@ initresource(void) #ifdef RUSAGE_BOTH PyModule_AddIntConstant(m, "RUSAGE_BOTH", RUSAGE_BOTH); #endif + +#if defined(HAVE_LONG_LONG) + if (sizeof(RLIM_INFINITY) > sizeof(long)) { + v = PyLong_FromLongLong((LONG_LONG) RLIM_INFINITY); + } else +#endif + { + v = PyInt_FromLong((long) RLIM_INFINITY); + } + if (v) { + PyModule_AddObject(m, "RLIM_INFINITY", v); + } } |