compile():  Use the __debug__ flag to determine the proper filename extension
	to use for the cached module code object.
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
index fba7b1d..e9e90ff 100644
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -19,7 +19,7 @@
 	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)