Skip to content

Commit

Permalink
Merge pull request #10 from yukota/fix-exception_in_mutithread
Browse files Browse the repository at this point in the history
Fix exception in multithread environment
  • Loading branch information
polm authored Mar 31, 2021
2 parents 6f985e2 + 6d5035f commit 0463aa8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions posuto/posuto.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
def get(self, code):
return get(code, self._db)

def _fetch_code(code, db=DB):
def _fetch_code(code, db):
db.execute("select data from postal_data where code = ?", (code,))
res = db.fetchone()
if res:
Expand Down Expand Up @@ -72,7 +72,7 @@ def get(code, db=DB):
are not handled.
"""
code = re.sub('[- 〒]', '', code)
base = dict(_fetch_code(code))
base = dict(_fetch_code(code, db))
# if it's a postal code...
if 'prefecture_kana' in base:
# now make it a named tuple
Expand Down

0 comments on commit 0463aa8

Please sign in to comment.