Skip to content

Instantly share code, notes, and snippets.

@laixintao
Created Mar 15, 2020
Embed
What would you like to do?
import ctypes
def deref(addr, typ):
return ctypes.cast(addr, ctypes.POINTER(typ))
deref(id(3), ctypes.c_int)[6] = 2
@laixintao

This comment has been minimized.

Copy link
Owner Author

@laixintao laixintao commented Mar 15, 2020

python -i magic.py
>>> 3 + 1
2
>>> 2 + 1
2
>>> 4 - 3
2
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment