Skip to content

PyObject was made IEnumerable #596

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 1 commit into from
Feb 10, 2018

Conversation

dmitriyse
Copy link
Contributor

@dmitriyse dmitriyse commented Jan 12, 2018

What does this implement/fix? Explain your changes.

enumerable python object cannot be directly enumerated through PyObject.

dynamic pyCollectionObj = new PyObject(collectionObjIntPtr);
foreach (dynamic item in pyCollectionObj)
{
    // This code currently does not works.
}
...

### Does this close any currently open issues?
No
...

### Any other comments?
Tests are failed due to NUnit Assert.Equals behavior. When object is IEnumerable Assert.Equals also compares all items.
...

### 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`](../blob/master/AUTHORS.md)
-   [ ] Updated the [`CHANGELOG`](../blob/master/CHANGELOG.md)

@den-run-ai den-run-ai merged commit b8cb6c4 into pythonnet:master Feb 10, 2018
@den-run-ai
Copy link
Contributor

So weird, this pull request caused master to fail consistently in Travis CI on Python 3.5:

https://travis-ci.org/pythonnet/pythonnet/jobs/339756543#L2103

1) Failed : Python.EmbeddingTest.TestExample.TestReadme
  Expected string length 16 but was 13. Strings differ at index 2.
  Expected: "[  6.  10.  12.]"
  But was:  "[ 6. 10. 12.]"
  -------------^
at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,string,object)
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1, T2 arg2) [0x00110] in <b0fca80f08474611b248e2d30bb75230>:0
at Python.EmbeddingTest.TestExample.TestReadme () [0x00958] in <ee790b8ab98547918ddc44014a1093cd>:0

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.

2 participants