(code, f)
| 4 | |
| 5 | # http://www.jonathon-vogel.com/posts/patching_function_bytecode_with_python/ |
| 6 | def find_code(code, f): |
| 7 | i = 0 |
| 8 | while i < len(code): |
| 9 | if f(code, i): |
| 10 | return i |
| 11 | elif code[i] < dis.HAVE_ARGUMENT: |
| 12 | i += 1 |
| 13 | else: |
| 14 | i += 3 |
| 15 | |
| 16 | # http://nedbatchelder.com/blog/201301/byterun_and_making_cells.html |
| 17 | def make_cell(value): |