Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29ac3cb

Browse files
committed
Expose RLIM_INFINITY constant. Closes SF patch 489066.
1 parent 153cc0f commit 29ac3cb

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Modules/resource.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ resource_methods[] = {
160160
DL_EXPORT(void)
161161
initresource(void)
162162
{
163-
PyObject *m;
163+
PyObject *m, *v;
164164

165165
/* Create the module and add the functions */
166166
m = Py_InitModule("resource", resource_methods);
@@ -233,4 +233,16 @@ initresource(void)
233233
#ifdef RUSAGE_BOTH
234234
PyModule_AddIntConstant(m, "RUSAGE_BOTH", RUSAGE_BOTH);
235235
#endif
236+
237+
#if defined(HAVE_LONG_LONG)
238+
if (sizeof(RLIM_INFINITY) > sizeof(long)) {
239+
v = PyLong_FromLongLong((LONG_LONG) RLIM_INFINITY);
240+
} else
241+
#endif
242+
{
243+
v = PyInt_FromLong((long) RLIM_INFINITY);
244+
}
245+
if (v) {
246+
PyModule_AddObject(m, "RLIM_INFINITY", v);
247+
}
236248
}

0 commit comments

Comments
 (0)