Georg Brandl avatar Georg Brandl committed 832b6ec

Restore Python 3 compatibility.

Comments (0)

Files changed (2)

sphinx/domains/cpp.py

     def __init__(self, description):
         self.description = description
 
+    def __str__(self):
+        return unicode(self).encode('utf-8')
+
     def __unicode__(self):
         return self.description
 
-    def __str__(self):
-        return unicode(self).encode('utf-8')
-
 
 class DefExpr(object):
 
-    def __unicode__(self):
-        raise NotImplementedError()
-
     def __eq__(self, other):
         if type(self) is not type(other):
             return False
     def __str__(self):
         return unicode(self).encode('utf-8')
 
+    def __unicode__(self):
+        raise NotImplementedError()
+
     def __repr__(self):
         return '<%s %s>' % (self.__class__.__name__, self)
 
     def get_id(self):
         return self.name.get_id()
 
-    def __unicode__(self, visibility='public'):
+    def _tostring(self, visibility='public'):
         buf = self.get_modifiers(visibility)
         buf.append(unicode(self.name))
         if self.bases:
             buf.append(u':')
-            buf.append(u', '.join(base.__unicode__('private')
+            buf.append(u', '.join(base._tostring('private')
                                   for base in self.bases))
         return u' '.join(buf)
 
+    def __unicode__(self):
+        return self._tostring('public')
 
 class DefinitionParser(object):
 

sphinx/writers/latex.py

 
     def idescape(self, id):
         return unicode(id).translate(tex_replace_map).\
-            encode('ascii', 'backslashreplace').replace('\\', '_')
+            encode('ascii', 'backslashreplace').decode('ascii').\
+            replace('\\', '_')
 
     def generate_indices(self):
         def generate(content, collapsed):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.