* Fix typing on mode string in CFile

This commit is contained in:
Matthew Honnibal 2015-07-23 13:24:43 +02:00
parent 22028602a9
commit b81ffe9032

View File

@ -2,7 +2,9 @@ from libc.stdio cimport fopen, fclose, fread, fwrite, FILE
cdef class CFile:
def __init__(self, loc, bytes mode):
def __init__(self, loc, mode):
if isinstance(mode, unicode):
mode_str = mode.decode('ascii')
cdef bytes bytes_loc = loc.encode('utf8') if type(loc) == unicode else loc
self.fp = fopen(<char*>bytes_loc, mode)
if self.fp == NULL: