From: Tim Peters Date: Fri, 5 Jan 2001 00:54:29 +0000 (+0000) Subject: Fix signed/unsigned wng. Unfortunately, (unsigned char) << int X-Git-Tag: v2.1a1~408 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b8584e0894863ca5d069889a30e7b4c4564ed416;p=python Fix signed/unsigned wng. Unfortunately, (unsigned char) << int has type int in C. --- diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 45d21dd772..4dc2ddd8b7 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -570,8 +570,8 @@ maybe_pyc_file(FILE *fp, char* filename, char* ext, int closeit) 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); }