Show More
@@ -40,6 +40,7 b' from IPython.utils import py3compat' | |||
|
40 | 40 | from IPython.utils.text import indent |
|
41 | 41 | from IPython.utils.wildcard import list_namespace |
|
42 | 42 | from IPython.utils.coloransi import * |
|
43 | from IPython.utils.py3compat import cast_unicode | |
|
43 | 44 | |
|
44 | 45 | #**************************************************************************** |
|
45 | 46 | # Builtin color schemes |
@@ -144,7 +145,7 b' def getsource(obj,is_binary=False):' | |||
|
144 | 145 | except TypeError: |
|
145 | 146 | if hasattr(obj,'__class__'): |
|
146 | 147 | src = inspect.getsource(obj.__class__) |
|
147 | return src | |
|
148 | return cast_unicode(src) | |
|
148 | 149 | |
|
149 | 150 | def getargspec(obj): |
|
150 | 151 | """Get the names and default values of a function's arguments. |
@@ -320,9 +321,8 b' class Inspector:' | |||
|
320 | 321 | exception is suppressed.""" |
|
321 | 322 | |
|
322 | 323 | try: |
|
323 | # We need a plain string here, NOT unicode! | |
|
324 | 324 | hdef = oname + inspect.formatargspec(*getargspec(obj)) |
|
325 |
return |
|
|
325 | return cast_unicode(hdef) | |
|
326 | 326 | except: |
|
327 | 327 | return None |
|
328 | 328 | |
@@ -436,7 +436,7 b' class Inspector:' | |||
|
436 | 436 | except: |
|
437 | 437 | self.noinfo('source',oname) |
|
438 | 438 | else: |
|
439 |
page.page(self.format( |
|
|
439 | page.page(self.format(src)) | |
|
440 | 440 | |
|
441 | 441 | def pfile(self, obj, oname=''): |
|
442 | 442 | """Show the whole file where an object was defined.""" |
@@ -477,7 +477,7 b' class Inspector:' | |||
|
477 | 477 | title = header(title + ":") + "\n" |
|
478 | 478 | else: |
|
479 | 479 | title = header((title+":").ljust(title_width)) |
|
480 | out.append(title + content) | |
|
480 | out.append(cast_unicode(title) + cast_unicode(content)) | |
|
481 | 481 | return "\n".join(out) |
|
482 | 482 | |
|
483 | 483 | # The fields to be displayed by pinfo: (fancy_name, key_in_info_dict) |
@@ -537,7 +537,8 b' class Inspector:' | |||
|
537 | 537 | # Source or docstring, depending on detail level and whether |
|
538 | 538 | # source found. |
|
539 | 539 | if detail_level > 0 and info['source'] is not None: |
|
540 |
displayfields.append(("Source", |
|
|
540 | displayfields.append(("Source", | |
|
541 | self.format(cast_unicode(info['source'])))) | |
|
541 | 542 | elif info['docstring'] is not None: |
|
542 | 543 | displayfields.append(("Docstring", info["docstring"])) |
|
543 | 544 |
General Comments 0
You need to be logged in to leave comments.
Login now