Commit 721af43c authored by Benjamin Peterson's avatar Benjamin Peterson

Merged revisions 77866-77867 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77866 | benjamin.peterson | 2010-01-30 17:26:05 -0600 (Sat, 30 Jan 2010) | 1 line

  move test outside WITH_THREAD section
........
  r77867 | benjamin.peterson | 2010-01-30 17:28:38 -0600 (Sat, 30 Jan 2010) | 1 line

  be robust against test being run over and over (such as -R)
........
parent 8550da7c
...@@ -1362,15 +1362,23 @@ raise_exception(PyObject *self, PyObject *args) ...@@ -1362,15 +1362,23 @@ raise_exception(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
#ifdef WITH_THREAD
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;
...@@ -1378,6 +1386,9 @@ test_datetime_capi(PyObject *self, PyObject *args) { ...@@ -1378,6 +1386,9 @@ test_datetime_capi(PyObject *self, PyObject *args) {
return NULL; return NULL;
} }
#ifdef WITH_THREAD
/* test_thread_state spawns a thread of its own, and that thread releases /* test_thread_state spawns a thread of its own, and that thread releases
* `thread_done` when it's finished. The driver code has to know when the * `thread_done` when it's finished. The driver code has to know when the
* thread finishes, because the thread uses a PyObject (the callable) that * thread finishes, because the thread uses a PyObject (the callable) that
......
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