Skip to content

clrmethod working for python 2 #494

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 8 commits into from
Jun 16, 2017

Conversation

rickardraysearch
Copy link
Contributor

@rickardraysearch rickardraysearch commented Jun 15, 2017

What does this implement/fix? Explain your changes.

The issue #492 . It does this by replacing the call to PyIter_Check (which checks whether the object is an iterator) in PyObject.IsIterable by a call to the new method PyObject_IsIterable (which checks whether the object is an iterable). It also fixes the PyIter_Check for python 2, which has probably never worked.
...

Does this close any currently open issues?

#492
...

Any other comments?

...

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

@rickardraysearch rickardraysearch changed the title Rickardraysearch/issue 492 clrmethod working for python 2 Jun 15, 2017
@codecov
Copy link

codecov bot commented Jun 15, 2017

Codecov Report

Merging #494 into master will increase coverage by 2.14%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #494      +/-   ##
==========================================
+ Coverage   74.24%   76.38%   +2.14%     
==========================================
  Files          64       64              
  Lines        5564     5573       +9     
  Branches      894      896       +2     
==========================================
+ Hits         4131     4257     +126     
+ Misses       1147     1021     -126     
- Partials      286      295       +9
Flag Coverage Δ
#setup_linux 75.71% <ø> (ø) ⬆️
#setup_windows 75.74% <100%> (+2.14%) ⬆️
Impacted Files Coverage Δ
src/runtime/runtime.cs 90.83% <100%> (+2.3%) ⬆️
src/runtime/pyobject.cs 39.14% <100%> (+0.85%) ⬆️
src/runtime/moduleobject.cs 85.05% <0%> (+0.57%) ⬆️
src/runtime/methodbinding.cs 80% <0%> (+2%) ⬆️
src/runtime/classderived.cs 80.43% <0%> (+22.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d39f9f6...4be925f. Read the comment docs.

@rickardraysearch
Copy link
Contributor Author

It's a bit strange to do the Runtime.PyObject_IsIterable and Runtime.PyIter_Check tests from python, but I didn't want to add a new nunit project for the new unit tests. Possibly, that's something to consider for the future. Or is there a good place for nunit tests not related to the embedding?

@rickardraysearch rickardraysearch force-pushed the rickardraysearch/issue-492 branch from df75164 to 1a85eef Compare June 15, 2017 23:03
@filmor
Copy link
Member

filmor commented Jun 16, 2017

I don't see a problem with adding those tests to what is currently called EmbeddingTests.

@rickardraysearch rickardraysearch force-pushed the rickardraysearch/issue-492 branch from 964c937 to c9d7b71 Compare June 16, 2017 11:42
@rickardraysearch rickardraysearch force-pushed the rickardraysearch/issue-492 branch from c9d7b71 to 4be925f Compare June 16, 2017 11:52
@filmor filmor merged commit 12af794 into pythonnet:master Jun 16, 2017
@filmor
Copy link
Member

filmor commented Jun 16, 2017

Thank you very much for this :)

testrunner123 pushed a commit to testrunner123/pythonnet that referenced this pull request Sep 22, 2017
* Add Runtime.PyObject_IsIterable and fix PyIter_Check for Python 2

* Add test_clrmethod.py and update AUTHORS and CHANGELOG

* Fix test docstrings

* Use IntPtr.Zero instead of null for comparisons with IntPtrs

* Add test on Runtime.PyObject_IsIterable and Runtime.PyIter_Check

* Use the already defined TypeFlags.HaveIter instead of redefining it

* Add PyIter_Check and PyObject_IsIterable tests on threading.Lock, which does not have type feature iter

* Move the tests from test_runtime.py to TestRuntime.py
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