compile(): Use the __debug__ flag to determine the proper filename extension

to use for the cached module code object.
This commit is contained in:
Fred Drake 1997-03-13 14:13:16 +00:00
parent 6af0c00ab6
commit ef8dc06c01

View file

@ -19,7 +19,7 @@ def compile(file, cfile = None):
timestamp = long(os.stat(file)[8])
codeobject = __builtin__.compile(codestring, file, 'exec')
if not cfile:
cfile = file + 'c'
cfile = file + (__debug__ and 'c' or 'o')
fc = open(cfile, 'wb')
fc.write(MAGIC)
wr_long(fc, timestamp)