Fix #1807: Sphinx crashes in japanese indexing in some systems.

Modified to specify the C type, if directly using the libmecab.
This commit is contained in:
Natsuki Maruyama 2015-03-25 23:20:12 +09:00 committed by Takeshi KOMIYA
parent 24c42817ed
commit d0bc66da58
2 changed files with 7 additions and 1 deletions

View File

@ -39,6 +39,7 @@ Bugs fixed
* #1580: Fix paragraphs in longtable don't work in Latex output
* #1366: Fix centered image not centered in latex
* #1860: Fix man page using ``:samp:`` with braces - font doesn't reset
* #1610 Sphinx crashes in japanese indexing in some systems.
Release 1.3.3 (released Dec 2, 2015)
====================================

View File

@ -85,10 +85,15 @@ class MecabBinder(object):
dict = options.get('dict')
if dict:
param += ' -d %s' % dict
fs_enc = sys.getfilesystemencoding() or sys.getdefaultencoding()
self.ctypes_libmecab = ctypes.CDLL(libpath)
self.ctypes_libmecab.mecab_new2.argtypes = (ctypes.c_char_p,)
self.ctypes_libmecab.mecab_new2.restype = ctypes.c_void_p
self.ctypes_libmecab.mecab_sparse_tostr.argtypes = (ctypes.c_void_p, ctypes.c_char_p)
self.ctypes_libmecab.mecab_sparse_tostr.restype = ctypes.c_char_p
self.ctypes_mecab = self.ctypes_libmecab.mecab_new2(param)
self.ctypes_mecab = ctypes.c_void_p(self.ctypes_libmecab.mecab_new2(param.encode(fs_enc)))
def __del__(self):
if self.ctypes_libmecab: