Fixed crash in ToArray when sequence explicitly denies __len__ by lostmsu · Pull Request #1484 · pythonnet/pythonnet

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.