Message47545
Logged In: YES
user_id=1356214
Hmm, not me, but yes, socketmodule.c wraps its system calls
in Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS, and then
does its error checking. Here's a small function (from trunk):
static PyObject *
sock_connect(PySocketSockObject *s, PyObject *addro)
{
struct sockaddr *addr;
int addrlen;
int res;
int timeout;
if (!getsockaddrarg(s, addro, &addr, &addrlen))
return NULL;
Py_BEGIN_ALLOW_THREADS
res = internal_connect(s, addr, addrlen, &timeout);
Py_END_ALLOW_THREADS
if (timeout) {
PyErr_SetString(socket_timeout, "timed out");
return NULL;
}
if (res != 0)
return s->errorhandler();
Py_INCREF(Py_None);
return Py_None;
}
Note that both the check for timeout and also the
s->errorhandler() call (which defaults to set_error() and
probably pre-dates timeout) use errno, everywhere. If this
is wrong, I'll bring it up on python-dev.
Do you have an example of a properly-coded module? For
example, the first one I checked, fctlmodule.c, does it the
same way. |
|
| Date |
User |
Action |
Args |
| 2007-08-23 15:41:19 | admin | link | issue1102879 messages |
| 2007-08-23 15:41:19 | admin | create | |
|