Skip to content

Conversation

@3rdit
Copy link

@3rdit 3rdit commented Jan 22, 2026

The standard Python slicing syntax, i.e. [:], [2:], [:5].. (anything with an open end) fail with TypeError on FunctionList, BasicBlockList and TagList. Other valid slices like [0:len(list)] would also cause an IndexError.

The slice bounds checking compares i.start and i.stop directly against integers, but Python sets these to None for open-ended slices. This means comparing None < 0 raises TypeError. The check i.stop >= len(self) also rejects valid Python where stop equals length.

This PR replaces the manual bounds checking with slice.indices() that will handle None values and normalise the bounds correctly. Other places in the codebase already do this.

@CLAassistant
Copy link

CLAassistant commented Jan 22, 2026

CLA assistant check
All committers have signed the CLA.

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