Open PythonLinks opened 3 weeks ago
In #123 you can find a suggestion about how to read a pyc
file https://github.com/MatthieuDartiailh/bytecode/issues/123. The part of writing it out is in https://github.com/P403n1x87/spasmlang/blob/d868ce2557e17fc3dd5a71fc7b155f3250a3aeb5/spasm/__main__.py#L23
The reference given by @P403n1x87 is likely to be the best. Other usage of bytecode I am aware of tend to work mostly in memory or at least retrieve code from live objects.
The documentation says that
What I would like to do is to modify existing bytecode.
Load a file, read the bytecode, modify it, save it out.
Can I do that with this package? Is this package only for creating code?