mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
merge r66932 and add a few py3k only checks
This commit is contained in:
parent
60192084c4
commit
a13d475901
3 changed files with 19 additions and 6 deletions
|
@ -179,11 +179,13 @@ raise_errmsg(char *msg, PyObject *s, Py_ssize_t end)
|
|||
errmsg_fn = PyObject_GetAttrString(decoder, "errmsg");
|
||||
if (errmsg_fn == NULL)
|
||||
return;
|
||||
Py_XDECREF(decoder);
|
||||
Py_DECREF(decoder);
|
||||
}
|
||||
pymsg = PyObject_CallFunction(errmsg_fn, "(zOn)", msg, s, end);
|
||||
PyErr_SetObject(PyExc_ValueError, pymsg);
|
||||
Py_DECREF(pymsg);
|
||||
if (pymsg) {
|
||||
PyErr_SetObject(PyExc_ValueError, pymsg);
|
||||
Py_DECREF(pymsg);
|
||||
}
|
||||
/*
|
||||
|
||||
def linecol(doc, pos):
|
||||
|
@ -602,7 +604,7 @@ py_encode_basestring_ascii(PyObject* self, PyObject *pystr)
|
|||
Py_TYPE(pystr)->tp_name);
|
||||
return NULL;
|
||||
}
|
||||
if (PyBytes_Check(rval)) {
|
||||
if (rval != NULL && PyBytes_Check(rval)) {
|
||||
PyObject *urval = PyUnicode_DecodeASCII(PyBytes_AS_STRING(rval), PyBytes_GET_SIZE(rval), NULL);
|
||||
Py_DECREF(rval);
|
||||
return urval;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue