518 static PyObject *
519 pysetxattr(PyObject *self, PyObject *args)
520 {
521 PyObject *myarg, *res;
522 int nofollow = 0;
523 char *attrname = NULL;
524 char *buf = NULL;
525 Py_ssize_t bufsize;
526 int nret;
527 int flags = 0;
528 target_t tgt;
529
530 /* Parse the arguments */
531 if (!PyArg_ParseTuple(args, "Oetet#|bi", &myarg, NULL, &attrname,
when _PyArg_ParseTuple_SizeT() succeeds
taking False path
532 NULL, &buf, &bufsize, &flags, &nofollow))
533 return NULL;
534 if(!convertObj(myarg, &tgt, nofollow)) {
when considering value == (int)0 from xattr.c:534
taking True path
535 res = NULL;
536 goto freearg;
537 }
538
539 /* Set the attribute's value */
540 nret = _set_obj(&tgt, attrname, buf, bufsize, flags);
541
542 free_tgt(&tgt);
543
544 if(nret == -1) {
545 res = PyErr_SetFromErrno(PyExc_IOError);
546 goto freearg;
547 }
548
549 Py_INCREF(Py_None);
550 res = Py_None;
551
552 freearg:
553 PyMem_Free(attrname);
554 PyMem_Free(buf);
555
556 /* Return the result */
557 return res;
558 }
returning (PyObject*)NULL without setting an exception