Skip to content

object.h -Wcast-qual warning #87578

Description

@petere
mannequin
BPO 43412
Nosy @terryjreedy, @vstinner, @leifwalsh, @petere
Superseder
  • bpo-44378: Py_IS_TYPE(): cast discards ‘const’ qualifier from pointer target type
  • 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 = <Date 2021-07-01.00:05:49.727>
    created_at = <Date 2021-03-05.22:12:41.593>
    labels = ['interpreter-core', '3.10']
    title = 'object.h -Wcast-qual warning'
    updated_at = <Date 2021-07-01.00:05:49.725>
    user = 'https://github.com/petere'

    bugs.python.org fields:

    activity = <Date 2021-07-01.00:05:49.725>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-07-01.00:05:49.727>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2021-03-05.22:12:41.593>
    creator = 'petere'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43412
    keywords = []
    message_count = 5.0
    messages = ['388167', '388560', '388607', '396793', '396803']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'vstinner', 'leif.walsh', 'petere']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '44378'
    type = None
    url = 'https://bugs.python.org/issue43412'
    versions = ['Python 3.10']

    Activity

    1. petere commented on Mar 5, 2021

      peteremannequin
      MannequinAuthor

      object.h contains an inline function that causes a -Wcast-qual warning from gcc. Since this file ends up visible in third-party code that includes Python.h, this makes it impossible to use -Wcast-qual in such code.

      The problem is the change c5cb077, which replaced ob->ob_type by Py_TYPE(ob), which seems reasonable by itself, but Py_TYPE casts away the const, so it creates this problem.

      This is a regression in Python 3.10.

    2. terryjreedy commented on Mar 12, 2021

      @terryjreedy
      Member

      Victor, the apparent 3.10 regression is from your commit.

    3. vstinner commented on Mar 13, 2021

      @vstinner
      Member

      object.h contains an inline function that causes a -Wcast-qual warning from gcc.

      Which function? Can you please provide the warning?

      Do you want to propose a fix?

    4. leifwalsh commented on Jun 30, 2021

      leifwalshmannequin
      Mannequin

      Duplicated by https://bugs.python.org/issue44378, which has a fix merged.

    5. vstinner commented on Jul 1, 2021

      @vstinner
      Member

      Duplicated by https://bugs.python.org/issue44378, which has a fix merged.

      Right. I close the issue as a duplicate.

    6. transferred this issue fromon Apr 10, 2022
    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

      3.10 (EOL)end of lifeinterpreter-core(Objects, Python, Grammar, and Parser dirs)

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions