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

update master #1

Merged
merged 4 commits into from
Jul 6, 2020
Merged

Conversation

Astul-Betizagasti
Copy link
Owner

No description provided.

mjkkirschner and others added 4 commits July 6, 2020 10:40
* add new param key to execute session
add test
add data when execute session is created

* add python usage test

* remove using

* add todo
When unmarhsalling output data from a Python script using the CPython
engine, a StackOverlowException would occur for certain uncommon types.
The unmarshaller is trying to recursively convert the output by calling
'AsManagedObject', but in cases where Python.NET does not have a
specialized representation, like it is the case for 'weakref', it just
returns a different object pointing to the same handle. This is
causing the unmarshaller to call himself again with basically the same
underlying Python object, triggering the stack overflow.

The problem is fixed by explicitly checking if the returned object by
'AsManagedObject' has the same handle as the original one, in which
case an exception is thrown with a proper message.
Adds tests for the following conversion scenarios:
- Python list => .NET IList (CPython fails)
- .NET array => Python list
- Python tuple => .NET array
- Python tuple => .NET IList (CPython fails)
- Python range => .NET array
- Python range => .NET IList (CPython fails)
- Python dict => .NET IDictionary (CPython fails)
- .NET IDictionary => Python dict (CPython unkonwn)

Also commented out some tests that fail in both engines but may be
considered to fix in CPython:
- .NET IList => Python list (call a Python list method on an IList?)
- Python array => .NET IList (builtin library, may be uncommon) 
- Python dict => DS Dictionary (may deserve special attention)

Other types considered but not added as tests:
- classes (can't convert them)
- dictionary view objects (uncommon)
- bytes, bytearray, memoryview (uncommon)
- set, frozenset (uncommon)
- complex (uncommon)

Other scenarios that might be interesting:
- Mutability of collections (IronPython supports this for a IList)
@Astul-Betizagasti Astul-Betizagasti merged commit 1319780 into Astul-Betizagasti:master Jul 6, 2020
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.

4 participants