Skip to content

Commit

Permalink
properly restoring locale to fix #169
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Mar 27, 2021
1 parent 85f5732 commit 4dac446
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions stl/_speedups.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def ascii_read(fh, buf):
cdef locale_t new_locale = newlocale(LC_NUMERIC_MASK, 'C',
<locale_t>NULL)
cdef locale_t old_locale = uselocale(new_locale)
freelocale(new_locale)

try:
state.size = len(buf)
Expand Down Expand Up @@ -167,9 +166,9 @@ def ascii_read(fh, buf):
fclose(state.fp)
fh.seek(pos, SEEK_SET)

IF UNAME_SYSNAME == 'Linux':
uselocale(old_locale)
freelocale(old_locale)
IF UNAME_SYSNAME == 'Linux':
uselocale(old_locale)
freelocale(new_locale)


def ascii_write(fh, name, np.ndarray[Facet, mode = 'c', cast=True] arr):
Expand Down

0 comments on commit 4dac446

Please sign in to comment.