Merge lp:~ai-2/ijson/ptr-trunc into lp:~isagalaev/ijson/trunk

Proposed by a
Status: Merged
Merged at revision: 23
Proposed branch: lp:~ai-2/ijson/ptr-trunc
Merge into: lp:~isagalaev/ijson/trunk
Diff against target: 15 lines (+5/-1)
1 file modified
ijson/lib.py (+5/-1)
To merge this branch: bzr merge lp:~ai-2/ijson/ptr-trunc
Reviewer Review Type Date Requested Status
Ivan Sagalaev Pending
Review via email: mp+42350@code.launchpad.net

Description of the change

one change:

http://bazaar.launchpad.net/~ai/ijson/ptr-trunc/revision/23

was getting segfaults in yajl on x86_64. i think the ctype.cdll assumes int (32-bit?) return type and so pointer to yajl_handle were being truncated.

tests.py passes fedora 13 x86_64 w/python 2.6.

To post a comment you must log in.
Revision history for this message
Ivan Sagalaev (isagalaev) wrote :

We didn't get this error on 64-bit Ubuntu 8.04 so I suppose this may depend on the version of ctypes or python. But the change makes it more explicit anyway. Merged it in, thanks!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ijson/lib.py'
2--- ijson/lib.py 2010-08-26 09:21:54 +0000
3+++ ijson/lib.py 2010-12-01 11:48:44 +0000
4@@ -1,6 +1,10 @@
5-from ctypes import cdll, util
6+from ctypes import cdll, util, c_char, POINTER
7
8 name = util.find_library('yajl')
9 if name is None:
10 raise Exception('YAJL shared object not found.')
11 yajl = cdll.LoadLibrary(name)
12+
13+yajl.yajl_alloc.restype = POINTER(c_char)
14+yajl.yajl_gen_alloc.restype = POINTER(c_char)
15+yajl.yajl_gen_alloc2.restype = POINTER(c_char)

Subscribers

People subscribed via source and target branches

to all changes: