{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/9781","labels_url":"https://api.github.com/repos/pydata/pandas/issues/9781/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9781/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/9781/events","html_url":"https://github.com/pydata/pandas/issues/9781","id":65768497,"number":9781,"title":"bug in dataframe.to_json causing segfault with 0.16.0","user":{"login":"nevermindewe","id":5727768,"avatar_url":"https://avatars.githubusercontent.com/u/5727768?v=3","gravatar_id":"","url":"https://api.github.com/users/nevermindewe","html_url":"https://github.com/nevermindewe","followers_url":"https://api.github.com/users/nevermindewe/followers","following_url":"https://api.github.com/users/nevermindewe/following{/other_user}","gists_url":"https://api.github.com/users/nevermindewe/gists{/gist_id}","starred_url":"https://api.github.com/users/nevermindewe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nevermindewe/subscriptions","organizations_url":"https://api.github.com/users/nevermindewe/orgs","repos_url":"https://api.github.com/users/nevermindewe/repos","events_url":"https://api.github.com/users/nevermindewe/events{/privacy}","received_events_url":"https://api.github.com/users/nevermindewe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/pydata/pandas/labels/JSON","name":"JSON","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/29","html_url":"https://github.com/pydata/pandas/milestones/0.16.1","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/29/labels","id":816810,"number":29,"title":"0.16.1","description":"after 0.16.0 of course!","creator":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"open_issues":95,"closed_issues":26,"state":"open","created_at":"2014-10-07T14:39:07Z","updated_at":"2015-04-03T22:42:19Z","due_on":"2015-04-30T07:00:00Z","closed_at":null},"comments":6,"created_at":"2015-04-01T20:06:37Z","updated_at":"2015-04-03T22:42:19Z","closed_at":"2015-04-03T22:42:19Z","body":"calling to_json on an apparently empty dataframe may segfault.\r\nusing the same dataframe with 0.15.2 works.\r\n\r\nA git bisect says that commit a67bef49e0b8e89e785c08011e8331e9eb7e54b8 is when the problem first appeared.\r\n\r\nsegfault:\r\nProgram terminated with signal SIGSEGV, Segmentation fault.\r\n#0  0x00007fd42aae8735 in PdBlock_iterBegin (_obj=0x7fd423d22410, tc=0x7fff1bf57310) at pandas/src/ujson/python/objToJSON.c:1057\r\n(gdb) list\r\n1052\t        // init a dedicated context for this column\r\n1053\t        NpyArr_iterBegin(obj, tc);\r\n1054\t        npyarr = GET_TC(tc)->npyarr;\r\n1055\t\r\n1056\t        // set the dataptr to our desired column and initialise\r\n1057\t        npyarr->dataptr += npyarr->stride * idx;\r\n1058\t        NpyArr_iterNext(obj, tc);\r\n1059\t        GET_TC(tc)->itemValue = NULL;\r\n1060\t        ((PyObjectEncoder*) tc->encoder)->npyCtxtPassthru = NULL;\r\n1061\t\r\n\r\n\r\nFollowing is the test code and ascii-pickle file that reproduces the behavior:\r\n```\r\nimport pickle\r\np = pickle.load(open(\"p.pkl\", \"rb\"))\r\np.to_json(\"/tmp/foo.json\", date_format='iso', orient='records')\r\n```\r\n\r\nbelow is the pickled dataframe that causes the problem.\r\n(I've been unable to construct another dataframe that exhibits this behavior)\r\n```\r\nccopy_reg\r\n_reconstructor\r\np0\r\n(cpandas.core.frame\r\nDataFrame\r\np1\r\nc__builtin__\r\nobject\r\np2\r\nNtp3\r\nRp4\r\ng0\r\n(cpandas.core.internals\r\nBlockManager\r\np5\r\ng2\r\nNtp6\r\nRp7\r\n((lp8\r\ncpandas.core.index\r\n_new_Index\r\np9\r\n(cpandas.core.index\r\nIndex\r\np10\r\n(dp11\r\nS'data'\r\np12\r\ncnumpy.core.multiarray\r\n_reconstruct\r\np13\r\n(cnumpy\r\nndarray\r\np14\r\n(I0\r\ntp15\r\nS'b'\r\np16\r\ntp17\r\nRp18\r\n(I1\r\n(I5\r\ntp19\r\ncnumpy\r\ndtype\r\np20\r\n(S'O8'\r\np21\r\nI0\r\nI1\r\ntp22\r\nRp23\r\n(I3\r\nS'|'\r\np24\r\nNNNI-1\r\nI-1\r\nI63\r\ntp25\r\nbI00\r\n(lp26\r\nS'symbol'\r\np27\r\naS'side'\r\np28\r\naS'shares'\r\np29\r\naS'entry_price'\r\np30\r\naS'entry_time'\r\np31\r\natp32\r\nbsS'name'\r\np33\r\nNstp34\r\nRp35\r\nag9\r\n(cpandas.core.index\r\nInt64Index\r\np36\r\n(dp37\r\ng12\r\ng13\r\n(g14\r\n(I0\r\ntp38\r\ng16\r\ntp39\r\nRp40\r\n(I1\r\n(I0\r\ntp41\r\ng20\r\n(S'i8'\r\np42\r\nI0\r\nI1\r\ntp43\r\nRp44\r\n(I3\r\nS'<'\r\np45\r\nNNNI-1\r\nI-1\r\nI0\r\ntp46\r\nbI00\r\nS''\r\np47\r\ntp48\r\nbsg33\r\nNstp49\r\nRp50\r\na(lp51\r\ng13\r\n(g14\r\n(I0\r\ntp52\r\ng16\r\ntp53\r\nRp54\r\n(I1\r\n(I3\r\nI0\r\ntp55\r\ng44\r\nI00\r\ng47\r\ntp56\r\nbag13\r\n(g14\r\n(I0\r\ntp57\r\ng16\r\ntp58\r\nRp59\r\n(I1\r\n(I2\r\nI0\r\ntp60\r\ng23\r\nI00\r\n(lp61\r\ntp62\r\nba(lp63\r\ng9\r\n(g10\r\n(dp64\r\ng12\r\ng13\r\n(g14\r\n(I0\r\ntp65\r\ng16\r\ntp66\r\nRp67\r\n(I1\r\n(I3\r\ntp68\r\ng23\r\nI00\r\n(lp69\r\ng28\r\nag29\r\nag31\r\natp70\r\nbsg33\r\nNstp71\r\nRp72\r\nag9\r\n(g10\r\n(dp73\r\ng12\r\ng13\r\n(g14\r\n(I0\r\ntp74\r\ng16\r\ntp75\r\nRp76\r\n(I1\r\n(I2\r\ntp77\r\ng23\r\nI00\r\n(lp78\r\ng27\r\nag30\r\natp79\r\nbsg33\r\nNstp80\r\nRp81\r\na(dp82\r\nS'0.14.1'\r\np83\r\n(dp84\r\nS'axes'\r\np85\r\ng8\r\nsS'blocks'\r\np86\r\n(lp87\r\n(dp88\r\nS'mgr_locs'\r\np89\r\ng13\r\n(g14\r\n(I0\r\ntp90\r\ng16\r\ntp91\r\nRp92\r\n(I1\r\n(I3\r\ntp93\r\ng44\r\nI00\r\nS'\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x04\\x00\\x00\\x00\\x00\\x00\\x00\\x00'\r\np94\r\ntp95\r\nbsS'values'\r\np96\r\ng54\r\nsa(dp97\r\ng89\r\nc__builtin__\r\nslice\r\np98\r\n(I0\r\nI6\r\nI3\r\ntp99\r\nRp100\r\nsg96\r\ng59\r\nsasstp101\r\nbb.\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/89439805","html_url":"https://github.com/pydata/pandas/issues/9781#issuecomment-89439805","issue_url":"https://api.github.com/repos/pydata/pandas/issues/9781","id":89439805,"user":{"login":"shoyer","id":1217238,"avatar_url":"https://avatars.githubusercontent.com/u/1217238?v=3","gravatar_id":"","url":"https://api.github.com/users/shoyer","html_url":"https://github.com/shoyer","followers_url":"https://api.github.com/users/shoyer/followers","following_url":"https://api.github.com/users/shoyer/following{/other_user}","gists_url":"https://api.github.com/users/shoyer/gists{/gist_id}","starred_url":"https://api.github.com/users/shoyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoyer/subscriptions","organizations_url":"https://api.github.com/users/shoyer/orgs","repos_url":"https://api.github.com/users/shoyer/repos","events_url":"https://api.github.com/users/shoyer/events{/privacy}","received_events_url":"https://api.github.com/users/shoyer/received_events","type":"User","site_admin":false},"created_at":"2015-04-03T22:42:19Z","updated_at":"2015-04-03T22:42:19Z","body":"Fixed by #9805."}}