Skip to content
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

Convert BigInteger to Int64 when possible from Python #10096

Merged
merged 5 commits into from
Nov 12, 2019

Conversation

aparajit-pratap
Copy link
Contributor

@aparajit-pratap aparajit-pratap commented Oct 29, 2019

Purpose

https://autodesk.slack.com/archives/CED3BF6C9/p1571942488031200
image

JIRA: https://jira.autodesk.com/browse/DYN-2262

Declarations

Check these if you believe they are true

  • The code base is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning, and are documented in the API Changes document.

Reviewers

@DynamoDS/dynamo

FYIs

@Dewb

@aparajit-pratap aparajit-pratap changed the title convert BigInteger to Int64 wherever possible from Python Convert BigInteger to Int64 wherever possible from Python Oct 29, 2019
@aparajit-pratap aparajit-pratap changed the title Convert BigInteger to Int64 wherever possible from Python Convert BigInteger to Int64 when possible from Python Oct 31, 2019
@Dewb
Copy link
Contributor

Dewb commented Nov 4, 2019

Excellent!

Any reason this has to be done inside the generic marshaller execution rather than by defining a custom marshaler for BigInteger?

@Dewb
Copy link
Contributor

Dewb commented Nov 4, 2019

Looks like we have custom DataMarshalers for Python node inputs, but not outputs. This new code could definitely go here: https://github.com/DynamoDS/Dynamo/blob/master/src/Libraries/DSIronPython/IronPythonEvaluator.cs

The DataMarshaler class isn't used anywhere aside from the Python node so I would also support moving it out of DynamoUtilities and into the Python project, to make its purpose more clear. (Doesn't have to be part of this PR.)

@aparajit-pratap
Copy link
Contributor Author

aparajit-pratap commented Nov 5, 2019

Looks like we have custom DataMarshalers for Python node inputs, but not outputs. This new code could definitely go here: https://github.com/DynamoDS/Dynamo/blob/master/src/Libraries/DSIronPython/IronPythonEvaluator.cs

The DataMarshaler class is used for both input and output marshaling as seen here:

scope.SetVariable((string)bindingNames[i], InputMarshaler.Marshal(bindingValues[i]));
and here:
return OutputMarshaler.Marshal(result);

I agree that the marshaling for BigInteger can be specific to the output marshaling. Will make the necessary changes.

@mjkkirschner
Copy link
Member

@aparajit-pratap would you mind filing this internally?

@aparajit-pratap
Copy link
Contributor Author

aparajit-pratap commented Nov 8, 2019

Added unit test, addressed review comments about registering the BigInteger marshaling logic only for node output (output marshalers are added only in the DataMarshaler constructor, while input marshalers are added when first initializing the IronPythonEvaluator property).

I haven't moved DataMarshaler to the Python project just yet as @mjkkirschner had some other thoughts on this. Leaving it open for discussion. Aside from this, the PR is ready to be merged.

@aparajit-pratap aparajit-pratap added the PTAL Please Take A Look 👀 label Nov 8, 2019
@QilongTang QilongTang added LGTM Looks good to me and removed PTAL Please Take A Look 👀 labels Nov 11, 2019
@QilongTang
Copy link
Contributor

QilongTang commented Nov 11, 2019

LGTM with one comment

@aparajit-pratap aparajit-pratap merged commit 9d06b82 into DynamoDS:master Nov 12, 2019
@aparajit-pratap aparajit-pratap deleted the fixBigInt branch November 12, 2019 18:05
@Dewb
Copy link
Contributor

Dewb commented Nov 12, 2019

FYI the IronPython issue that prompted this is supposedly fixed in IronPython 2.7.9.

@mjkkirschner
Copy link
Member

hmm - so this test should have passed already - since we are using ironPython 2.7.9.

@aparajit-pratap do we now include system.numerics in our shipped binaries or this is loaded from the GAC?

It will be useful to know as we should communicate this in the release notes of 2.5

@aparajit-pratap
Copy link
Contributor Author

aparajit-pratap commented Nov 13, 2019

I reverted my change leaving the test to test locally. It didn't pass.

@mjkkirschner
Copy link
Member

@aparajit-pratap your test also includes a big integer check (last type in your list) - perhaps that gets marshalled to long now in all cases?

@mjkkirschner
Copy link
Member

here's Mike's issue:
IronLanguages/ironpython2#681

@aparajit-pratap
Copy link
Contributor Author

@aparajit-pratap your test also includes a big integer check (last type in your list) - perhaps that gets marshalled to long now in all cases?

This is the output I'm seeing before my change:
image

@aparajit-pratap
Copy link
Contributor Author

@aparajit-pratap do we now include system.numerics in our shipped binaries or this is loaded from the GAC?

It is loaded from GAC and referenced from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM Looks good to me
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants