mirror of https://github.com/python/cpython
Partially revert the over-reaching r80813.
This commit is contained in:
parent
0b03f10afb
commit
417439e6cd
11
Python/ast.c
11
Python/ast.c
|
@ -3378,12 +3378,17 @@ decode_utf8(struct compiling *c, const char **sPtr, const char *end, char* encod
|
|||
static PyObject *
|
||||
decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, const char *encoding)
|
||||
{
|
||||
PyObject *v;
|
||||
PyObject *u = NULL;
|
||||
PyObject *v, *u;
|
||||
char *buf;
|
||||
char *p;
|
||||
const char *end;
|
||||
if (encoding != NULL && strcmp(encoding, "iso-8859-1")) {
|
||||
if (encoding == NULL) {
|
||||
buf = (char *)s;
|
||||
u = NULL;
|
||||
} else if (strcmp(encoding, "iso-8859-1") == 0) {
|
||||
buf = (char *)s;
|
||||
u = NULL;
|
||||
} else {
|
||||
/* check for integer overflow */
|
||||
if (len > PY_SIZE_MAX / 6)
|
||||
return NULL;
|
||||
|
|
|
@ -2697,6 +2697,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
Py_DECREF(*pfunc);
|
||||
*pfunc = self;
|
||||
na++;
|
||||
n++;
|
||||
} else
|
||||
Py_INCREF(func);
|
||||
sp = stack_pointer;
|
||||
|
|
|
@ -59,13 +59,14 @@ getcwd(char *buf, int size)
|
|||
{
|
||||
FILE *fp;
|
||||
char *p;
|
||||
int sts;
|
||||
if (size <= 0) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
if ((fp = popen(PWD_CMD, "r")) == NULL)
|
||||
return NULL;
|
||||
if (fgets(buf, size, fp) == NULL || pclose(fp) != 0) {
|
||||
if (fgets(buf, size, fp) == NULL || (sts = pclose(fp)) != 0) {
|
||||
errno = EACCES; /* Most likely error */
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue