Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 15740:0a77013c50ac legacy-trunk
Fix signed/unsigned wng. Unfortunately, (unsigned char) << int
has type int in C.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Fri, 05 Jan 2001 00:54:29 +0000 |
| parents | 76caf0855d1f |
| children | cf17a3ce5387 |
line wrap: on
line diff
--- a/Python/pythonrun.c Thu Jan 04 22:33:02 2001 +0000 +++ b/Python/pythonrun.c Fri Jan 05 00:54:29 2001 +0000 @@ -570,8 +570,8 @@ be read as they are on disk. */ unsigned int halfmagic = PyImport_GetMagicNumber() & 0xFFFF; unsigned char buf[2]; - if (fread(buf, 1, 2, fp) == 2 - && (buf[1]<<8 | buf[0]) == halfmagic) + if (fread(buf, 1, 2, fp) == 2 + && ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic) return 1; fseek(fp, 0, SEEK_SET); }
