bpo-40280: Address more test failures on Emscripten (GH-31050)

Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
Christian Heimes 2022-02-05 21:52:01 +02:00 committed by GitHub
parent 9d4161a60c
commit 96b344c2f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 227 additions and 49 deletions

View file

@ -2,6 +2,8 @@
preserve
[clinic start generated code]*/
#if defined(HAVE_GETRUSAGE)
PyDoc_STRVAR(resource_getrusage__doc__,
"getrusage($module, who, /)\n"
"--\n"
@ -29,6 +31,8 @@ exit:
return return_value;
}
#endif /* defined(HAVE_GETRUSAGE) */
PyDoc_STRVAR(resource_getrlimit__doc__,
"getrlimit($module, resource, /)\n"
"--\n"
@ -160,7 +164,11 @@ exit:
return return_value;
}
#ifndef RESOURCE_GETRUSAGE_METHODDEF
#define RESOURCE_GETRUSAGE_METHODDEF
#endif /* !defined(RESOURCE_GETRUSAGE_METHODDEF) */
#ifndef RESOURCE_PRLIMIT_METHODDEF
#define RESOURCE_PRLIMIT_METHODDEF
#endif /* !defined(RESOURCE_PRLIMIT_METHODDEF) */
/*[clinic end generated code: output=ad190fb33d647d1e input=a9049054013a1b77]*/
/*[clinic end generated code: output=9ce1886c129eb2f3 input=a9049054013a1b77]*/

View file

@ -881,7 +881,7 @@ fail:
#define _PyLong_FromDev PyLong_FromLongLong
#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV)
#if (defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV)) || defined(HAVE_DEVICE_MACROS)
static int
_Py_Dev_Converter(PyObject *obj, void *p)
{
@ -890,7 +890,7 @@ _Py_Dev_Converter(PyObject *obj, void *p)
return 0;
return 1;
}
#endif /* HAVE_MKNOD && HAVE_MAKEDEV */
#endif /* (HAVE_MKNOD && HAVE_MAKEDEV) || HAVE_DEVICE_MACROS */
#ifdef AT_FDCWD

View file

@ -78,6 +78,7 @@ get_resource_state(PyObject *module)
static struct PyModuleDef resourcemodule;
#ifdef HAVE_GETRUSAGE
/*[clinic input]
resource.getrusage
@ -134,6 +135,7 @@ resource_getrusage_impl(PyObject *module, int who)
return result;
}
#endif
static int
py2rlimit(PyObject *limits, struct rlimit *rl_out)

View file

@ -1282,7 +1282,7 @@ _PyTime_GetProcessTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
#endif
/* getrusage(RUSAGE_SELF) */
#if defined(HAVE_SYS_RESOURCE_H)
#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRUSAGE)
struct rusage ru;
if (getrusage(RUSAGE_SELF, &ru) == 0) {