Allow creating new .NET arrays from Python using Array[T](dim1, dim2,…) syntax by lostmsu · Pull Request #1291 · pythonnet/pythonnet · GitHub
Skip to content

Allow creating new .NET arrays from Python using Array[T](dim1, dim2,…) syntax#1291

Merged
lostmsu merged 1 commit intopythonnet:masterfrom
losttech:features/ArrayFromShape
Nov 24, 2020
Merged

Allow creating new .NET arrays from Python using Array[T](dim1, dim2,…) syntax#1291
lostmsu merged 1 commit intopythonnet:masterfrom
losttech:features/ArrayFromShape

Conversation

@lostmsu
Copy link
Copy Markdown
Member

@lostmsu lostmsu commented Nov 24, 2020

What does this implement/fix? Explain your changes.

This handles a few new argument combinations in tp_new of .NET array types:

  1. A single integer to create a one-dimensional array of specified size.
  2. Multiple integers passed as arguments (e.g. Array[T](3,5,7)) to create a multidimensional array.

It processes all exceptions specified in https://docs.microsoft.com/en-us/dotnet/api/system.array.createinstance?view=net-5.0#System_Array_CreateInstance_System_Type_System_Int64___

Does this close any currently open issues?

fixes #251

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
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

@lostmsu lostmsu force-pushed the features/ArrayFromShape branch from 96cee3e to 1d17421 Compare November 24, 2020 04:11
@codecov-io
Copy link
Copy Markdown

codecov-io commented Nov 24, 2020

@lostmsu lostmsu requested a review from filmor November 24, 2020 21:11
@lostmsu lostmsu merged commit 182faed into pythonnet:master Nov 24, 2020
@lostmsu lostmsu deleted the features/ArrayFromShape branch November 24, 2020 22:08
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.

Array instantiation does not work with clean syntax

3 participants