Skip to content

Fixed crash in ToArray when sequence explicitly denies __len__ #1484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lostmsu
Copy link
Member

@lostmsu lostmsu commented Jul 7, 2021

port of 8e1d4db

What does this implement/fix? Explain your changes.

Prevents crash on converting sequences to arrays when sequence lacks __len__.

Sequence types might return error from PySequence_Size (like sequences provided by generators or types implemented in C, that lack sq_length slot or make it throw). This change adds handling for this case.

@lostmsu lostmsu added the mini label Jul 7, 2021
@lostmsu lostmsu force-pushed the Mini/NoCrashWhenSequenceLengthUndefined branch from f02f565 to 41474f1 Compare July 7, 2021 00:44
@lostmsu lostmsu force-pushed the Mini/NoCrashWhenSequenceLengthUndefined branch from 41474f1 to b52823b Compare July 7, 2021 00:46
@filmor filmor merged commit 2ac5f4e into pythonnet:master Jul 7, 2021
@lostmsu lostmsu deleted the Mini/NoCrashWhenSequenceLengthUndefined branch July 7, 2021 23:40
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