From a0ee71a81d53930fdba5a651bd359f7ef9869312 Mon Sep 17 00:00:00 2001 From: "Bora M. Alper" Date: Tue, 6 Jun 2017 12:58:01 +0300 Subject: [PATCH] fixes infinite-recursion error in bencode.py --- magneticod/magneticod/bencode.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/magneticod/magneticod/bencode.py b/magneticod/magneticod/bencode.py index 126af0c..4eb2d0c 100755 --- a/magneticod/magneticod/bencode.py +++ b/magneticod/magneticod/bencode.py @@ -20,7 +20,7 @@ Warning: import typing -from magneticod.bencoder import dumps, loads, loads2 +import magneticod.bencoder Types = typing.Union[int, bytes, list, "KRPCDict"] KRPCDict = typing.Dict[bytes, Types] @@ -28,14 +28,14 @@ KRPCDict = typing.Dict[bytes, Types] def dumps(obj) -> bytes: try: - return dumps(obj) + return magneticod.bencoder.dumps(obj) except: raise BencodeEncodingError() def loads(bytes_object: bytes) -> Types: try: - return loads(bytes_object) + return magneticod.bencoder.loads(bytes_object) except Exception as exc: raise BencodeDecodingError(exc) @@ -49,7 +49,7 @@ def loads2(bytes_object: bytes) -> typing.Tuple[Types, int]: print(">>>", dump[i:]) # OUTPUT: >>> b'OH YEAH' """ try: - return loads2(bytes_object) + return magneticod.bencoder.loads2(bytes_object) except Exception as exc: raise BencodeDecodingError(exc)