-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add FixedTuple member enforcing a given number of items #211
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #211 +/- ##
==========================================
+ Coverage 97.57% 97.67% +0.09%
==========================================
Files 24 24
Lines 1114 1075 -39
Branches 189 174 -15
==========================================
- Hits 1087 1050 -37
+ Misses 13 12 -1
+ Partials 14 13 -1 |
@frmdstryr do you have an interest in this feature and do you want to review ? |
|
||
// Create a copy in which to store the validated values | ||
Py_ssize_t size = PyTuple_GET_SIZE( newvalue ); | ||
cppy::ptr tuplecopy = PyTuple_New( size ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be moved to after the size check
This is a really nice addition! A quick test and it seems to work fine. Instead of adding a new member, what do you think about changing the existing It would be really nice if the type error would show the whole format eg The unrelated formatting changes could probably be a separate commit. |
That's a good point. I will look into it. The error message may indeed be more challenging but I will look into it. |
So the issue with re-using the same member is that it is not backward compatible. Changes to how we interpret annotations makes the system stricter but it bothers me less since it should not break anything that was previously valid. |
I am normally against breaking backwards compatibility but in this case I think it is worth it. I'm so used to using the Edit: After thinking about it more, i'd say just leave it as a separate member. |
Thanks @frmdstryr I will keep two separate members. Please note that if you use annotations instead of the actual members |
I forgot to address your comments (forgot to re-read the whole discussion). I will come back to it once I am done with #210 |
No description provided.