mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix #1333944 [Edit Book: Strange error when deleting style](https://bugs.launchpad.net/calibre/+bug/1333944)
This commit is contained in:
parent
70db763744
commit
1d88cbb7ff
@ -68,6 +68,7 @@ html_Tag_copy(html_Tag *self, PyObject *args, PyObject *kwargs) {
|
||||
|
||||
static PyObject *
|
||||
html_Tag_compare(html_Tag *a, html_Tag *b, int op) {
|
||||
if (!PyObject_TypeCheck(a, &html_TagType) || !PyObject_TypeCheck(b, &html_TagType)) Py_RETURN_FALSE;
|
||||
switch (op) {
|
||||
case Py_EQ:
|
||||
if (COMPARE(name, Py_EQ) && COMPARE(lang, Py_EQ)) Py_RETURN_TRUE;
|
||||
@ -277,6 +278,7 @@ end:
|
||||
|
||||
static PyObject *
|
||||
html_State_compare(html_State *a, html_State *b, int op) {
|
||||
if (!PyObject_TypeCheck(a, &html_StateType) || !PyObject_TypeCheck(b, &html_StateType)) Py_RETURN_FALSE;
|
||||
switch (op) {
|
||||
case Py_EQ:
|
||||
if (COMPARE(parse, Py_EQ) && COMPARE(sub_parser_state, Py_EQ) && COMPARE(tag_being_defined, Py_EQ) && COMPARE(attribute_name, Py_EQ) && COMPARE(tags, Py_EQ)) Py_RETURN_TRUE;
|
||||
|
@ -86,7 +86,10 @@ else:
|
||||
self.lang = lang
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.name == other.name and self.lang == other.lang
|
||||
try:
|
||||
return self.name == other.name and self.lang == other.lang
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
def copy(self):
|
||||
ans = Tag(self.name, self.bold, self.italic, self.lang)
|
||||
@ -117,13 +120,16 @@ else:
|
||||
return ans
|
||||
|
||||
def __eq__(self, other):
|
||||
return (
|
||||
self.parse == other.parse and
|
||||
self.sub_parser_state == other.sub_parser_state and
|
||||
self.tag_being_defined == other.tag_being_defined and
|
||||
self.attribute_name == other.attribute_name and
|
||||
self.tags == other.tags
|
||||
)
|
||||
try:
|
||||
return (
|
||||
self.parse == other.parse and
|
||||
self.sub_parser_state == other.sub_parser_state and
|
||||
self.tag_being_defined == other.tag_being_defined and
|
||||
self.attribute_name == other.attribute_name and
|
||||
self.tags == other.tags
|
||||
)
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
Loading…
x
Reference in New Issue
Block a user