mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -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 *
|
static PyObject *
|
||||||
html_Tag_compare(html_Tag *a, html_Tag *b, int op) {
|
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) {
|
switch (op) {
|
||||||
case Py_EQ:
|
case Py_EQ:
|
||||||
if (COMPARE(name, Py_EQ) && COMPARE(lang, Py_EQ)) Py_RETURN_TRUE;
|
if (COMPARE(name, Py_EQ) && COMPARE(lang, Py_EQ)) Py_RETURN_TRUE;
|
||||||
@ -277,6 +278,7 @@ end:
|
|||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
html_State_compare(html_State *a, html_State *b, int op) {
|
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) {
|
switch (op) {
|
||||||
case Py_EQ:
|
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;
|
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
|
self.lang = lang
|
||||||
|
|
||||||
def __eq__(self, other):
|
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):
|
def copy(self):
|
||||||
ans = Tag(self.name, self.bold, self.italic, self.lang)
|
ans = Tag(self.name, self.bold, self.italic, self.lang)
|
||||||
@ -117,13 +120,16 @@ else:
|
|||||||
return ans
|
return ans
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return (
|
try:
|
||||||
self.parse == other.parse and
|
return (
|
||||||
self.sub_parser_state == other.sub_parser_state and
|
self.parse == other.parse and
|
||||||
self.tag_being_defined == other.tag_being_defined and
|
self.sub_parser_state == other.sub_parser_state and
|
||||||
self.attribute_name == other.attribute_name and
|
self.tag_being_defined == other.tag_being_defined and
|
||||||
self.tags == other.tags
|
self.attribute_name == other.attribute_name and
|
||||||
)
|
self.tags == other.tags
|
||||||
|
)
|
||||||
|
except AttributeError:
|
||||||
|
return False
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not self.__eq__(other)
|
return not self.__eq__(other)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user