Skip to content

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