Assembly Interpreter/Embedding C

Tim Peters tim_one at email.msn.com
Tue Oct 19 20:45:27 EDT 1999


[Jeff Shipman - UC <jeff at nmt.edu>]
> I am building an interactive Intel Assembly interpreter using Python. I
> am now needing to add the part where my binary code is taken, loaded
> into memory and executed. I've heard the only way of doing this is to
> use C.

[Guido]
> I question what you've been told.  Python has perfectly fine built-in
> tools for reading binary data from a file, e.g. the struct module and
> the "rb" open mode.  Where is the need for using an extension?

Jeff's phrasing is a bit strained, but if you read it again I think you'll
find that he wants to take a blob of synthesized Intel machine code and
execute it directly:  stuff the bytes into memory, and *jump* to them.  Of
course there's no (portable) way to do that from C, either.

Perhaps Python2 should add a

    goto list_of_bytes

cmd <wink>?

or-maybe-list_of_bytes.goto()-ly y'rs  - tim






More information about the Python-list mailing list