[go: up one dir, main page]

Skip to content

Commit

Permalink
added accepting buffer arguments in dlmodule.c
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Szabo committed Dec 25, 2019
1 parent 1b1255f commit ef6bd64
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Modules.dlmodule.2.7.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ dl_call(dlobject *xp, PyObject *args)
long res;
Py_ssize_t i;
Py_ssize_t n = PyTuple_Size(args);
const char *buffer;
Py_ssize_t size;
if (n < 1) {
PyErr_SetString(PyExc_TypeError, "at least a name is needed");
return NULL;
Expand Down Expand Up @@ -174,11 +176,13 @@ dl_call(dlobject *xp, PyObject *args)
alist[i-1] = res = PyInt_AsLong(v);
if (res == -1 && PyErr_Occurred()) return 0;
}
/* !! StaticPython: Allow buffers as well. */
else if (PyString_Check(v))
alist[i-1] = (long)PyString_AsString(v);
else if (v == Py_None)
alist[i-1] = (long) ((char *)NULL);
else if (!PyObject_AsCharBuffer(v, &buffer, &size)) {
alist[i-1] = (long)buffer;
}
else {
PyErr_SetString(PyExc_TypeError,
"arguments must be int, string or None");
Expand Down

0 comments on commit ef6bd64

Please sign in to comment.