Mercurial > cpython-lru_cache-weakref
comparison Python/makeopcodetargets.py @ 51202:df090597afaa
Make Python/makeopcodetargets runnable with Python 2.3. With any luck, this
should solve the 'failed compile' on the x86 gentoo 3.x buildbot.
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Sat, 31 Jan 2009 12:12:41 +0000 |
| parents | d86e23318b41 |
| children | f197407bdba2 fcfe324663a6 |
comparison
equal
deleted
inserted
replaced
| 51201:02a90dc0c29a | 51202:df090597afaa |
|---|---|
| 1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
| 2 """Generate C code for the jump table of the threaded code interpreter | 2 """Generate C code for the jump table of the threaded code interpreter |
| 3 (for compilers supporting computed gotos or "labels-as-values", such as gcc). | 3 (for compilers supporting computed gotos or "labels-as-values", such as gcc). |
| 4 """ | 4 """ |
| 5 | |
| 6 # This code should stay compatible with Python 2.3, at least while | |
| 7 # some of the buildbots have Python 2.3 as their system Python. | |
| 5 | 8 |
| 6 import imp | 9 import imp |
| 7 import os | 10 import os |
| 8 | 11 |
| 9 | 12 |
| 23 if opname == "STOP_CODE": | 26 if opname == "STOP_CODE": |
| 24 # XXX opcode not implemented | 27 # XXX opcode not implemented |
| 25 continue | 28 continue |
| 26 targets[op] = "TARGET_%s" % opname | 29 targets[op] = "TARGET_%s" % opname |
| 27 f.write("static void *opcode_targets[256] = {\n") | 30 f.write("static void *opcode_targets[256] = {\n") |
| 28 f.write(",\n".join("\t&&%s" % s for s in targets)) | 31 f.write(",\n".join(["\t&&%s" % s for s in targets])) |
| 29 f.write("\n};\n") | 32 f.write("\n};\n") |
| 30 | 33 |
| 31 | 34 |
| 32 if __name__ == "__main__": | 35 if __name__ == "__main__": |
| 33 import sys | 36 import sys |
