summaryrefslogtreecommitdiffstats
path: root/generic/tclFCmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclFCmd.c')
-rw-r--r--generic/tclFCmd.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index 33c1496..13377d3 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -734,17 +734,14 @@ CopyRenameOneFile(
*/
errfile = target;
-
- /*
- * We now need to reset the result, because the above call, if it
- * failed, may have put an error message in place. (Ideally we
- * would prefer not to pass an interpreter in above, but the
- * channel IO code used by TclCrossFilesystemCopy currently
- * requires one).
- */
-
- Tcl_ResetResult(interp);
}
+ /*
+ * We now need to reset the result, because the above call,
+ * may have left set it. (Ideally we would prefer not to pass
+ * an interpreter in above, but the channel IO code used by
+ * TclCrossFilesystemCopy currently requires one)
+ */
+ Tcl_ResetResult(interp);
}
if ((copyFlag == 0) && (result == TCL_OK)) {
if (S_ISDIR(sourceStatBuf.st_mode)) {
t will cause the current\n\ thread to exit silently unless the exception is caught."; #ifndef NO_EXIT_PROG static PyObject * thread_PyThread_exit_prog(PyObject *self, PyObject *args) { int sts; if (!PyArg_Parse(args, "i", &sts)) return NULL; Py_Exit(sts); /* Calls PyThread_exit_prog(sts) or _PyThread_exit_prog(sts) */ for (;;) { } /* Should not be reached */ } #endif static PyObject * thread_PyThread_allocate_lock(PyObject *self, PyObject *args) { if (!PyArg_NoArgs(args)) return NULL; return (PyObject *) newlockobject(); } static char allocate_doc[] = "allocate_lock() -> lock object\n\ (allocate() is an obsolete synonym)\n\ \n\ Create a new lock object. See LockType.__doc__ for information about locks."; static PyObject * thread_get_ident(PyObject *self, PyObject *args) { long ident; if (!PyArg_NoArgs(args)) return NULL; ident = PyThread_get_thread_ident(); if (ident == -1) { PyErr_SetString(ThreadError, "no current thread ident"); return NULL; } return PyInt_FromLong(ident); } static char get_ident_doc[] = "get_ident() -> integer\n\ \n\ Return a non-zero integer that uniquely identifies the current thread\n\ amongst other threads that exist simultaneously.\n\ This may be used to identify per-thread resources.\n\ Even though on some platforms threads identities may appear to be\n\ allocated consecutive numbers starting at 1, this behavior should not\n\ be relied upon, and the number should be seen purely as a magic cookie.\n\ A thread's identity may be reused for another thread after it exits."; static PyMethodDef thread_methods[] = { {"start_new_thread", (PyCFunction)thread_PyThread_start_new_thread, METH_VARARGS, start_new_doc}, {"start_new", (PyCFunction)thread_PyThread_start_new_thread, METH_VARARGS, start_new_doc}, {"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock, METH_OLDARGS, allocate_doc}, {"allocate", (PyCFunction)thread_PyThread_allocate_lock, METH_OLDARGS, allocate_doc}, {"exit_thread", (PyCFunction)thread_PyThread_exit_thread, METH_OLDARGS, exit_doc}, {"exit", (PyCFunction)thread_PyThread_exit_thread, METH_OLDARGS, exit_doc}, {"get_ident", (PyCFunction)thread_get_ident, METH_OLDARGS, get_ident_doc}, #ifndef NO_EXIT_PROG {"exit_prog", (PyCFunction)thread_PyThread_exit_prog}, #endif {NULL, NULL} /* sentinel */ }; /* Initialization function */ static char thread_doc[] = "This module provides primitive operations to write multi-threaded programs.\n\ The 'threading' module provides a more convenient interface."; static char lock_doc[] = "A lock object is a synchronization primitive. To create a lock,\n\ call the PyThread_allocate_lock() function. Methods are:\n\ \n\ acquire() -- lock the lock, possibly blocking until it can be obtained\n\ release() -- unlock of the lock\n\ locked() -- test whether the lock is currently locked\n\ \n\ A lock is not owned by the thread that locked it; another thread may\n\ unlock it. A thread attempting to lock a lock that it has already locked\n\ will block until another thread unlocks it. Deadlocks may ensue."; DL_EXPORT(void) initthread(void) { PyObject *m, *d; /* Create the module and add the functions */ m = Py_InitModule3("thread", thread_methods, thread_doc); /* Add a symbolic constant */ d = PyModule_GetDict(m); ThreadError = PyErr_NewException("thread.error", NULL, NULL); PyDict_SetItemString(d, "error", ThreadError); Locktype.tp_doc = lock_doc; Py_INCREF(&Locktype); PyDict_SetItemString(d, "LockType", (PyObject *)&Locktype); /* Initialize the C thread library */ PyThread_init_thread(); }