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 — [ctypes] Do we still need `_use_broken_old_ctypes_structure_semantics_`? · Issue #99284 · python/cpython

[ctypes] Do we still need _use_broken_old_ctypes_structure_semantics_? #99284

New issue
Copy link
New issue
Copy link
Closed
Closed
[ctypes] Do we still need _use_broken_old_ctypes_structure_semantics_?#99284
Copy link
Labels
topic-ctypestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@sobolevn
sobolevn
opened on Nov 9, 2022
Issue body actions

While working on #99283 I've noticed this piece of code:

cpython/Modules/_ctypes/stgdict.c

Lines 360 to 364 in 0124b5d

/* HACK Alert: I cannot be bothered to fix ctypes.com, so there has to
be a way to use the old, broken semantics: _fields_ are not extended
but replaced in subclasses.
XXX Remove this in ctypes 1.0!

cpython/Modules/_ctypes/stgdict.c

Lines 382 to 383 in 0124b5d

if (_PyObject_LookupAttr(type,
&_Py_ID(_use_broken_old_ctypes_structure_semantics_), &tmp) < 0)

I've never seen this before, so I went and searched for this on the internet: https://cs.github.com/?scopeName=All+repos&scope=&q=_use_broken_old_ctypes_structure_semantics_

Looks like not a single GitHub project uses it.

Where is that used inside?

» ag _use_broken_old_ctypes_structure_semantics_
Tools/c-analyzer/cpython/globals-to-fix.tsv
761:Modules/_ctypes/stgdict.c   PyCStructUnionType_update_stgdict       PyId__use_broken_old_ctypes_structure_semantics_      -

Include/internal/pycore_global_strings.h
253:        STRUCT_FOR_ID(_use_broken_old_ctypes_structure_semantics_)

Include/internal/pycore_runtime_init_generated.h
762:                INIT_ID(_use_broken_old_ctypes_structure_semantics_), \
1879:    string = &_Py_ID(_use_broken_old_ctypes_structure_semantics_);
5734:    if (Py_REFCNT((PyObject *)&_Py_ID(_use_broken_old_ctypes_structure_semantics_)) < _PyObject_IMMORTAL_REFCNT) {
5735:        _PyObject_Dump((PyObject *)&_Py_ID(_use_broken_old_ctypes_structure_semantics_));

Modules/_ctypes/stgdict.c
383:                &_Py_ID(_use_broken_old_ctypes_structure_semantics_), &tmp) < 0)

Basically in only one place (and generate code).
No docs, no tests.
No issues: https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+use_broken_old_ctypes_structure_semantics

And it feels like a python2 era thing.
I think it is time to remove it.

PR is on its way, so we can discuss the changes in more details.
CC @pitrou as the original author.

  • PR: gh-99284: [ctypes] remove _use_broken_old_ctypes_structure_semantics_ #99285

Activity

  1. sobolevn
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    topic-ctypes
    on Nov 9, 2022
  2. sobolevn
    added a commit that references this issue on Nov 9, 2022

    pythongh-99284: [ctypes] remove `_use_broken_old_ctypes_structure_sem…

    63d1574
  3. gpshead
    added a commit that references this issue on Nov 19, 2022

    gh-99284: [ctypes] remove `_use_broken_old_ctypes_structure_semantic…

    a3360fa
  4. vstinner commented on Nov 19, 2022

    @vstinner
    vstinner
    on Nov 19, 2022
    Member
    More actions

    Fixed by a3360fa

  5. vstinner
    closed this as completedon Nov 19, 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

    topic-ctypestype-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.