[Python-checkins] python/dist/src/Python import.c,2.192.6.1,2.192.6.2
nnorwitz@users.sourceforge.net
nnorwitz@users.sourceforge.net
Sat, 01 Jun 2002 11:26:27 -0700
- Previous message: [Python-checkins] python/dist/src/Lib mhlib.py,1.30,1.31 netrc.py,1.15,1.16 poplib.py,1.20,1.21 pprint.py,1.21,1.22 profile.py,1.45,1.46 pstats.py,1.24,1.25 py_compile.py,1.19,1.20
- Next message: [Python-checkins] python/dist/src/Python import.c,2.175.2.2,2.175.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv30573/Python
Modified Files:
Tag: release22-maint
import.c
Log Message:
Fix SF #561858 Assertion with very long lists
if co_stacksize was > 32767 (the maximum value
which can be stored in 16 bits (signed)),
the PyCodeObject would be written wrong.
So on the second import (reading the .pyc)
would cause a crash.
Since we can't change the PYC magic, we
go on (silently), but don't write the file.
This means everything will work, but
a .pyc will not be written and the file will need
to be parsed on each import.
I will backport.
Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.192.6.1
retrieving revision 2.192.6.2
diff -C2 -d -r2.192.6.1 -r2.192.6.2
*** import.c 12 Jan 2002 11:13:24 -0000 2.192.6.1
--- import.c 1 Jun 2002 18:26:22 -0000 2.192.6.2
***************
*** 20,23 ****
--- 20,26 ----
#endif
+ /* check if the int_value can't be written in 15 bits (signed) */
+ #define CANT_WRITE(int_value) (int_value > 32767)
+
extern time_t PyOS_GetLastModificationTime(char *, FILE *);
/* In getmtime.c */
***************
*** 687,690 ****
--- 690,705 ----
{
FILE *fp;
+
+ if (CANT_WRITE(co->co_argcount) ||
+ CANT_WRITE(co->co_nlocals) ||
+ CANT_WRITE(co->co_stacksize) ||
+ CANT_WRITE(co->co_flags) ||
+ CANT_WRITE(co->co_firstlineno)) {
+ if (Py_VerboseFlag)
+ PySys_WriteStderr(
+ "# code too large: can't write %s\n",
+ cpathname);
+ return;
+ }
fp = open_exclusive(cpathname);
- Previous message: [Python-checkins] python/dist/src/Lib mhlib.py,1.30,1.31 netrc.py,1.15,1.16 poplib.py,1.20,1.21 pprint.py,1.21,1.22 profile.py,1.45,1.46 pstats.py,1.24,1.25 py_compile.py,1.19,1.20
- Next message: [Python-checkins] python/dist/src/Python import.c,2.175.2.2,2.175.2.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]