Skip to content

Minor refactoring of Object/abstract.c (UNARY_FUNC macro and more cases for BINARY_FUNC) #112145

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

Merged
merged 5 commits into from
Dec 5, 2023

Conversation

skirpichev
Copy link
Contributor

@skirpichev skirpichev commented Nov 16, 2023

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

// from #111996

(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
@skirpichev
Copy link
Contributor Author

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

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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.

@skirpichev
Copy link
Contributor 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.

@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
Copy link
Contributor Author

skirpichev commented Dec 3, 2023

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

Description was updated.

@serhiy-storchaka serhiy-storchaka merged commit 9f92b31 into python:main 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
…es for BINARY_FUNC) (pythonGH-112145)

* Use BINARY_FUNC macro for some remaining ops
* Add UNARY_FUNC macro to define unary PyNumber_* functions
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants