{"action":"created","issue":{"url":"https://api.github.com/repos/ipython/ipython/issues/9181","labels_url":"https://api.github.com/repos/ipython/ipython/issues/9181/labels{/name}","comments_url":"https://api.github.com/repos/ipython/ipython/issues/9181/comments","events_url":"https://api.github.com/repos/ipython/ipython/issues/9181/events","html_url":"https://github.com/ipython/ipython/issues/9181","id":128980231,"number":9181,"title":"IPython.display.Image crash if passed invalid bytes","user":{"login":"Carreau","id":335567,"avatar_url":"https://avatars.githubusercontent.com/u/335567?v=3","gravatar_id":"","url":"https://api.github.com/users/Carreau","html_url":"https://github.com/Carreau","followers_url":"https://api.github.com/users/Carreau/followers","following_url":"https://api.github.com/users/Carreau/following{/other_user}","gists_url":"https://api.github.com/users/Carreau/gists{/gist_id}","starred_url":"https://api.github.com/users/Carreau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Carreau/subscriptions","organizations_url":"https://api.github.com/users/Carreau/orgs","repos_url":"https://api.github.com/users/Carreau/repos","events_url":"https://api.github.com/users/Carreau/events{/privacy}","received_events_url":"https://api.github.com/users/Carreau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-26T23:53:25Z","updated_at":"2016-01-27T14:59:13Z","closed_at":null,"body":"Used in notebook test suite for testing not tested in IPython.\r\n\r\n```\r\nImage(\"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB94BCRQnOqNu0b4AAAAKSURBVAjXY2AAAAACAAHiIbwzAAAAAElFTkSuQmCC\")\r\n```\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nAttributeError                            Traceback (most recent call last)\r\n<ipython-input-4-871bd9636d0c> in <module>()\r\n----> 1 Image(b\"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB94BCRQnOqNu0b4AAAAKSURBVAjXY2AAAAACAAHiIbwzAAAAAElFTkSuQmCC\".encode())\r\n\r\n/Users/bussonniermatthias/anaconda3/lib/python3.5/site-packages/IPython/core/display.py in __init__(self, data, url, filename, format, embed, width, height, retina, unconfined, metadata)\r\n    732                     format = self._FMT_JPEG\r\n    733\r\n--> 734         if format.lower() == 'jpg':\r\n    735             # jpg->jpeg\r\n    736             format = self._FMT_JPEG\r\n\r\nAttributeError: 'NoneType' object has no attribute 'lower'\r\n```\r\n\r\nProbably a bad logic to detect the format if `data` is `bytes`, we likely also need a Python2 special case"},"comment":{"url":"https://api.github.com/repos/ipython/ipython/issues/comments/175669327","html_url":"https://github.com/ipython/ipython/issues/9181#issuecomment-175669327","issue_url":"https://api.github.com/repos/ipython/ipython/issues/9181","id":175669327,"user":{"login":"minrk","id":151929,"avatar_url":"https://avatars.githubusercontent.com/u/151929?v=3","gravatar_id":"","url":"https://api.github.com/users/minrk","html_url":"https://github.com/minrk","followers_url":"https://api.github.com/users/minrk/followers","following_url":"https://api.github.com/users/minrk/following{/other_user}","gists_url":"https://api.github.com/users/minrk/gists{/gist_id}","starred_url":"https://api.github.com/users/minrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minrk/subscriptions","organizations_url":"https://api.github.com/users/minrk/orgs","repos_url":"https://api.github.com/users/minrk/repos","events_url":"https://api.github.com/users/minrk/events{/privacy}","received_events_url":"https://api.github.com/users/minrk/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T14:59:13Z","updated_at":"2016-01-27T14:59:13Z","body":"The bug here is only if it is passed *invalid* bytes, not bytes in general."}}