You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: class Test: pass
In [2]: Test.__module__ = None
In [4]: Test
Out[4]: ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-2205e48de5f9> in <module>()
----> 1 Test
/Users/aaronmeurer/Documents/ipython/IPython/core/displayhook.pyc in __call__(self, result)
236 self.start_displayhook()
237 self.write_output_prompt()
--> 238 format_dict = self.compute_format_data(result)
239 self.write_format_data(format_dict)
240 self.update_user_ns(result)
/Users/aaronmeurer/Documents/ipython/IPython/core/displayhook.pyc in compute_format_data(self, result)
148 MIME type representation of the object.
149 """
--> 150 return self.shell.display_formatter.format(result)
151
152 def write_format_data(self, format_dict):
/Users/aaronmeurer/Documents/ipython/IPython/core/formatters.pyc in format(self, obj, include, exclude)
124 continue
125 try:
--> 126 data = formatter(obj)
127 except:
128 # FIXME: log the exception
/Users/aaronmeurer/Documents/ipython/IPython/core/formatters.pyc in __call__(self, obj)
445 type_pprinters=self.type_printers,
446 deferred_pprinters=self.deferred_printers)
--> 447 printer.pretty(obj)
448 printer.flush()
449 return stream.getvalue()
/Users/aaronmeurer/Documents/ipython/IPython/lib/pretty.pyc in pretty(self, obj)
343 if cls in self.type_pprinters:
344 # printer registered in self.type_pprinters
--> 345 return self.type_pprinters[cls](obj, self, cycle)
346 else:
347 # deferred printer
/Users/aaronmeurer/Documents/ipython/IPython/lib/pretty.pyc in _type_pprint(obj, p, cycle)
612 name = obj.__name__
613 else:
--> 614 name = mod + '.' + obj.__name__
615 p.text(name)
616
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Setting __module__ to None is a way to make pickling work for dynamically defined classes in certain cases (see for example https://code.google.com/p/sympy/issues/detail?id=1198). The whichmodule function in the pickling module does a custom search for the module if __module__ is set to None.
The text was updated successfully, but these errors were encountered:
minrk
added a commit
to minrk/ipython
that referenced
this issue
May 29, 2013
Setting
__module__
to None is a way to make pickling work for dynamically defined classes in certain cases (see for example https://code.google.com/p/sympy/issues/detail?id=1198). Thewhichmodule
function in the pickling module does a custom search for the module if__module__
is set to None.The text was updated successfully, but these errors were encountered: