Skip to content

Conversation

@Daetalus
Copy link
Contributor

No description provided.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the role of these functions -- they seem named after the typeobject.c functions, but
behave a bit more like instance_pow. Regardless, maybe in this situation we should just copy instance_pow and instance_ipow from CPython? Your slot_nb_power seems reasonable (though a bit hard to verify all the corner cases); I think inplace_power is missing the fallback to __pow__ and __rpow__.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that ok to copy these code? Or use a "Pyston way" function? Such as generic_binary_op could replaced by _instanceBinary function. But for other functions, such as half_binop and do_pow, it contains logic. So either rewrite it ( like the last version of commit), or call the CPython version.

@kmod
Copy link
Collaborator

kmod commented Jul 28, 2015

I think copying the cpython code is the right approach here -- we can go back and make changes to it if we need to, but basically it just saves so many headaches to use code that we know is right :) We might want at some point to reduce the duplication by having our functions call the cpython ones you just copied.

kmod added a commit that referenced this pull request Jul 28, 2015
Numeric binary operator support for old style class
@kmod kmod merged commit f7367f1 into pyston:master Jul 28, 2015
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