Browse Source

Replace bare 'except:' with 'except: Exception'

Otherwise we might inadvertently catch SystemExit or KeyboardExit or
something we don't want to catch.
tags/nilmdb-1.4.4
Jim Paris 8 years ago
parent
commit
3d24092cd2
6 changed files with 8 additions and 8 deletions
  1. +3
    -3
      nilmdb/server/bulkdata.py
  2. +1
    -1
      nilmdb/utils/mustclose.py
  3. +1
    -1
      setup.py
  4. +1
    -1
      tests/runtests.py
  5. +1
    -1
      tests/test_client.py
  6. +1
    -1
      tests/test_printf.py

+ 3
- 3
nilmdb/server/bulkdata.py View File

@@ -151,7 +151,7 @@ class BulkData(object):

# Open and cache it
self.getnode(unicodepath)
except:
except Exception:
exc_info = sys.exc_info()
try:
os.rmdir(ospath)
@@ -388,7 +388,7 @@ class Table(object):
# Try deleting subdir, too
try:
os.rmdir(os.path.join(self.root, subdir))
except:
except Exception:
pass

# Cache open files
@@ -521,7 +521,7 @@ class Table(object):
with open(cachefile, "rb") as f:
ranges = pickle.load(f)
cachefile_present = True
except:
except Exception:
ranges = []
cachefile_present = False



+ 1
- 1
nilmdb/utils/mustclose.py View File

@@ -15,7 +15,7 @@ def must_close(errorfile = sys.stderr, wrap_verify = False):
def wrap_class_method(wrapper):
try:
orig = getattr(cls, wrapper.__name__).im_func
except:
except Exception:
orig = lambda x: None
setattr(cls, wrapper.__name__, decorator.decorator(wrapper, orig))



+ 1
- 1
setup.py View File

@@ -39,7 +39,7 @@ versioneer.parentdir_prefix = 'nilmdb-'
# Hack to workaround logging/multiprocessing issue:
# https://groups.google.com/d/msg/nose-users/fnJ-kAUbYHQ/_UsLN786ygcJ
try: import multiprocessing
except: pass
except Exception: pass

# Use Cython if it's new enough, otherwise use preexisting C files.
cython_modules = [ 'nilmdb.server.interval',


+ 1
- 1
tests/runtests.py View File

@@ -24,7 +24,7 @@ class JimOrderPlugin(nose.plugins.Plugin):
name, workingDir=loader.workingDir)
try:
order = os.path.join(addr.filename, "test.order")
except:
except Exception:
order = None
if order and os.path.exists(order):
files = []


+ 1
- 1
tests/test_client.py View File

@@ -619,7 +619,7 @@ class TestClient(object):
poolmanager = c.http._last_response.connection.poolmanager
pool = poolmanager.pools[('http','localhost',32180)]
return (pool.num_connections, pool.num_requests)
except:
except Exception:
raise SkipTest("can't get connection info")

# First request makes a connection


+ 1
- 1
tests/test_printf.py View File

@@ -18,7 +18,7 @@ class TestPrintf(object):
printf("hello, world: %d", 123)
fprintf(test2, "hello too: %d", 123)
test3 = sprintf("hello three: %d", 123)
except:
except Exception:
sys.stdout = old_stdout
raise
sys.stdout = old_stdout


Loading…
Cancel
Save