From d968f01245fbc527c2901040e4b1826aa1b0c41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=B4=E5=A8=83=E9=85=B1?= Date: Thu, 4 May 2017 10:56:14 +0800 Subject: [PATCH] parse comment var 'rows' not init before return --- db_transfer.py | 2 +- shadowsocks/asyncdns.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/db_transfer.py b/db_transfer.py index 0f3a7c9..2f10870 100644 --- a/db_transfer.py +++ b/db_transfer.py @@ -550,8 +550,8 @@ class Dbv3Transfer(DbTransfer): cur = conn.cursor() try: - cur.execute("SELECT " + ','.join(keys) + " FROM user") rows = [] + cur.execute("SELECT " + ','.join(keys) + " FROM user") for r in cur.fetchall(): d = {} for column in range(len(keys)): diff --git a/shadowsocks/asyncdns.py b/shadowsocks/asyncdns.py index 3f92e62..01f2522 100644 --- a/shadowsocks/asyncdns.py +++ b/shadowsocks/asyncdns.py @@ -331,6 +331,8 @@ class DNSResolver(object): with open(etc_path, 'rb') as f: for line in f.readlines(): line = line.strip() + if "#" in line: + line = line[:line.find('#')] parts = line.split() if len(parts) >= 2: ip = parts[0]