Skip to content

bpo-45476: Convert PyFloat_AS_DOUBLE() to static inline #28961

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

Closed
wants to merge 1 commit into from
Closed

bpo-45476: Convert PyFloat_AS_DOUBLE() to static inline #28961

wants to merge 1 commit into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Oct 14, 2021

Convert the following macros to static inline functions to disallow
using them as l-value:

  • PyByteArray_AS_STRING()
  • PyBytes_AS_STRING()
  • PyFloat_AS_DOUBLE()

PyUnicode_AS_UNICODE() becomes an alias to PyUnicode_AsUnicode().

https://bugs.python.org/issue45476

Convert the following macros to static inline functions to disallow
using them as l-value:

* PyByteArray_AS_STRING()
* PyBytes_AS_STRING()
* PyFloat_AS_DOUBLE()

PyUnicode_AS_UNICODE() becomes an alias to PyUnicode_AsUnicode().
@vstinner vstinner marked this pull request as draft October 15, 2021 00:08
@vstinner
Copy link
Member Author

I convert this PR to a draft since there is disagreement: https://bugs.python.org/issue45476#msg403956

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Nov 15, 2021
@vstinner
Copy link
Member Author

I wrote PEP 670 https://www.python.org/dev/peps/pep-0670/ to decide what's the best approach to fix https://bugs.python.org/issue45476

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Nov 17, 2021
@vstinner
Copy link
Member Author

The PEP 670 is not accepted yet. This PR does two things:

  • (1) disallow using macros as l-value
  • (2) convert macros to static inline functions

Since both changes seem to be controversial, I prefer to limit the change to (1): I wrote the PR #28976 for that. I abandon this PR for now.

Once the (1) change will be done and the PEP 670 will be accepted, it will be non controversial to convert these macros to static inline functions.

For now, I prefer to abandon this PR.

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.

3 participants