Commits

Jakub Wilk committed 6cc5a0d

builtins: port to Python 2.5/2.6.

Comments (0)

Files changed (1)

 
 '''Built-ins for the Javalette language.'''
 
+import sys
+
 import syntax
 import type
 
 del _name, _alias
 
 _stub_label = bp.Label()
-py_stub_post = \
+py_stub_post = filter(None,
 [
 	(bp.BUILD_LIST, 0),
 	(bp.STORE_GLOBAL, '__all__'),
 	(bp.LOAD_CONST, '__main__'),
 	(bp.COMPARE_OP, '=='),
 	(bp.JUMP_IF_FALSE, _stub_label),
+	sys.version_info >= (2, 5) and (bp.LOAD_CONST, -1),
 	(bp.LOAD_CONST, None),
 	(bp.IMPORT_NAME, 'sys'),
 	(bp.IMPORT_FROM, 'exit'),
 	(bp.POP_TOP, None),
 	(_stub_label, None),
 	(bp.RETURN_VALUE, None)
-]
+])
 del _stub_label
 
 _label_io_error = x86.Label()