Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix GetBuffer throwing ArgumentOutOfRangeException #2120

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
merged 3 commits into from
Mar 12, 2023

Conversation

legomanww
Copy link
Contributor

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

@lostmsu
Copy link
Member

lostmsu commented Mar 12, 2023

NIT: add parameter names to Copy calls (e.g. length: ...). Would be easier to spot the mistake next time.

@lostmsu lostmsu merged commit 131b466 into pythonnet:master Mar 12, 2023
@legomanww legomanww deleted the fix/bufferlen branch March 13, 2023 00:32
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.

3 participants