diff options
author | Scott Maxwell <scott@codecobblers.com> | 2013-11-02 20:18:18 -0700 |
---|---|---|
committer | Scott Maxwell <scott@codecobblers.com> | 2013-11-02 20:19:04 -0700 |
commit | 7444a999931cddc1e61bb35270468aa45da2687e (patch) | |
tree | 1ac60cc2d3a949285e3a4917c05c19a6d03c775d /paramiko/primes.py | |
parent | 45e65b6e1eb47944a26e4349d41998844c155df5 (diff) | |
download | paramiko-7444a999931cddc1e61bb35270468aa45da2687e.tar.gz |
Fix some deprecation and resource warnings
Diffstat (limited to 'paramiko/primes.py')
-rw-r--r-- | paramiko/primes.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/paramiko/primes.py b/paramiko/primes.py index 4db6d52d..13ec52d0 100644 --- a/paramiko/primes.py +++ b/paramiko/primes.py @@ -114,15 +114,17 @@ class ModulusPack (object): """ self.pack = {} f = open(filename, 'r') - for line in f: - line = line.strip() - if (len(line) == 0) or (line[0] == '#'): - continue - try: - self._parse_modulus(line) - except: - continue - f.close() + try: + for line in f: + line = line.strip() + if (len(line) == 0) or (line[0] == '#'): + continue + try: + self._parse_modulus(line) + except: + continue + finally: + f.close() def get_modulus(self, min, prefer, max): bitsizes = sorted(self.pack.keys()) |