[Python-checkins] (threads) Re: r58326 - in python/trunk: Doc/library/collections.rst Lib/collections.py Lib/test/test_collections.py Lib/test/test_deque.py Misc/NEWS Modules/_collectionsmodule.c
Jim Jewett
jimjjewett at gmail.com
Fri Oct 5 19:56:50 CEST 2007
Why did you remove all the Py_BEGIN_ALLOW_THREADS macros?
They seem to be around small constants, but are you sure the fp won't
be a blocked socket or something? Or is this a safety issue, to
prevent mutation?
-jJ
On 10/4/07, raymond.hettinger <python-checkins at python.org> wrote:
> @@ -652,9 +675,7 @@
> if (i != 0) {
> if (i < 0)
> return i;
> - Py_BEGIN_ALLOW_THREADS
> fputs("[...]", fp);
> - Py_END_ALLOW_THREADS
> return 0;
> }
>
> @@ -662,13 +683,9 @@
> if (it == NULL)
> return -1;
>
> - Py_BEGIN_ALLOW_THREADS
> fputs("deque([", fp);
> - Py_END_ALLOW_THREADS
> while ((item = PyIter_Next(it)) != NULL) {
> - Py_BEGIN_ALLOW_THREADS
> fputs(emit, fp);
> - Py_END_ALLOW_THREADS
> emit = separator;
> if (PyObject_Print(item, fp, 0) != 0) {
> Py_DECREF(item);
> @@ -682,9 +699,11 @@
> Py_DECREF(it);
> if (PyErr_Occurred())
> return -1;
> - Py_BEGIN_ALLOW_THREADS
> - fputs("])", fp);
> - Py_END_ALLOW_THREADS
>
> @@ -1198,24 +1223,15 @@
> defdict_print(defdictobject *dd, FILE *fp, int flags)
> {
> int sts;
> - Py_BEGIN_ALLOW_THREADS
> fprintf(fp, "defaultdict(");
> - Py_END_ALLOW_THREADS
> - if (dd->default_factory == NULL) {
> - Py_BEGIN_ALLOW_THREADS
> + if (dd->default_factory == NULL)
> fprintf(fp, "None");
> - Py_END_ALLOW_THREADS
> - }
> else {
> PyObject_Print(dd->default_factory, fp, 0);
> }
> - Py_BEGIN_ALLOW_THREADS
> fprintf(fp, ", ");
> - Py_END_ALLOW_THREADS
> sts = PyDict_Type.tp_print((PyObject *)dd, fp, 0);
> - Py_BEGIN_ALLOW_THREADS
> fprintf(fp, ")");
> - Py_END_ALLOW_THREADS
> return sts;
> }
>
More information about the Python-checkins
mailing list