Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da059e3

Browse files
committed
Use unicode
1 parent 5616c6d commit da059e3

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Python/ceval.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static PyObject * import_from(PyObject *, PyObject *);
119119
static int import_all_from(PyObject *, PyObject *);
120120
static void set_exc_info(PyThreadState *, PyObject *, PyObject *, PyObject *);
121121
static void reset_exc_info(PyThreadState *);
122-
static void format_exc_check_arg(PyObject *, char *, PyObject *);
122+
static void format_exc_check_arg(PyObject *, const char *, PyObject *);
123123
static PyObject * string_concatenate(PyObject *, PyObject *,
124124
PyFrameObject *, unsigned char *);
125125

@@ -1763,11 +1763,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
17631763

17641764
case LOAD_GLOBAL:
17651765
w = GETITEM(names, oparg);
1766-
if (PyString_CheckExact(w)) {
1766+
if (PyUnicode_CheckExact(w)) {
17671767
/* Inline the PyDict_GetItem() calls.
17681768
WARNING: this is an extreme speed hack.
17691769
Do not try this at home. */
1770-
long hash = ((PyStringObject *)w)->ob_shash;
1770+
long hash = ((PyUnicodeObject *)w)->hash;
17711771
if (hash != -1) {
17721772
PyDictObject *d;
17731773
PyDictEntry *e;
@@ -2658,7 +2658,7 @@ PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals,
26582658
PyObject *keyword = kws[2*i];
26592659
PyObject *value = kws[2*i + 1];
26602660
int j;
2661-
if (keyword == NULL || !(PyString_Check(keyword) || PyUnicode_Check(keyword))) {
2661+
if (keyword == NULL || !PyUnicode_Check(keyword)) {
26622662
PyErr_Format(PyExc_TypeError,
26632663
"%S() keywords must be strings",
26642664
co->co_name);
@@ -3675,7 +3675,7 @@ update_keyword_args(PyObject *orig_kwdict, int nk, PyObject ***pp_stack,
36753675
"for keyword argument '%.200s'",
36763676
PyEval_GetFuncName(func),
36773677
PyEval_GetFuncDesc(func),
3678-
PyString_AsString(key));
3678+
PyUnicode_AsString(key));
36793679
Py_DECREF(key);
36803680
Py_DECREF(value);
36813681
Py_DECREF(kwdict);
@@ -4086,14 +4086,14 @@ import_all_from(PyObject *locals, PyObject *v)
40864086
}
40874087

40884088
static void
4089-
format_exc_check_arg(PyObject *exc, char *format_str, PyObject *obj)
4089+
format_exc_check_arg(PyObject *exc, const char *format_str, PyObject *obj)
40904090
{
4091-
char *obj_str;
4091+
const char *obj_str;
40924092

40934093
if (!obj)
40944094
return;
40954095

4096-
obj_str = PyString_AsString(obj);
4096+
obj_str = PyUnicode_AsString(obj);
40974097
if (!obj_str)
40984098
return;
40994099

0 commit comments

Comments
 (0)