Skip to content

Commit ad0903d

Browse files
committed
Fix generation of docstrings on Python 3
1 parent 49e528a commit ad0903d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

autogen/generator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ def write_method(self, function, cname, args, ret, cargs, file, doc, obsolete):
228228
given whenever this method is called
229229
"""
230230
doc = doc.replace("\n", "\n ") # Indent doc
231-
doc = doc.encode("utf-8")
231+
# doc is unicode, we want str => need to convert on Python 2
232+
if not isinstance(doc, str):
233+
doc = doc.encode("utf-8")
232234

233235
protoargs = ", ".join(a.prototype_code() for a in args)
234236
callargs = ", ".join(a.call_code() for a in cargs)

0 commit comments

Comments
 (0)