// eDebug("pipe in = %d, out = %d, err = %d", fd[0], fd[1], fd[2]);
// eDebug("pipe in = %d, out = %d, err = %d", fd[0], fd[1], fd[2]);
::fcntl(fd[1], F_SETFL, O_NONBLOCK);
::fcntl(fd[2], F_SETFL, O_NONBLOCK);
in = eSocketNotifier::create(eApp, fd[0], eSocketNotifier::Read|eSocketNotifier::Priority|eSocketNotifier::Hungup );
::fcntl(fd[1], F_SETFL, O_NONBLOCK);
::fcntl(fd[2], F_SETFL, O_NONBLOCK);
in = eSocketNotifier::create(eApp, fd[0], eSocketNotifier::Read|eSocketNotifier::Priority|eSocketNotifier::Hungup );
- if (PyArg_ParseTuple(args, "si", &data, &len))
- ;
- else
+ int ret = -1;
+ Py_ssize_t argc = PyTuple_Size(args);
+ if (argc > 1)
+ ret = PyArg_ParseTuple(args, "si", &data, &len);
+ else if (argc == 1)
- if (!PyArg_ParseTuple(args, "O", &ob) || !PyString_Check(ob))
- {
- PyErr_SetString(PyExc_TypeError,
- "1st arg must be a string, optionaly 2nd arg can be the string length");
- return NULL;
- }
- else
+ ret = !PyArg_ParseTuple(args, "O", &ob) || !PyString_Check(ob);
+ if (!ret)