comparison Python/import.c @ 27853:5620b0786271 legacy-trunk

Cleanup from patch #683257: Add missing INCREFs and re-indent returns to be consistent. Add \n\ for lines in docstring Add a pathetic test Add docs
author Neal Norwitz <nnorwitz@gmail.com>
date Wed, 12 Feb 2003 23:02:21 +0000
parents 4b75a0b76857
children c346d095791d
comparison
equal deleted inserted replaced
27852:4b75a0b76857 27853:5620b0786271
303 if (!PyArg_ParseTuple(args, ":acquire_lock")) 303 if (!PyArg_ParseTuple(args, ":acquire_lock"))
304 return NULL; 304 return NULL;
305 #ifdef WITH_THREAD 305 #ifdef WITH_THREAD
306 lock_import(); 306 lock_import();
307 #endif 307 #endif
308 return Py_None; 308 Py_INCREF(Py_None);
309 return Py_None;
309 } 310 }
310 311
311 static PyObject * 312 static PyObject *
312 imp_release_lock(PyObject *self, PyObject *args) 313 imp_release_lock(PyObject *self, PyObject *args)
313 { 314 {
318 PyErr_SetString(PyExc_RuntimeError, 319 PyErr_SetString(PyExc_RuntimeError,
319 "not holding the import lock"); 320 "not holding the import lock");
320 return NULL; 321 return NULL;
321 } 322 }
322 #endif 323 #endif
323 return Py_None; 324 Py_INCREF(Py_None);
325 return Py_None;
324 } 326 }
325 327
326 /* Helper for sys */ 328 /* Helper for sys */
327 329
328 PyObject * 330 PyObject *
2776 Return 1 if the import lock is currently held.\n\ 2778 Return 1 if the import lock is currently held.\n\
2777 On platforms without threads, return 0."); 2779 On platforms without threads, return 0.");
2778 2780
2779 PyDoc_STRVAR(doc_acquire_lock, 2781 PyDoc_STRVAR(doc_acquire_lock,
2780 "acquire_lock() -> None\n\ 2782 "acquire_lock() -> None\n\
2781 Acquires the interpreter's import lock for the current thread. This lock 2783 Acquires the interpreter's import lock for the current thread.\n\
2782 should be used by import hooks to ensure thread-safety when importing modules. 2784 This lock should be used by import hooks to ensure thread-safety\n\
2785 when importing modules.\n\
2783 On platforms without threads, this function does nothing."); 2786 On platforms without threads, this function does nothing.");
2784 2787
2785 PyDoc_STRVAR(doc_release_lock, 2788 PyDoc_STRVAR(doc_release_lock,
2786 "release_lock() -> None\n\ 2789 "release_lock() -> None\n\
2787 Release the interpreter's import lock.\n\ 2790 Release the interpreter's import lock.\n\