py3: use correct __next__ method

I'm not sure why this is storing a seemingly unused method-wrapper
object, but it needs to use the correctly named one on python2/python3.
This commit is contained in:
Eli Schwartz 2019-05-09 10:37:43 -04:00
parent aa44bf1cd1
commit 457eea7407
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -31,7 +31,7 @@ from calibre.ebooks.oeb.polish.utils import extract, guess_type
from calibre.utils.logging import default_log from calibre.utils.logging import default_log
from calibre.utils.short_uuid import uuid4 from calibre.utils.short_uuid import uuid4
from polyglot.binary import as_base64_unicode as encode_component, from_base64_unicode as decode_component from polyglot.binary import as_base64_unicode as encode_component, from_base64_unicode as decode_component
from polyglot.builtins import iteritems, map, unicode_type from polyglot.builtins import iteritems, map, is_py3, unicode_type
from polyglot.urllib import quote, urlparse from polyglot.urllib import quote, urlparse
RENDER_VERSION = 1 RENDER_VERSION = 1
@ -501,6 +501,9 @@ def html_as_dict(root):
if child.tag.partition('}')[-1] not in ('head', 'body'): if child.tag.partition('}')[-1] not in ('head', 'body'):
root.remove(child) root.remove(child)
root.text = root.tail = None root.text = root.tail = None
if is_py3:
nsmap = defaultdict(count().__next__)
else:
nsmap = defaultdict(count().next) nsmap = defaultdict(count().next)
nsmap[XHTML_NS] nsmap[XHTML_NS]
tags = [serialize_elem(root, nsmap)] tags = [serialize_elem(root, nsmap)]