Created
March 11, 2010 18:07
-
-
Save narfdotpl/329446 to your computer and use it in GitHub Desktop.
Python infinite loop bytecode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ $ python | |
Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) | |
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from dis import dis | |
>>> def wT(): | |
... while True: | |
... pass | |
... | |
>>> dis(wT) | |
2 0 SETUP_LOOP 12 (to 15) | |
>> 3 LOAD_GLOBAL 0 (True) | |
6 JUMP_IF_FALSE 4 (to 13) | |
9 POP_TOP | |
3 10 JUMP_ABSOLUTE 3 | |
>> 13 POP_TOP | |
14 POP_BLOCK | |
>> 15 LOAD_CONST 0 (None) | |
18 RETURN_VALUE | |
>>> def w1(): | |
... while 1: | |
... pass | |
... | |
>>> dis(w1) | |
2 0 SETUP_LOOP 3 (to 6) | |
3 >> 3 JUMP_ABSOLUTE 3 | |
>> 6 LOAD_CONST 0 (None) | |
9 RETURN_VALUE | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment