Skip to content

Commit bc0fc98

Browse files
authored
fix pcap.Reader.next() compatibility Python 2-3 (#473)
1 parent 8b15bb7 commit bc0fc98

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

dpkt/pcap.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ def readpkts(self):
312312

313313
def __next__(self):
314314
return next(self.__iter)
315+
next = __next__ # Python 2 compat
315316

316317
def dispatch(self, cnt, callback, *args):
317318
"""Collect and process packets with a user callback.

dpkt/pcapng.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,9 @@ def setfilter(self, value, optimize=1):
589589
def readpkts(self):
590590
return list(self)
591591

592-
def next(self):
592+
def __next__(self):
593593
return next(self.__iter)
594+
next = __next__ # Python 2 compat
594595

595596
def dispatch(self, cnt, callback, *args):
596597
"""Collect and process packets with a user callback.

0 commit comments

Comments
 (0)