nanobind type caster between C++ Array/Vector and python cocotb.types.Array#288
Conversation
4aafedf to
7aafb25
Compare
all test bindings .cpp files are separated per binding and all python tests are now in `tests/nanobind/pytest`
7aafb25 to
5ccbe41
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #288 +/- ##
==========================================
- Coverage 92.76% 91.97% -0.79%
==========================================
Files 23 23
Lines 1285 1309 +24
Branches 312 316 +4
==========================================
+ Hits 1192 1204 +12
- Misses 34 43 +9
- Partials 59 62 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Best reviewed commit by commit |
ktbarrett
left a comment
There was a problem hiding this comment.
This is also looking very good for a first pass.
| object py_range = src.attr("range"); | ||
| int left = cast<int>(py_range.attr("left")); | ||
| int right = cast<int>(py_range.attr("right")); | ||
|
|
||
| coconext::types::Range c_range{left, right}; |
There was a problem hiding this comment.
If we have successfully patched cocotb.types.Range with coconext's versions we should be able to just nb:cast<Range>(src.attr("range")) to get the range object.
Though I understand being defensive about it.
ktbarrett
left a comment
There was a problem hiding this comment.
Also do the same changes for the Vector type.
The left and right are no longer limited to int, but to int64_t. It's best to just call out Array::index_t instead, just incase we change it again, like I did from int to int64_t.
I'm wondering if you can cut down on verbosity by using using namespace coconext::types in the caster method bodies?
2d36aa0 to
f6cfe8f
Compare
f6cfe8f to
96f361a
Compare
|
Merge when you are ready. |
Fixes #267