Partially revert the over-reaching r80813.

This commit is contained in:
Brett Cannon 2010-05-05 20:24:30 +00:00
parent 0b03f10afb
commit 417439e6cd
4 changed files with 85 additions and 78 deletions

View File

@ -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;

View File

@ -2697,6 +2697,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_DECREF(*pfunc);
*pfunc = self;
na++;
n++;
} else
Py_INCREF(func);
sp = stack_pointer;

View File

@ -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;
}