GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Require IEEE 754 floating point to build Python 3.11 · Issue #91073 · python/cpython

Require IEEE 754 floating point to build Python 3.11 #91073

New issue
Copy link
New issue
Copy link
Closed
Closed
Require IEEE 754 floating point to build Python 3.11#91073
Copy link
Assignees
vstinner
Labels
3.11only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-build

Description

@vstinner
vstinner
opened on Mar 3, 2022
Issue body actions
BPO 46917
Nosy @mdickinson, @vstinner
PRs
  • bpo-46917: Require IEEE 754 to build Python #31790
  • bpo-46917: math.nan is now always available #31793
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2022-03-03.22:39:43.097>
    labels = ['build', '3.11']
    title = 'Require IEEE 754 floating point to build Python 3.11'
    updated_at = <Date 2022-03-10.16:56:24.469>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2022-03-10.16:56:24.469>
    actor = 'vstinner'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Build']
    creation = <Date 2022-03-03.22:39:43.097>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46917
    keywords = ['patch']
    message_count = 7.0
    messages = ['414485', '414575', '414847', '414862', '414863', '414865', '414866']
    nosy_count = 2.0
    nosy_names = ['mark.dickinson', 'vstinner']
    pr_nums = ['31790', '31793']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46917'
    versions = ['Python 3.11']

    Activity

    1. vstinner commented on Mar 3, 2022

      @vstinner
      vstinner
      on Mar 3, 2022
      MemberAuthor
      More actions

      See "[Python-Dev] Should we require IEEE 754 floating-point for CPython?" thread:
      https://mail.python.org/archives/list/[email protected]/thread/J5FSP6J4EITPY5C2UJI7HSL2GQCTCUWN/

      I propose to require IEEE 754 floating-point to build Python 3.11. I propose the following build:

      • Mention the new build requirement in What's New in Python 3.11.
      • Modify configure script to make it fail if the IEEE 754 support is missing.
      • Remove code handling missing NAN and infinity: float("nan"), float("inf"), math.nan and math.inf are always available.
      • Remove @requires_IEEE_754 decorator of test.support and tests.
      • Remove "unknown_format" code path of pack/unpack functions like _PyFloat_Pack8() (see bpo-46906 which proposes to make these functions public).

      The _PY_SHORT_FLOAT_REPR==0 code path is kept. For now, platforms with float larger than 64-bit but without HAVE_PY_SET_53BIT_PRECISION are still supported (but don't get "short float repr"). See #75773 for details.

      I prepared this requirement with these two changes:

      commit 1b2611e
      Author: Victor Stinner <[email protected]>
      Date: Fri Feb 25 01:32:57 2022 +0100

      bpo-46656: Remove Py_NO_NAN macro (GH-31160)
      
      Building Python now requires support for floating point Not-a-Number
      (NaN): remove the Py_NO_NAN macro.
      

      commit 5ab745f
      Author: Victor Stinner <[email protected]>
      Date: Sat Feb 26 00:53:27 2022 +0100

      bpo-46852: Remove the float.__set_format__() method (GH-31585)
      
      Remove the undocumented private float.__set_format__() method,
      previously known as float.__set_format__() in Python 3.7. Its
      docstring said: "You probably don't want to use this function. It
      exists mainly to be used in Python's test suite."
      

      By the way, building Python 3.11 now requires a C11 compiler.

    2. vstinner
      added
      3.11only security fixesonly security fixes
      buildThe build process and cross-buildThe build process and cross-build
      on Mar 3, 2022
    3. mdickinson commented on Mar 5, 2022

      @mdickinson
      mdickinson
      on Mar 5, 2022
      Member
      More actions
      • Mention the new build requirement in What's New in Python 3.11.
      • Modify configure script to make it fail if the IEEE 754 support is missing.
      • Remove code handling missing NAN and infinity: float("nan"), float("inf"), math.nan and math.inf are always available.

      That sounds fine.

      • Remove @requires_IEEE_754 decorator of test.support and tests.

      I'd suggest leaving those decorators. Some of the tests are used by Python implementations other than CPython, and we're not requiring IEEE 754 on all Python implementations.

      • Remove "unknown_format" code path of pack/unpack functions like _PyFloat_Pack8() (see bpo-46906 which proposes to make these functions public).

      Sounds fine.

      platforms with float larger than 64-bit

      I'm assuming you mean Python "float" / C "double" here. There seems to be a persistent misunderstanding here, and I'd really like to be sure that everyone understands what the current code is doing before changing anything. There are *no* platforms that Python cares about where the C double is larger than 64-bits, and as far as I'm aware there never have been.

      What there *is* is a set of platforms where the C double is IEEE 754 binary64 format, but where arithmetic operations between doubles may be performed in extended precision (usually 64-bit precision), so those arithmetic operations don't conform strictly to IEEE 754 semantics. Most flavours of Linux on x86 match that description.

      Then there's a (possibly empty, but we don't know that for sure) subset of *that* set of platforms where we don't know how to temporarily enforce 53-bit precision during numeric parsing / formatting operations.

      It's that second subset where dtoa.c can't be used, and where we need the fallback of the "legacy" float repr.

      I'd be more than happy to deprecate and eventually remove support for the legacy float repr, but I think it's too big a change to make for 3.11: we'd need to deprecate the support for 3.11 and eventually remove it in 3.13.

    4. vstinner commented on Mar 10, 2022

      @vstinner
      vstinner
      on Mar 10, 2022
      MemberAuthor
      More actions

      New changeset 9b51fd5 by Victor Stinner in branch 'main':
      bpo-46917: Require IEEE 754 to build Python (GH-31790)
      9b51fd5

    5. vstinner commented on Mar 10, 2022

      @vstinner
      vstinner
      on Mar 10, 2022
      MemberAuthor
      More actions

      See also bpo-46906 "Add PyFloat_(Pack|Unpack)(2|4|8) to the public C API": the implementation supports non-IEEE 754 formats. Once the public C API is added, support for non-IEEE 754 formats should be removed.

    6. vstinner commented on Mar 10, 2022

      @vstinner
      vstinner
      on Mar 10, 2022
      MemberAuthor
      More actions

      New changeset 7854012 by Victor Stinner in branch 'main':
      bpo-46917: math.nan is now always available (GH-31793)
      7854012

    7. vstinner commented on Mar 10, 2022

      @vstinner
      vstinner
      on Mar 10, 2022
      MemberAuthor
      More actions

      bpo-46917: math.nan is now always available (GH-31793)

      Technically, it was already the case in practice: see bpo-46656 for the rationale and the history of Py_NAN.

    8. vstinner commented on Mar 10, 2022

      @vstinner
      vstinner
      on Mar 10, 2022
      MemberAuthor
      More actions

      Remove code handling missing NAN and infinity: float("nan"), float("inf"), math.nan and math.inf are always available.

      The code to support missing NaN was already removed by:

      New changeset 1b2611e by Victor Stinner in branch 'main':
      bpo-46656: Remove Py_NO_NAN macro (GH-31160)
      1b2611e

      In fact, math.inf is already always available in Python 3.10 and older. There was no "#ifdef" for missing infinity support. In Python 3.10, math.inf is implemented as:

      static double
      m_inf(void)
      {
      #ifndef PY_NO_SHORT_FLOAT_REPR
          return _Py_dg_infinity(0);
      #else
          return Py_HUGE_VAL;
      #endif
      }
    9. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    10. mdickinson commented on Apr 11, 2022

      @mdickinson
      mdickinson
      on Apr 11, 2022
      Member
      More actions

      @vstinner Can this be closed?

    11. vstinner commented on Apr 19, 2022

      @vstinner
      vstinner
      on Apr 19, 2022
      MemberAuthor
      More actions

      I still would like to:

      Remove "unknown_format" code path of pack/unpack functions

      Reacted by Mark Dickinson
    12. kumaraditya303
      assigned
      vstinner
      on Jul 23, 2022
    13. vstinner commented on Oct 12, 2022

      @vstinner
      vstinner
      on Oct 12, 2022
      MemberAuthor
      More actions

      Remove "unknown_format" code path of pack/unpack functions

      Sorry but I failed to find the bandwidth to get ride of this code, so I will just close the issue.

      If someone wants to work on that, please go ahead and write a PR and maybe open a new dedicated issue (specific to this).

      At least, the main part, requiring IEEE 754 to build Python, is implemented in Python 3.11! It's written in What's New in Python 3.11 ;-)

    14. vstinner
      closed this as completedon Oct 12, 2022
    15. skirpichev
      self-assigned this
      on Nov 6, 2025
    16. skirpichev
      reopened this on Nov 6, 2025
    17. vstinner commented on Nov 6, 2025

      @vstinner
      vstinner
      on Nov 6, 2025
      MemberAuthor
      More actions

      @skirpichev: Why did you reopen this old issue?

    18. skirpichev commented on Nov 6, 2025

      @skirpichev
      skirpichev
      on Nov 6, 2025
      Member
      More actions

      @vstinner, it was based on your comment:

      I still would like to: Remove "unknown_format" code path of pack/unpack functions

      Did you change your mind on this?

    19. vstinner commented on Nov 6, 2025

      @vstinner
      vstinner
      on Nov 6, 2025
      MemberAuthor
      More actions

      I tried but failed to remove this code. Go ahead if you're motivated. But since this issue was closed 3 years ago, I would suggest opening a new issue instead.

    20. skirpichev
      closed this as completedon Nov 6, 2025
    21. skirpichev
      removed their assignment
      on Mar 10, 2026
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    • @vstinner
      vstinner

    Labels

    3.11only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-build

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.