[pygobject] [gi] fix Gio.FileEnumerator to reflect the Python 3 iter protocol
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] [gi] fix Gio.FileEnumerator to reflect the Python 3 iter protocol
- Date: Wed, 26 Jan 2011 20:30:44 +0000 (UTC)
commit 843553ea958eddec185bb660851a310dc050a14b
Author: John (J5) Palmieri <johnp redhat com>
Date: Wed Jan 26 15:30:06 2011 -0500
[gi] fix Gio.FileEnumerator to reflect the Python 3 iter protocol
gi/overrides/Gio.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gi/overrides/Gio.py b/gi/overrides/Gio.py
index 880aea9..5a6af2f 100644
--- a/gi/overrides/Gio.py
+++ b/gi/overrides/Gio.py
@@ -29,7 +29,7 @@ class FileEnumerator(Gio.FileEnumerator):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
file_info = self.next_file(None)
if file_info is not None:
@@ -37,5 +37,9 @@ class FileEnumerator(Gio.FileEnumerator):
else:
raise StopIteration
+ # python 2 compat for the iter protocol
+ next = __next__
+
+
FileEnumerator = override(FileEnumerator)
__all__.append('FileEnumerator')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]