mirror of
https://github.com/python/cpython.git
synced 2024-11-26 03:14:27 +08:00
Use unicode instead of 8-bit strings.
Patch by Alexandre Vassalotti, SF# 1752229.
This commit is contained in:
parent
c3e7ffc670
commit
dc09715d0b
@ -58,8 +58,8 @@ dl_sym(dlobject *xp, PyObject *args)
|
|||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
PyUnivPtr *func;
|
PyUnivPtr *func;
|
||||||
if (PyString_Check(args)) {
|
if (PyUnicode_Check(args)) {
|
||||||
name = PyString_AS_STRING(args);
|
name = PyUnicode_AsString(args);
|
||||||
} else {
|
} else {
|
||||||
PyErr_Format(PyExc_TypeError, "expected string, found %.200s",
|
PyErr_Format(PyExc_TypeError, "expected string, found %.200s",
|
||||||
args->ob_type->tp_name);
|
args->ob_type->tp_name);
|
||||||
@ -88,14 +88,14 @@ dl_call(dlobject *xp, PyObject *args)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
name = PyTuple_GetItem(args, 0);
|
name = PyTuple_GetItem(args, 0);
|
||||||
if (!PyString_Check(name)) {
|
if (!PyUnicode_Check(name)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"function name must be a string");
|
"function name must be a string");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
func = (long (*)(long, long, long, long, long,
|
func = (long (*)(long, long, long, long, long,
|
||||||
long, long, long, long, long))
|
long, long, long, long, long))
|
||||||
dlsym(xp->dl_handle, PyString_AsString(name));
|
dlsym(xp->dl_handle, PyUnicode_AsString(name));
|
||||||
if (func == NULL) {
|
if (func == NULL) {
|
||||||
PyErr_SetString(PyExc_ValueError, dlerror());
|
PyErr_SetString(PyExc_ValueError, dlerror());
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -111,8 +111,8 @@ dl_call(dlobject *xp, PyObject *args)
|
|||||||
alist[i-1] = PyInt_AsLong(v);
|
alist[i-1] = PyInt_AsLong(v);
|
||||||
if (alist[i-1] == -1 && PyErr_Occurred())
|
if (alist[i-1] == -1 && PyErr_Occurred())
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (PyString_Check(v))
|
} else if (PyUnicode_Check(v))
|
||||||
alist[i-1] = (long)PyString_AsString(v);
|
alist[i-1] = (long)PyUnicode_AsString(v);
|
||||||
else if (v == Py_None)
|
else if (v == Py_None)
|
||||||
alist[i-1] = (long) ((char *)NULL);
|
alist[i-1] = (long) ((char *)NULL);
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user