mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Partially revert the over-reaching r80813.
This commit is contained in:
parent
0b03f10afb
commit
417439e6cd
4 changed files with 85 additions and 78 deletions
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 *
|
static PyObject *
|
||||||
decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, const char *encoding)
|
decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, const char *encoding)
|
||||||
{
|
{
|
||||||
PyObject *v;
|
PyObject *v, *u;
|
||||||
PyObject *u = NULL;
|
|
||||||
char *buf;
|
char *buf;
|
||||||
char *p;
|
char *p;
|
||||||
const char *end;
|
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 */
|
/* check for integer overflow */
|
||||||
if (len > PY_SIZE_MAX / 6)
|
if (len > PY_SIZE_MAX / 6)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -2697,6 +2697,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
||||||
Py_DECREF(*pfunc);
|
Py_DECREF(*pfunc);
|
||||||
*pfunc = self;
|
*pfunc = self;
|
||||||
na++;
|
na++;
|
||||||
|
n++;
|
||||||
} else
|
} else
|
||||||
Py_INCREF(func);
|
Py_INCREF(func);
|
||||||
sp = stack_pointer;
|
sp = stack_pointer;
|
||||||
|
|
|
@ -59,13 +59,14 @@ getcwd(char *buf, int size)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *p;
|
char *p;
|
||||||
|
int sts;
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((fp = popen(PWD_CMD, "r")) == NULL)
|
if ((fp = popen(PWD_CMD, "r")) == NULL)
|
||||||
return 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 */
|
errno = EACCES; /* Most likely error */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue