Python3 ready. Py2.7 and Py3 working. Drop PyCObject for all.

Pre Py2.7 support should be possible by including  "capsulethunk.h". (See llvm/wrap.h)
This commit is contained in:
Siu Kwan Lam 2012-07-26 15:25:23 -07:00
commit 9aadd489c3
14 changed files with 163 additions and 1142 deletions

View file

@ -25,5 +25,25 @@ class TestAsm(unittest.TestCase):
self.assertEqual(str(m2).strip(), asm.strip())
def test_bitcode(self):
# create a module
m = Module.new('module1')
m.add_global_variable(Type.int(), 'i')
# write it's assembly representation to a file
asm = str(m)
with open("/tmp/testasm.bc", "wb") as fout:
m.to_bitcode(fout)
# read it back into a module
with open("/tmp/testasm.bc", "rb") as fin:
m2 = Module.from_bitcode(fin)
# The default `m.id` is '<string>'.
m2.id = m.id # Copy the name from `m`
self.assertEqual(str(m2).strip(), asm.strip())
if __name__ == '__main__':
unittest.main()