Skip to content

bpo-45412: Add _PY_SHORT_FLOAT_REPR macro #31171

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 1 commit into from
Feb 23, 2022
Merged

bpo-45412: Add _PY_SHORT_FLOAT_REPR macro #31171

merged 1 commit into from
Feb 23, 2022

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Feb 6, 2022

Remove the HAVE_PY_SET_53BIT_PRECISION macro (moved to the internal
C API).

  • Move HAVE_PY_SET_53BIT_PRECISION macro to pycore_pymath.h.
  • Replace PY_NO_SHORT_FLOAT_REPR macro with _PY_SHORT_FLOAT_REPR
    macro which is always defined. gcc -Wundef emits a warning when
    using _PY_SHORT_FLOAT_REPR but the macro is not defined, if
    pycore_pymath.h include was forgotten.

https://bugs.python.org/issue45412

Remove the HAVE_PY_SET_53BIT_PRECISION macro (moved to the internal
C API).

* Move HAVE_PY_SET_53BIT_PRECISION macro to pycore_pymath.h.
* Replace PY_NO_SHORT_FLOAT_REPR macro with _PY_SHORT_FLOAT_REPR
  macro which is always defined. gcc -Wundef emits a warning when
  using _PY_SHORT_FLOAT_REPR but the macro is not defined, if
  pycore_pymath.h include was forgotten.
@vstinner
Copy link
Member Author

vstinner commented Feb 6, 2022

In my PR GH-28882, I tried to avoid making these changes because:

  • It removes the public HAVE_PY_SET_53BIT_PRECISION macro.
  • pycore_pymath.h must be included, otherwise _PY_SHORT_FLOAT_REPR is not included. I replaced PY_NO_SHORT_FLOAT_REPR with _PY_SHORT_FLOAT_REPR to be able to detect such bug using gcc -Wundef.

I searched for HAVE_PY_SET_53BIT_PRECISION in the source code of top 5000 PyPI project: no project use it. But I documented the change, since it impacts the public C API.

@vstinner
Copy link
Member Author

vstinner commented Feb 6, 2022

@mdickinson: Here you have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants