Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instantiating classes without __init__ function causes kernel to crash #447

Closed
meawoppl opened this issue May 17, 2011 · 3 comments · Fixed by #449
Closed

Instantiating classes without __init__ function causes kernel to crash #447

meawoppl opened this issue May 17, 2011 · 3 comments · Fixed by #449
Assignees
Labels
Milestone

Comments

@meawoppl
Copy link

In [1]: class A(object): pass
In [2]: A()
Out[2]: <__main__.A at 0x924806c>
In [3]: class A(): pass
In [4]: A()

(Heartbeat down window)  Error trace:

AttributeError                            Traceback (most recent call last)
/media/Dropbox/git-repos/pypline/ in ()

/usr/local/lib/python2.6/dist-packages/IPython/zmq/ipkernel.pyc in main()
    679                                 shell=kernel.shell)
    680 
--> 681     start_kernel(namespace, kernel)
    682 
    683 

/usr/local/lib/python2.6/dist-packages/IPython/zmq/entry_point.pyc in start_kernel(namespace=Namespace(colors=None, hb=42345, ip='127.0.0.1',...ue, pub=39708, pylab=None, req=53755, xrep=54374), kernel=)
    148     # Start the kernel mainloop.
--> 149     kernel.start()

/usr/local/lib/python2.6/dist-packages/IPython/zmq/ipkernel.pyc in start(self=)
    169         while True:
    170             time.sleep(self._poll_interval)
--> 171             self.do_one_iteration()
        global stdin = undefined
        global stdout = undefined
        global stderr = undefined
        global optional = undefined
        global default = undefined
        global None = undefined
    172 
    173     def record_ports(self, xrep_port, pub_port, req_port, hb_port):

/usr/local/lib/python2.6/dist-packages/IPython/zmq/ipkernel.pyc in do_one_iteration(self=)
    153             logger.error("UNKNOWN MESSAGE TYPE:" +str(msg))
    154         else:
--> 155             handler(ident, msg)
    156             
    157         # Check whether we should exit, in case the incoming message set the

/usr/local/lib/python2.6/dist-packages/IPython/zmq/ipkernel.pyc in object_info_request(self=, ident='662dab72-d0d4-4ff0-af1c-7e1ca6439e55', parent={'content': {'oname': 'A'}, 'header': {'msg_id': 9, 'session': '662dab72-d0d4-4ff0-af1c-7e1ca6439e55', 'username': 'meawoppl'}, 'msg_type': 'object_info_request', 'parent_header': {}})
    318 
    319     def object_info_request(self, ident, parent):
--> 320         object_info = self.shell.object_inspect(parent['content']['oname'])
    321         # Before we send this object over, we scrub it for JSON usage
    322         oinfo = json_clean(object_info)

/usr/local/lib/python2.6/dist-packages/IPython/core/interactiveshell.pyc in object_inspect(self=, oname='A')
   1292             info = self._object_find(oname)
   1293             if info.found:
-> 1294                 return self.inspector.info(info.obj, oname, info=info)
   1295             else:
   1296                 return oinspect.object_info(name=oname, found=False)

/usr/local/lib/python2.6/dist-packages/IPython/core/oinspect.pyc in info(self=, obj=, oname='A', formatter=None, info={'obj': , 'parent...se, 'namespace': 'Interactive', 'ismagic': False}, detail_level=0)
    815         
    816         if inspect.isclass(obj):
--> 817             callable_obj = obj.__init__
    818         elif callable(obj):
    819             callable_obj = obj
AttributeError: class A has no attribute '__init__'
@takluyver
Copy link
Member

OK, I see. New style classes always have an __init__ method, old style classes don't. I'll look at it.

@ghost ghost assigned takluyver May 17, 2011
takluyver added a commit to takluyver/ipython that referenced this issue May 17, 2011
@takluyver
Copy link
Member

Made pull request #449

@takluyver
Copy link
Member

Merged the fix, see commit 12af0e2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants