-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
make Pin hashable #6342
make Pin hashable #6342
Conversation
Can you use this existing function? mp_obj_t mp_generic_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
switch (op) {
case MP_UNARY_OP_HASH:
return MP_OBJ_NEW_SMALL_INT((mp_uint_t)o_in);
default:
return MP_OBJ_NULL; // op not supported
}
} It's used, for instance, for function objects unary op slot so that they can be set members... |
Oh, sure, I didn't realize it existed. I have some other places I can use it too. |
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.
Thank you! Looks good, didn't test. Too bad none of the other savings are in things enabled in our tiniest ports.
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.
I don't see what changed since the previous iteration, still looks OK as long as it's green.
There was a stray |
Fixes #6179.
I keep encountering cases where I would like to
microcontroller.Pin
objects to be in aset()
or be dictionary keys.