diff options
author | Michael Schroeder <mls@suse.de> | 2014-03-31 14:58:06 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2014-03-31 14:58:06 +0200 |
commit | 214203ca6cc97d91e3638b96bee00ee32977111e (patch) | |
tree | 95725c90eaee78a484a5da588d19e82caf4755b9 | |
parent | 18cc20cdc9fb4bfacfd5528b621ebd4d6d1cb095 (diff) | |
download | libsolv-214203ca6cc97d91e3638b96bee00ee32977111e.tar.gz libsolv-214203ca6cc97d91e3638b96bee00ee32977111e.tar.bz2 libsolv-214203ca6cc97d91e3638b96bee00ee32977111e.zip |
make the __iter__ methods in the python bindings return self
The old code returned a new iterator object, which broke
the skip_solvable method. I hope the new way does not break
anything.
-rw-r--r-- | bindings/solv.i | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/bindings/solv.i b/bindings/solv.i index bf46c08..54b6022 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -1734,12 +1734,8 @@ rb_eval_string( solv_free($self); } #if defined(SWIGPYTHON) - %newobject __iter__; - Dataiterator *__iter__() { - Dataiterator *ndi; - ndi = solv_calloc(1, sizeof(*ndi)); - dataiterator_init_clone(ndi, $self); - return ndi; + %pythoncode { + def __iter__(self): return self } #ifndef PYTHON3 %rename("next") __next__(); @@ -1971,12 +1967,8 @@ rb_eval_string( return s; } #if defined(SWIGPYTHON) - %newobject __iter__; - Pool_solvable_iterator *__iter__() { - Pool_solvable_iterator *s; - s = solv_calloc(1, sizeof(*s)); - *s = *$self; - return s; + %pythoncode { + def __iter__(self): return self } #ifndef PYTHON3 %rename("next") __next__(); @@ -2030,12 +2022,8 @@ rb_eval_string( return s; } #if defined(SWIGPYTHON) - %newobject __iter__; - Pool_repo_iterator *__iter__() { - Pool_repo_iterator *s; - s = solv_calloc(1, sizeof(*s)); - *s = *$self; - return s; + %pythoncode { + def __iter__(self): return self } #ifndef PYTHON3 %rename("next") __next__(); @@ -2090,12 +2078,8 @@ rb_eval_string( return s; } #if defined(SWIGPYTHON) - %newobject __iter__; - Repo_solvable_iterator *__iter__() { - Repo_solvable_iterator *s; - s = solv_calloc(1, sizeof(*s)); - *s = *$self; - return s; + %pythoncode { + def __iter__(self): return self } #ifndef PYTHON3 %rename("next") __next__(); |