mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Conversion pipeline: Workaround for bug in lxml that causes a massive mem leak on windows and OS X when the input document contains non ASCII CSS selectors. Fixes #754555 (Private bug)
This commit is contained in:
parent
90a5a5ad41
commit
77df277db3
@ -97,6 +97,10 @@ class CSSSelector(etree.XPath):
|
|||||||
|
|
||||||
def __init__(self, css, namespaces=XPNSMAP):
|
def __init__(self, css, namespaces=XPNSMAP):
|
||||||
css = self.MIN_SPACE_RE.sub(r'\1', css)
|
css = self.MIN_SPACE_RE.sub(r'\1', css)
|
||||||
|
if isinstance(css, unicode):
|
||||||
|
# Workaround for bug in lxml on windows/OS X that causes a massive
|
||||||
|
# memory leak with non ASCII selectors
|
||||||
|
css = css.encode('ascii', 'ignore').decode('ascii')
|
||||||
try:
|
try:
|
||||||
path = css_to_xpath(css)
|
path = css_to_xpath(css)
|
||||||
except UnicodeEncodeError: # Bug in css_to_xpath
|
except UnicodeEncodeError: # Bug in css_to_xpath
|
||||||
|
@ -52,7 +52,7 @@ class RichTextDelegate(QStyledItemDelegate): # {{{
|
|||||||
painter.restore()
|
painter.restore()
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class ResultsModel(QAbstractTableModel):
|
class ResultsModel(QAbstractTableModel): # {{{
|
||||||
|
|
||||||
COLUMNS = (
|
COLUMNS = (
|
||||||
'#', _('Title'), _('Published'), _('Has cover'), _('Has summary')
|
'#', _('Title'), _('Published'), _('Has cover'), _('Has summary')
|
||||||
@ -128,7 +128,7 @@ class ResultsModel(QAbstractTableModel):
|
|||||||
self.results.sort(key=key, reverse=order==Qt.AscendingOrder)
|
self.results.sort(key=key, reverse=order==Qt.AscendingOrder)
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
|
# }}}
|
||||||
|
|
||||||
class ResultsView(QTableView): # {{{
|
class ResultsView(QTableView): # {{{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user