[Python-checkins] r77867 - python/trunk/Modules/_testcapimodule.c
benjamin.peterson
python-checkins at python.org
Sun Jan 31 00:28:38 CET 2010
Author: benjamin.peterson
Date: Sun Jan 31 00:28:38 2010
New Revision: 77867
Log:
be robust against test being run over and over (such as -R)
Modified:
python/trunk/Modules/_testcapimodule.c
Modified: python/trunk/Modules/_testcapimodule.c
==============================================================================
--- python/trunk/Modules/_testcapimodule.c (original)
+++ python/trunk/Modules/_testcapimodule.c Sun Jan 31 00:28:38 2010
@@ -1144,13 +1144,23 @@
return NULL;
}
+
+static int test_run_counter = 0;
+
static PyObject *
test_datetime_capi(PyObject *self, PyObject *args) {
if (PyDateTimeAPI) {
- PyErr_SetString(PyExc_AssertionError,
- "PyDateTime_CAPI somehow initialized");
- return NULL;
+ if (test_run_counter) {
+ /* Probably regrtest.py -R */
+ Py_RETURN_NONE;
+ }
+ else {
+ PyErr_SetString(PyExc_AssertionError,
+ "PyDateTime_CAPI somehow initialized");
+ return NULL;
+ }
}
+ test_run_counter++;
PyDateTime_IMPORT;
if (PyDateTimeAPI)
Py_RETURN_NONE;
More information about the Python-checkins
mailing list