Commits

Sebastian Ramacher committed 8162d69 Merge

Merging bugfixes from 0.10-bugfix.

Comments (0)

Files changed (4)

             self.c = c
 
         if s:
+            if not py3 and isinstance(s, unicode):
+                s = s.encode(getpreferredencoding())
+
             if self.c:
                 self.win.addstr(s, self.c)
             else:

bpython/inspection.py

     # not take 'self', the latter would:
     func_name = getattr(f, '__name__', None)
 
-    is_bound_method = ((inspect.ismethod(f) and f.im_self is not None)
+    try:
+        is_bound_method = ((inspect.ismethod(f) and f.im_self is not None)
                     or (func_name == '__init__' and not
                         func.endswith('.__init__')))
+    except:
+        # if f is a method from a xmlrpclib.Server instance, func_name ==
+        # '__init__' throws xmlrpclib.Fault (see #202)
+        return None
     try:
         if py3:
             argspec = inspect.getfullargspec(f)
             self.interact.notify("Pastebin aborted")
             return
 
-        pasteservice = ServerProxy(self.config.pastebin_url)
+        try:
+            pasteservice = ServerProxy(self.config.pastebin_url)
+        except IOError, e:
+            self.interact.notify("Pastebin error for URL '%s': %s" %
+                                 (self.config.pastebin_url, str(e)))
+            return
 
         if s == self.prev_pastebin_content:
             self.interact.notify('Duplicate pastebin. Previous URL: ' +
     cmdclass['extract_messages'] = extract_messages
 
 
-if platform.system() == 'FreeBSD':
+if platform.system() in ['FreeBSD', 'OpenBSD']:
     man_dir = 'man'
 else:
     man_dir = 'share/man'