Skip to content

Conversation

@priyanshu2282-cyber
Copy link
Contributor

@priyanshu2282-cyber priyanshu2282-cyber commented Jan 22, 2026

This change fixes a crash in array.fromlist() that can happen if an element’s __index__ method mutates the input list while it is being processed.
Previously, array.fromlist() assumed the list would remain unchanged during conversion. If __index__ cleared the list, the element being converted could be freed while still in use, leading to a crash. The implementation now keeps the element alive for the duration of the conversion, I have added a regression test to cover this case.

@priyanshu2282-cyber
Copy link
Contributor Author

@serhiy-storchaka I have proposed a fix to make array.fromlist() safe against reentrant __index__ calls that mutate the input list, and I have added a regresion test. Please let me know if this approach is appropriate when you have time. Thankyou!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant