1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-19 14:50:07 +03:00

Build the Python extension with PY_SSIZE_T_CLEAN

The Python extension module now uses Py_ssize_t rather than int for
string lengths. This change makes the extension compatible with
Python 3.10.

Fixes #203.
This commit is contained in:
Victor Stinner 2020-11-09 18:19:31 +01:00 committed by Nick Wellnhofer
parent 0ace6c4d7e
commit f42a0524c6

View File

@ -393,7 +393,7 @@ def print_function_wrapper(name, output, export, include):
format_args = format_args + ", &%s" % (arg[0])
if f == 's#':
format_args = format_args + ", &py_buffsize%d" % num_bufs
c_args = c_args + " int py_buffsize%d;\n" % num_bufs
c_args = c_args + " Py_ssize_t py_buffsize%d;\n" % num_bufs
num_bufs = num_bufs + 1
if c_call != "":
c_call = c_call + ", "
@ -555,6 +555,7 @@ def buildStubs():
export.write("/* Generated */\n\n")
wrapper = open("libxml2-py.c", "w")
wrapper.write("/* Generated */\n\n")
wrapper.write("#define PY_SSIZE_T_CLEAN\n")
wrapper.write("#include <Python.h>\n")
wrapper.write("#include <libxml/xmlversion.h>\n")
wrapper.write("#include <libxml/tree.h>\n")