Source: deluge Version: 1.3.3-2 Severity: normal Tags: upstream patch lintian4py reports amongst others the following issues on deluge:
e: deluge-common: except-shadows-builtin usr/share/pyshared/deluge/core/torrentmanager.py:589: ValueError e: deluge-gtk: except-shadows-builtin usr/share/pyshared/deluge/ui/gtkui/torrentview.py:496: TypeError From the tag's description: N: One error that Python programmers occasionally make is writing the N: following code: N: N: try: N: ... N: except TypeError, ValueError: # Wrong! N: ... N: N: The author is probably trying to catch both TypeError and ValueError N: exceptions, but this code actually does something different: it will N: catch TypeError and bind the resulting exception object to the local N: name ValueError. The ValueError exception will not be caught at all. N: The correct code specifies a tuple of exceptions: N: N: try: N: ... N: except (TypeError, ValueError): N: ... N: N: Refer to N: http://docs.python.org/whatsnew/2.6.html#pep-3110-exception-handling-c N: hanges for details. Please find attached a patch to fix the issue. Regards
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index a14e715..d5d1c83 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -586,7 +586,7 @@ class TorrentManager(component.Component): # Remove the torrent from deluge's session try: del self.torrents[torrent_id] - except KeyError, ValueError: + except (KeyError, ValueError): return False # Save the session state diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index e324d76..16c41d1 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -493,7 +493,7 @@ class TorrentView(listview.ListView, component.Component): return [] return torrent_ids - except ValueError, TypeError: + except (ValueError, TypeError): return [] def get_torrent_status(self, torrent_id):
signature.asc
Description: Digital signature