summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-06-06 10:52:45 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2016-06-06 10:52:45 -0700
commit258a88d6c903234831281d4495eff7382932b617 (patch)
tree34fcbf67e799e953ec6fd93ffddd247bad669f98
parent7c9e3c4c5547d97d09ab842ac14e44ff391f6905 (diff)
parent73829be73e3c77eb75c6b234c6626815da7da7bc (diff)
Merge pull request #135 from nwellnhof/fix-python-ctypes
Fix ctypes in Python FFI calls
-rw-r--r--test/cmark.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/cmark.py b/test/cmark.py
index 60eacb1..4be85a3 100644
--- a/test/cmark.py
+++ b/test/cmark.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-from ctypes import CDLL, c_char_p, c_long, c_void_p
+from ctypes import CDLL, c_char_p, c_size_t, c_int, c_void_p
from subprocess import *
import platform
import os
@@ -14,7 +14,7 @@ def pipe_through_prog(prog, text):
def to_html(lib, text):
markdown = lib.cmark_markdown_to_html
markdown.restype = c_char_p
- markdown.argtypes = [c_char_p, c_long, c_long]
+ markdown.argtypes = [c_char_p, c_size_t, c_int]
textbytes = text.encode('utf-8')
textlen = len(textbytes)
result = markdown(textbytes, textlen, 0).decode('utf-8')
@@ -25,10 +25,10 @@ def to_commonmark(lib, text):
textlen = len(textbytes)
parse_document = lib.cmark_parse_document
parse_document.restype = c_void_p
- parse_document.argtypes = [c_char_p, c_long, c_long]
+ parse_document.argtypes = [c_char_p, c_size_t, c_int]
render_commonmark = lib.cmark_render_commonmark
render_commonmark.restype = c_char_p
- render_commonmark.argtypes = [c_void_p, c_long, c_long]
+ render_commonmark.argtypes = [c_void_p, c_int, c_int]
node = parse_document(textbytes, textlen, 0)
result = render_commonmark(node, 0, 0).decode('utf-8')
return [0, result, '']