- Commit
- 258a88d6c903234831281d4495eff7382932b617
- Parent
- 7c9e3c4c5547d97d09ab842ac14e44ff391f6905
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Merge pull request #135 from nwellnhof/fix-python-ctypes
Fix ctypes in Python FFI calls
My personal build of CMark ✏️
Merge pull request #135 from nwellnhof/fix-python-ctypes
Fix ctypes in Python FFI calls
1 file changed, 4 insertions, 4 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | test/cmark.py | 8 | 4 | 4 |
diff --git 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, '']