Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-86069: Do not ignore the third argument in slot_nb_inplace_power()#130225

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
serhiy-storchaka wants to merge6 commits intopython:main
base:main
Choose a base branch
Loading
fromserhiy-storchaka:nb_inplace_power-3rd-arg

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedFeb 17, 2025
edited by bedevere-appbot
Loading

The default implementation of the nb_inplace_power slot no longer ignores the third argument, but passes it to the__ipow__ method if its value is not None.

…ower()The default implementation of the nb_inplace_power slot no longerignores the third argument, but passes it to the __ipow__ methodif its value is not None.
Copy link
Contributor

@skirpichevskirpichev left a comment

Choose a reason for hiding this comment

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

This looks fine from the technical side, but I'm not sure if this is a good idea.

  1. Apparently, this 3-arg form isn't used somewhere for years.
  2. There is no way to invoke this from pure-Python. Do we have some in-place shortcut for this stuff in some other language?
  3. PyNumber_InPlacePower() still wrong: "The operation is done in-place when o1 supports it. This is the equivalent of the Python statement o1 **= o2 when o3 isPy_None, or an in-place variant of pow(o1, o2, o3) otherwise." There is no in-place variant of pow().

IMO, better to drop the module argument from__ipow__().

@serhiy-storchaka
Copy link
MemberAuthor

There is no in-place variant of pow().

Yes, this is hypothetical in-place variant of pow(). If there was some function, it would be used in the documentation.

The current behavior is inconsistent. If__ipow__ is not defined, then the third argument is not ignored, but passed to__pow__. If__ipow__ is defined, then the third argument is ignored. For extension classes it is not ignored, it is only ignored for Python classes.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@skirpichevskirpichevskirpichev approved these changes

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

@willingcwillingcAwaiting requested review from willingcwillingc is a code owner

@AA-TurnerAA-TurnerAwaiting requested review from AA-TurnerAA-Turner is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@serhiy-storchaka@skirpichev

[8]ページ先頭

©2009-2025 Movatter.jp