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 — In C++, Python 3.11 C API introduces new compiler warnings/errors · Issue #92135 · python/cpython

In C++, Python 3.11 C API introduces new compiler warnings/errors #92135

New issue
Copy link
New issue
Copy link
Closed
Closed
In C++, Python 3.11 C API introduces new compiler warnings/errors#92135
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@vstinner
vstinner
opened on May 2, 2022
Issue body actions

To fix C++ compiler warnings about "old-style casts", I recently modified the Python C API to use C++ reinterpret_cast<> and static_cast<>: #91959

Previously, "old-style cast" like (PyObject*)expr didn't emit a compiler warning if expr was const. Now with the new cast, C++ compilers emit warnings: see #91959 (comment)

const_cast<> can be used to fix this issue.

Note: PEP 670 was accepted with the condition: converting macros to functions must not introduce new compiler warnings (so no new compile errors neither). But most functions modified in Python 3.11 (to use C++ casts) were already static inline functions in Python 3.10.

Activity

  1. vstinner
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on May 2, 2022
  2. vstinner commented on May 2, 2022

    @vstinner
    vstinner
    on May 2, 2022
    MemberAuthor
    More actions

    Documentation:

    • const_cast
    • reinterpret_cast
  3. vstinner
    added a commit that references this issue on May 2, 2022

    gh-92135: Fix _Py_reinterpret_cast() for const (#92138)

    0313970
  4. vstinner commented on May 2, 2022

    @vstinner
    vstinner
    on May 2, 2022
    MemberAuthor
    More actions

    Fixed by #92138

  5. vstinner
    closed this as completedon May 2, 2022
  6. vstinner
    added a commit that references this issue on May 3, 2022

    gh-92135: Rename _Py_reinterpret_cast() to _Py_CAST() (#92230)

    fbd5539
  7. tiran
    added 2 commits that reference this issue on May 5, 2022

    pythongh-92135: test_cppext requires subprocess

    6b7635f

    gh-92135: test_cppext requires subprocess (GH-92349)

    bb35d65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    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.