From 0a12fb67bb6bca085fffbe6d438cc9b9bba68810 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iusty@k1024.org>
Date: Sun, 9 Mar 2008 11:12:53 +0100
Subject: [PATCH] Change return value of listxattr from tuple to list

A tuple doesn't make much sense - it was initially chosen because it a
tuple is read-only, but that is a bad reason to choose it. This patch
changes the return value to a list.
---
 xattr.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/xattr.c b/xattr.c
index a42b52f..25bc169 100644
--- a/xattr.c
+++ b/xattr.c
@@ -196,7 +196,7 @@ pyremovexattr(PyObject *self, PyObject *args)
 }
 
 static char __pylistxattr_doc__[] =
-    "Return the tuple of attribute names from a file\n"
+    "Return the list of attribute names for a file\n"
     "\n"
     "Parameters:\n"
     "\t- a string representing filename, or a file-like object,\n"
@@ -218,7 +218,7 @@ pylistxattr(PyObject *self, PyObject *args)
     int ishandle, dolink=0;
     int nalloc, nret;
     PyObject *myarg;
-    PyObject *mytuple;
+    PyObject *mylist;
     int nattrs;
     char *s;
 
@@ -261,12 +261,12 @@ pylistxattr(PyObject *self, PyObject *args)
         nattrs++;
     }
 
-    /* Create the tuple which will hold the result */
-    mytuple = PyTuple_New(nattrs);
+    /* Create the list which will hold the result */
+    mylist = PyList_New(nattrs);
 
-    /* Create and insert the attributes as strings in the tuple */
+    /* Create and insert the attributes as strings in the list */
     for(s = buf, nattrs = 0; s - buf < nret; s += strlen(s) + 1) {
-        PyTuple_SET_ITEM(mytuple, nattrs, PyString_FromString(s));
+        PyList_SET_ITEM(mylist, nattrs, PyString_FromString(s));
         nattrs++;
     }
 
@@ -274,7 +274,7 @@ pylistxattr(PyObject *self, PyObject *args)
     PyMem_Free(buf);
 
     /* Return the result */
-    return mytuple;
+    return mylist;
 }
 
 static PyMethodDef xattr_methods[] = {
-- 
2.39.5