mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-20 17:52:50 +00:00
hush somewhat-real problems found by static analysis
These would have caused problems if a certain unlikely code path was taken: mostly error-handling pathways.
This commit is contained in:
parent
da4e7dcfbe
commit
5e62118e14
@ -62,7 +62,7 @@ def check_loop(ast, results):
|
|||||||
# contains another 'for' loop.
|
# contains another 'for' loop.
|
||||||
childnodes = funcnode.getChildNodes()[len(funcnode.defaults):]
|
childnodes = funcnode.getChildNodes()[len(funcnode.defaults):]
|
||||||
for child in childnodes:
|
for child in childnodes:
|
||||||
check_ast(funcnode, results)
|
check_ast(child, results)
|
||||||
|
|
||||||
def collect_assigned_and_nested(ast, assigned, nested):
|
def collect_assigned_and_nested(ast, assigned, nested):
|
||||||
"""
|
"""
|
||||||
|
@ -243,7 +243,7 @@ class MagicFolder(service.MultiService):
|
|||||||
clock = clock or reactor
|
clock = clock or reactor
|
||||||
db = magicfolderdb.get_magicfolderdb(dbfile, create_version=(magicfolderdb.SCHEMA_v1, 1))
|
db = magicfolderdb.get_magicfolderdb(dbfile, create_version=(magicfolderdb.SCHEMA_v1, 1))
|
||||||
if db is None:
|
if db is None:
|
||||||
return Failure(Exception('ERROR: Unable to load magic folder db.'))
|
raise Exception('ERROR: Unable to load magic folder db.')
|
||||||
|
|
||||||
# for tests
|
# for tests
|
||||||
self._client = client
|
self._client = client
|
||||||
|
@ -32,7 +32,7 @@ class BadResponse(object):
|
|||||||
self.status = -1
|
self.status = -1
|
||||||
self.reason = "Error trying to connect to %s: %s" % (url, err)
|
self.reason = "Error trying to connect to %s: %s" % (url, err)
|
||||||
self.error = err
|
self.error = err
|
||||||
def read(self):
|
def read(self, length=0):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,10 +36,11 @@ class LogMixin(object):
|
|||||||
def log(self, msg, facility=None, parent=None, *args, **kwargs):
|
def log(self, msg, facility=None, parent=None, *args, **kwargs):
|
||||||
if facility is None:
|
if facility is None:
|
||||||
facility = self._facility
|
facility = self._facility
|
||||||
|
pmsgid = None
|
||||||
if parent is None:
|
if parent is None:
|
||||||
pmsgid = self._parentmsgid
|
pmsgid = self._parentmsgid
|
||||||
if pmsgid is None:
|
if pmsgid is None:
|
||||||
pmsgid = self._grandparentmsgid
|
pmsgid = self._grandparentmsgid
|
||||||
msgid = log.msg(msg, facility=facility, parent=pmsgid, *args, **kwargs)
|
msgid = log.msg(msg, facility=facility, parent=pmsgid, *args, **kwargs)
|
||||||
if self._parentmsgid is None:
|
if self._parentmsgid is None:
|
||||||
self._parentmsgid = msgid
|
self._parentmsgid = msgid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user