mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix Sphinx crashes if mecab initialization failed
This commit is contained in:
parent
fe101177c3
commit
85a9e820dc
3
CHANGES
3
CHANGES
@ -39,7 +39,8 @@ Bugs fixed
|
|||||||
* #1580: Fix paragraphs in longtable don't work in Latex output
|
* #1580: Fix paragraphs in longtable don't work in Latex output
|
||||||
* #1366: Fix centered image not centered in latex
|
* #1366: Fix centered image not centered in latex
|
||||||
* #1860: Fix man page using ``:samp:`` with braces - font doesn't reset
|
* #1860: Fix man page using ``:samp:`` with braces - font doesn't reset
|
||||||
* #1610 Sphinx crashes in japanese indexing in some systems.
|
* #1610: Sphinx crashes in japanese indexing in some systems
|
||||||
|
* Fix Sphinx crashes if mecab initialization failed
|
||||||
|
|
||||||
Release 1.3.3 (released Dec 2, 2015)
|
Release 1.3.3 (released Dec 2, 2015)
|
||||||
====================================
|
====================================
|
||||||
|
@ -29,6 +29,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
native_module = False
|
native_module = False
|
||||||
|
|
||||||
|
from sphinx.errors import SphinxError
|
||||||
from sphinx.search import SearchLanguage
|
from sphinx.search import SearchLanguage
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +94,9 @@ class MecabBinder(object):
|
|||||||
self.ctypes_libmecab.mecab_new2.restype = ctypes.c_void_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.argtypes = (ctypes.c_void_p, ctypes.c_char_p)
|
||||||
self.ctypes_libmecab.mecab_sparse_tostr.restype = ctypes.c_char_p
|
self.ctypes_libmecab.mecab_sparse_tostr.restype = ctypes.c_char_p
|
||||||
self.ctypes_mecab = ctypes.c_void_p(self.ctypes_libmecab.mecab_new2(param.encode(fs_enc)))
|
self.ctypes_mecab = self.ctypes_libmecab.mecab_new2(param.encode(fs_enc))
|
||||||
|
if self.ctypes_mecab is None:
|
||||||
|
raise SphinxError('mecab initialization failed')
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.ctypes_libmecab:
|
if self.ctypes_libmecab:
|
||||||
|
Loading…
Reference in New Issue
Block a user