]> granicus.if.org Git - python/commitdiff
compile(): Use the __debug__ flag to determine the proper filename extension
authorFred Drake <fdrake@acm.org>
Thu, 13 Mar 1997 14:13:16 +0000 (14:13 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 13 Mar 1997 14:13:16 +0000 (14:13 +0000)
to use for the cached module code object.

Lib/py_compile.py

index fba7b1d51dd5debf0a4a7f2404c32c401f4ce405..e9e90ff6efa159f25db32eace3be0f6c1afaad0c 100644 (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)