Skip to content

Minor typing fixes for dwarf#661

Merged
eliben merged 3 commits into
eliben:mainfrom
pmhahn:typing-dwarf-fixes
Jun 4, 2026
Merged

Minor typing fixes for dwarf#661
eliben merged 3 commits into
eliben:mainfrom
pmhahn:typing-dwarf-fixes

Conversation

@pmhahn

@pmhahn pmhahn commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

👍 to use ruff, but sadly you introduces one minor but by converting an lambda into an untyped function.

I also had (another) look on how to remove the duplication of {dwarf,elf}_assert() vs. asserts required for typing. While doing that I stumbled over 3 dwarf_assert(False, …), which should be replaced by an raise DWARFError() to make the error more obvious (and to reduce the length of the backtrace).

I also noticed, that class FDE(CFIEntry) has a slightly different type-annotation than its super-class, which I have fixed.

pmhahn added 2 commits June 3, 2026 08:36
Fixes: 12e9636 ("Fix a bunch of other ruff check issues")
Signed-off-by: Philipp Hahn <phahn-oss@avm.de>
Harmonize both CFIEntry and FDE to expect bytes for augmentation_bytes;
drop None alternative.

Signed-off-by: Philipp Hahn <phahn-oss@avm.de>
Comment thread elftools/dwarf/callframe.py Outdated
Comment thread elftools/dwarf/callframe.py Outdated
Instead of using dwarf_assert(False, mgs) directly raise
DWARFError(msg).

Signed-off-by: Philipp Hahn <phahn-oss@avm.de>
@pmhahn
pmhahn force-pushed the typing-dwarf-fixes branch from df53f2e to b598da5 Compare June 3, 2026 20:03
@eliben

eliben commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Thank you! Apparently the ruff check is passing with your latest changes. I'll test it more locally and will merge probably tomorrow

@eliben
eliben merged commit ea66757 into eliben:main Jun 4, 2026
10 checks passed
@eliben

eliben commented Jun 4, 2026

Copy link
Copy Markdown
Owner

EM102 checks are not enabled in this repo -- I'm just using the defaults; do you have all ruff checks enabled?

@pmhahn

pmhahn commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

EM102 checks are not enabled in this repo -- I'm just using the defaults; do you have all ruff checks enabled?

Sometime yes, but not this time. I did the initial conversion from dwarf_assert(False, …) to msg = …; raise DWARFError(msg) from my muscle memory – as I'm used to do that for some other project where EM102 is enabled.

@pmhahn
pmhahn deleted the typing-dwarf-fixes branch June 4, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants