Eric Wieser

Results 440 comments of Eric Wieser

Re: naming: * `index_at_code_offset(offset)`? * `get_instr_index(offset)` * `index(value=None, code_offset=None)`, which overloads `collections.Sequence.index`

That's a neat idea. How would `offset_view()` work with `SetLineno` though? Also, without directly exposing the index, I'm still stuck trying to index a `Bytecode` object based on the offset...

I want to obtain abstract bytecode corresponding to the code executed between two `frame.f_lasti`s (if possible - obviously if there are jumps leaving this segment, then erroring is fine)

Context: writing [`withhacks.frame_utils.extract_code`](https://github.com/rfk/withhacks/blob/b715b7aefcce929cf2a31d5c557b81ecfdf3375c/withhacks/frameutils.py#L87-L128)

> Which one do you want? Ideally, I want to convert `frame.f_lasti` into an index for `Bytecode.from_code(frame.f_code)`, but the easiest way to do that seems to be to go via...

> Getting the instruction object is as simple as bytecode[index] anyway. Not quite, because `bytecode[index]` might be a SetLineNo, right? Also, `index` might `==len(self)`, which is ok for slicing, but...

> Hum, what does Bytecode.index(instr) currently [do]? Return the index such that `Bytecode[i] == instr` > get_instr_index(offset) is the most explicit. I worry that there needs to be some explicit...

As a workaround, add this to your `conf.py`: ```python def monkeypatch(cls): """ decorator to monkey-patch methods """ def decorator(f): method = f.__name__ old_method = getattr(cls, method) setattr(cls, method, lambda self,...

This is because the builtin `Arduino.h` contains the line `#define abs ...`, which then ruins the function definition. This is fixed with `#include "StandardCplusplus.h"` at the top of all your...

You need to define `bool MyClass::operator==(const MyClass& other)`. This is not a library bug