+ if(!PY_CHECK_TYPE(self,&TagListClass)) {
+ PyErr_SetString(PyExc_Exception, setError("Not a taglist (%08x).", self));
+ return 0;
+ }
+ TagListObject*taglist = (TagListObject*)self;
+
+ /* TODO: the tags will be modified by this. We should set mutexes. */
+
+ int l = PyList_Size(taglist->taglist);
+ int t;
+ TAG* tag = 0;
+ TAG* firstTag = 0;
+ mylog(" %08x(%d) taglist_getTAGs", (int)self, self->ob_refcnt);
+ for(t=0;t<l;t++) {
+ PyObject*item = PyList_GetItem(taglist->taglist, t);
+ if(addDependencies) {
+ PyObject* deps = tag_getDependencies(item);
+ int l = PyList_Size(deps);
+ int t;
+ for(t=0;t<l;t++) {
+ PyObject*item = PyList_GetItem(deps, t);
+ if(tagmap_obj2id(tagmap, item)<0) {
+ /*PyObject*_self = taglist_concat(self, item);
+ Py_DECREF(self);
+ self = _self;*/
+ tag = tag_getTAG(item, tag, tagmap);
+ if(!tag) { return 0; }
+ if(!firstTag)
+ firstTag = tag;
+ }
+ }
+ }
+
+ tag = tag_getTAG(item, tag, tagmap);
+ if(!tag) { /* pass through errors */ return 0; }
+
+ if(!firstTag)
+ firstTag = tag;
+ }
+ return firstTag;