Kaydet (Commit) 46bff79d authored tarafından Benjamin Peterson's avatar Benjamin Peterson

be robust against test being run over and over (such as -R)

üst a04ae012
...@@ -1144,13 +1144,23 @@ raise_exception(PyObject *self, PyObject *args) ...@@ -1144,13 +1144,23 @@ raise_exception(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
static int test_run_counter = 0;
static PyObject * static PyObject *
test_datetime_capi(PyObject *self, PyObject *args) { test_datetime_capi(PyObject *self, PyObject *args) {
if (PyDateTimeAPI) { if (PyDateTimeAPI) {
PyErr_SetString(PyExc_AssertionError, if (test_run_counter) {
"PyDateTime_CAPI somehow initialized"); /* Probably regrtest.py -R */
return NULL; Py_RETURN_NONE;
}
else {
PyErr_SetString(PyExc_AssertionError,
"PyDateTime_CAPI somehow initialized");
return NULL;
}
} }
test_run_counter++;
PyDateTime_IMPORT; PyDateTime_IMPORT;
if (PyDateTimeAPI) if (PyDateTimeAPI)
Py_RETURN_NONE; Py_RETURN_NONE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment