mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 01:37:31 +03:00 
			
		
		
		
	Fixed catching too broad exceptions
Also some flake8 cleanup in the lib dir.
This commit is contained in:
		
							parent
							
								
									fcc4cd6734
								
							
						
					
					
						commit
						8fec446789
					
				| 
						 | 
				
			
			@ -491,6 +491,7 @@ class NumberRangeAdapter(RangeAdapter):
 | 
			
		|||
        return ("'%s%s,%s%s'" % (
 | 
			
		||||
            r._bounds[0], lower, upper, r._bounds[1])).encode('ascii')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# TODO: probably won't work with infs, nans and other tricky cases.
 | 
			
		||||
register_adapter(NumericRange, NumberRangeAdapter)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,10 +30,7 @@ import sys as _sys
 | 
			
		|||
import time as _time
 | 
			
		||||
import re as _re
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    import logging as _logging
 | 
			
		||||
except:
 | 
			
		||||
    _logging = None
 | 
			
		||||
import logging as _logging
 | 
			
		||||
 | 
			
		||||
import psycopg2
 | 
			
		||||
from psycopg2 import extensions as _ext
 | 
			
		||||
| 
						 | 
				
			
			@ -189,7 +186,7 @@ class DictRow(list):
 | 
			
		|||
    def get(self, x, default=None):
 | 
			
		||||
        try:
 | 
			
		||||
            return self[x]
 | 
			
		||||
        except:
 | 
			
		||||
        except Exception:
 | 
			
		||||
            return default
 | 
			
		||||
 | 
			
		||||
    def iteritems(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -138,7 +138,7 @@ class AbstractConnectionPool(object):
 | 
			
		|||
        for conn in self._pool + list(self._used.values()):
 | 
			
		||||
            try:
 | 
			
		||||
                conn.close()
 | 
			
		||||
            except:
 | 
			
		||||
            except Exception:
 | 
			
		||||
                pass
 | 
			
		||||
        self.closed = True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user