Skip to content

Conversation

@vstinner
Copy link
Member

@vstinnervstinner 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().
@vstinnervstinner marked this pull request as draft October 15, 2021 00:08
@vstinner
Copy link
MemberAuthor

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-actionsgithub-actionsbot added the stale Stale PR or inactive for long period of time. label Nov 15, 2021
@vstinner
Copy link
MemberAuthor

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-actionsgithub-actionsbot removed the stale Stale PR or inactive for long period of time. label Nov 17, 2021
@vstinner
Copy link
MemberAuthor

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 freeto 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

@vstinner@the-knights-who-say-ni@bedevere-bot