Commits

Georg Brandl  committed 494e673

Closes #862: Fix handling of ``-D`` and ``-A`` options on Python 3.

  • Participants
  • Parent commits a3ed930
  • Branches stable

Comments (0)

Files changed (2)

 
 * #864: Fix crash with some settings of :confval:`modindex_common_prefix`.
 
+* #862: Fix handling of ``-D`` and ``-A`` options on Python 3.
+
 
 Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway!
 ======================================================================

File sphinx/cmdline.py

 from sphinx.application import Sphinx
 from sphinx.util import Tee, format_exception_cut_frames, save_traceback
 from sphinx.util.console import red, nocolor, color_terminal
-from sphinx.util.pycompat import terminal_safe
+from sphinx.util.pycompat import terminal_safe, bytes
 
 
 def usage(argv, msg=None):
             try:
                 val = int(val)
             except ValueError:
-                if likely_encoding:
+                if likely_encoding and isinstance(val, bytes):
                     try:
                         val = val.decode(likely_encoding)
                     except UnicodeError:
             try:
                 val = int(val)
             except ValueError:
-                if likely_encoding:
+                if likely_encoding and isinstance(val, bytes):
                     try:
                         val = val.decode(likely_encoding)
                     except UnicodeError: