File tree 3 files changed +15
-5
lines changed
3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 11
11
12
12
setup (name = 'sbp_gen' ,
13
13
description = 'Generator for Swift Binary Protocol' ,
14
- long_description = open ('README.md' ).read (),
14
+ long_description = open ('README.md' , 'rb' ).read (). decode ( 'utf8' ),
15
15
version = '0.10' ,
16
16
author = 'Swift Navigation' ,
17
17
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ def _next_conventional(self):
134
134
if self ._broken :
135
135
raise StopIteration
136
136
137
+ line = ''
137
138
try :
138
139
line = self .handle .readline ()
139
140
@@ -147,13 +148,22 @@ def _next_conventional(self):
147
148
# Try next line, can lead to RecursionError if source is full of rubbish
148
149
return self ._next_conventional ()
149
150
150
- def _next_legacy (self ):
151
+ def _next_legacy_inner (self ):
152
+ line = ''
151
153
for line in self .handle :
152
154
try :
153
155
yield self ._extract_data (line )
154
156
except (ValueError , UnicodeDecodeError ):
155
- warn = "Bad JSON decoding for line %s" % line
157
+ warn = "Bad JSON decoding for line %s" % ( line ,)
156
158
warnings .warn (warn , RuntimeWarning )
159
+
160
+ def _next_legacy (self ):
161
+ try :
162
+ for line in self ._next_legacy_inner ():
163
+ yield line
164
+ except (ValueError , UnicodeDecodeError ):
165
+ warn = "Bad JSON decoding"
166
+ warnings .warn (warn , RuntimeWarning )
157
167
self .handle .seek (0 , 0 )
158
168
159
169
def __next__ (self ):
Original file line number Diff line number Diff line change @@ -163,8 +163,8 @@ def exclude_jit_libs(lib):
163
163
164
164
if __name__ == "__main__" :
165
165
166
- with open (os .path .join (setup_py_dir , 'README.rst' )) as f :
167
- readme = f .read ()
166
+ with open (os .path .join (setup_py_dir , 'README.rst' ), 'rb' ) as f :
167
+ readme = f .read (). decode ( 'utf8' )
168
168
169
169
write_version_py ()
170
170
You can’t perform that action at this time.
0 commit comments