Fix `GetBuffer` throwing `ArgumentOutOfRangeException` by legomanww · Pull Request #2120 · pythonnet/pythonnet

What does this implement/fix? Explain your changes.

PyBuffer throws System.ArgumentOutOfRangeException when trying to use GetBuffer() with anything other than PyBUF.SIMPLE since the Marshal.Copy calls had a typos so it was trying to copy shape, strides, and suboffsets as arrays that were the full length of the source array instead of length ndim.

Does this close any currently open issues?

no

Any other comments?

...

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Ensure you have signed the .NET Foundation CLA <- doesn't seem to be working
  • Add yourself to AUTHORS
  • Updated the CHANGELOG