Skip to content

bpo-45412: Add _PY_SHORT_FLOAT_REPR macro#31171

Merged
vstinner merged 1 commit intopython:mainfrom
vstinner:pycore_pymath
Feb 23, 2022
Merged

bpo-45412: Add _PY_SHORT_FLOAT_REPR macro#31171
vstinner merged 1 commit intopython:mainfrom
vstinner:pycore_pymath

Conversation

@vstinner
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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