GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Minor refactoring of Object/abstract.c (UNARY_FUNC macro and more cases for BINARY_FUNC) by skirpichev · Pull Request #112145 · python/cpython

Conversation

@skirpichev

@skirpichev skirpichev commented Nov 16, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Use BINARY_FUNC macro for some remaining ops
  • Add UNARY_FUNC macro to define unary PyNumber_* functions

// from #111996

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gst reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@skirpichev
Minor refactoring of Object/abstract.c
56b5e1f
(from python#111996)

* PyNumber_AsSsize_t: remove inaccessible code (PyLong_AsSsize_t raises OverflowError)
* Drop checks for broken float subclasses (like for PyNumber_Long in 31a6554)
* Ternary ops (currently only pow/ipow) don't use __r*__ dunders, thus
  removal of testing last slot in ternary_op()
* Use BINARY_FUNC macro for some remaining ops
* Add UNARY_FUNC macro to define unary PyNumber_* functions
@bedevere-app bedevere-app Bot added the awaiting review label Nov 16, 2023
@skirpichev

skirpichev commented Nov 16, 2023

Copy link
Copy Markdown
Member Author

CC @serhiy-storchaka, this was abstract.c diff from the referenced pr. I hope this can skip issue and news entry...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka reviewed Nov 16, 2023
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

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.

It deserves 4 or 5 separate issues.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Objects/abstract.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev
+ last argument for UNARY_FUNC()
b0d2f78
@skirpichev

skirpichev commented Nov 16, 2023

Copy link
Copy Markdown
Member Author

It deserves 4 or 5 separate issues.

Huh. Is it worth or code should be kept intact?

Reusing old or adding new macros is a secondary issue. All others related to a dead code (for different reasons). So, having something in common.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev added 2 commits December 3, 2023 04:16
@skirpichev
Merge branch 'main' into abstract-refactor
8fc962e
@skirpichev
revert ternary_op
46620ed
This was referenced Dec 3, 2023
Dead code in PyNumber_AsSsize_t() at L1542 #112634
Closed
Remove check for float subclasses with nb_float == NULL in PyNumber_Float() ? #112636
Closed
@skirpichev
revert everything, except UNARY/BINARY_FUNC
631259a
@skirpichev skirpichev changed the title Minor refactoring of Object/abstract.c Minor refactoring of Object/abstract.c (UNARY_FUNC macro and more cases for BINARY_FUNC) Dec 3, 2023
@skirpichev

skirpichev commented Dec 3, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@serhiy-storchaka, now this has only UNARY/BINARY_FUNC stuff. Probably this not worth an issue and can skip news.

Description was updated.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev
skirpichev requested a review from serhiy-storchaka December 3, 2023 02:43
serhiy-storchaka
serhiy-storchaka approved these changes Dec 4, 2023
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Dec 4, 2023
@serhiy-storchaka serhiy-storchaka added skip news skip issue labels Dec 4, 2023
@serhiy-storchaka
serhiy-storchaka merged commit 9f92b31 into python:main Dec 5, 2023
@bedevere-app bedevere-app Bot removed the awaiting merge label Dec 5, 2023
@skirpichev
skirpichev deleted the abstract-refactor branch December 5, 2023 07:41
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@skirpichev @aisk
Minor refactoring of Object/abstract.c (UNARY_FUNC macro and more cas…
9ad0a2e
…es for BINARY_FUNC) (pythonGH-112145)

* Use BINARY_FUNC macro for some remaining ops
* Add UNARY_FUNC macro to define unary PyNumber_* functions
@Eclips4 Eclips4 mentioned this pull request Mar 4, 2024
gh-116316: Fix typo in UNARY_FUNC(PyNumber_Positive) macros #116317
Merged
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@skirpichev @Glyphack
Minor refactoring of Object/abstract.c (UNARY_FUNC macro and more cas…
8497e8e
…es for BINARY_FUNC) (pythonGH-112145)

* Use BINARY_FUNC macro for some remaining ops
* Add UNARY_FUNC macro to define unary PyNumber_* functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip issue skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@skirpichev @serhiy-storchaka
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.