Pull requests

#70 Declined
Repository
dahlia dahlia
Branch
default
Repository
birkenfeld birkenfeld
Branch
default

Ensure index words to be unicode.

Author
  1. Hong Minhee
Reviewers
Description

unicodedata.normalize() function takes only unicode for second argument, and index words are normalized using this function, so these should become unicode first.

Without this patch, it could raise:

Traceback (most recent call last):
  File "/.../sphinx/sphinx/cmdline.py", line 190, in main
    app.build(force_all, filenames)
  File "/.../sphinx/sphinx/application.py", line 204, in build
    self.builder.build_update()
  File "/.../sphinx/sphinx/builders/__init__.py", line 196, in build_update
    'out of date' % len(to_build))
  File "/.../sphinx/sphinx/builders/__init__.py", line 255, in build
    self.finish()
  File "/.../sphinx/sphinx/builders/html.py", line 438, in finish
    self.write_genindex()
  File "/.../sphinx/sphinx/builders/html.py", line 471, in write_genindex
    genindex = self.env.create_index(self)
  File "/.../sphinx/sphinx/environment.py", line 1655, in create_index
    newlist.sort(key=keyfunc)
  File "/.../sphinx/sphinx/environment.py", line 1650, in keyfunc
    lckey = unicodedata.normalize('NFD', entry[0].lower())
TypeError: argument 2 must be unicode

or:

Traceback (most recent call last):
  File "/.../sphinx/sphinx/cmdline.py", line 190, in main
    app.build(force_all, filenames)
  File "/.../sphinx/sphinx/application.py", line 204, in build
    self.builder.build_update()
  File "/.../sphinx/sphinx/builders/__init__.py", line 196, in build_update
    'out of date' % len(to_build))
  File "/.../sphinx/sphinx/builders/__init__.py", line 255, in build
    self.finish()
  File "/.../sphinx/sphinx/builders/html.py", line 438, in finish
    self.write_genindex()
  File "/.../sphinx/sphinx/builders/html.py", line 471, in write_genindex
    genindex = self.env.create_index(self)
  File "/.../sphinx/sphinx/environment.py", line 1700, in create_index
    for (key, group) in groupby(newlist, keyfunc2)]
  File "/.../sphinx/sphinx/environment.py", line 1693, in keyfunc2
    letter = unicodedata.normalize('NFD', k[0])[0].upper()
TypeError: argument 2 must be unicode

Thanks!

Comments (2)