597 static PyObject *
598 xattr_set(PyObject *self, PyObject *args, PyObject *keywds)
599 {
600 PyObject *myarg, *res;
601 int nofollow = 0;
602 char *attrname = NULL;
603 char *buf = NULL;
604 Py_ssize_t bufsize;
605 int nret;
606 int flags = 0;
607 target_t tgt;
608 char *ns = NULL;
609 char *newname;
610 const char *full_name;
611 static char *kwlist[] = {"item", "name", "value", "flags",
612 "nofollow", "namespace", NULL};
613
614 /* Parse the arguments */
615 if (!PyArg_ParseTupleAndKeywords(args, keywds, "Oetet#|iiz", kwlist,
when _PyArg_ParseTupleAndKeywords_SizeT() succeeds
taking False path
616 &myarg, NULL, &attrname, NULL,
617 &buf, &bufsize, &flags, &nofollow, &ns))
618 return NULL;
619 if(!convertObj(myarg, &tgt, nofollow)) {
when considering value == (int)0 from xattr.c:619
taking True path
620 res = NULL;
621 goto freearg;
622 }
623
624 full_name = merge_ns(ns, attrname, &newname);
625
626 /* Set the attribute's value */
627 nret = _set_obj(&tgt, full_name, buf, bufsize, flags);
628
629 if(newname != NULL)
630 PyMem_Free(newname);
631
632 free_tgt(&tgt);
633
634 if(nret == -1) {
635 res = PyErr_SetFromErrno(PyExc_IOError);
636 goto freearg;
637 }
638
639 Py_INCREF(Py_None);
640 res = Py_None;
641
642 freearg:
643 PyMem_Free(attrname);
644 PyMem_Free(buf);
645
646 /* Return the result */
647 return res;
648 }
returning (PyObject*)NULL without setting an exception