Skip to content

Commit

Permalink
Close open cursor files
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesej committed Mar 7, 2019
1 parent 736c2e9 commit 7f1ad92
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src_py/cursors.py
Expand Up @@ -255,10 +255,19 @@ def bitswap(num):
b = num&(1<<x) != 0
val = val<<1 | b
return val
if type(curs) is type(''): curs = open(curs)
if type(mask) is type(''): mask = open(mask)
curs = curs.readlines()
mask = mask.readlines()

if type(curs) is type(''):
with open(curs) as cursor_f:
curs = cursor_f.readlines()
else:
curs = curs.readlines()

if type(mask) is type(''):
with open(mask) as mask_f:
mask = mask_f.readlines()
else:
mask = mask.readlines()

#avoid comments
for line in range(len(curs)):
if curs[line].startswith("#define"):
Expand Down

0 comments on commit 7f1ad92

Please sign in to comment.