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 — Allow extensions to set a callback to be invoked when a type is modified · Issue #91051 · python/cpython

Allow extensions to set a callback to be invoked when a type is modified #91051

New issue
Copy link
New issue
Copy link
Closed
Closed
Allow extensions to set a callback to be invoked when a type is modified#91051
Copy link
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

Description

mpage
mannequin
opened on Mar 1, 2022
Issue body actions
BPO 46895
Nosy @carljm, @DinoV, @itamaro, @mpage

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-01.22:16:51.046>
labels = ['interpreter-core', 'expert-C-API', 'type-feature', '3.11']
title = 'Allow extensions to set a callback to be invoked when a type is modified'
updated_at = <Date 2022-03-01.22:21:58.988>
user = 'https://github.com/mpage'

bugs.python.org fields:

activity = <Date 2022-03-01.22:21:58.988>
actor = 'mpage'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Interpreter Core', 'C API']
creation = <Date 2022-03-01.22:16:51.046>
creator = 'mpage'
dependencies = []
files = []
hgrepos = []
issue_num = 46895
keywords = []
message_count = 1.0
messages = ['414305']
nosy_count = 4.0
nosy_names = ['carljm', 'dino.viehland', 'itamaro', 'mpage']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue46895'
versions = ['Python 3.11']

Linked PRs

  • gh-91051: fix segfault when using all 8 type watchers #107853
  • [3.12] gh-91051: fix segfault when using all 8 type watchers (GH-107853) #107876
  • gh-91051: fix type watcher test to be robust to existing watcher #107989
  • [3.12] gh-91051: fix type watcher test to be robust to existing watcher (GH-107989) #108053

Activity

Next
  1. mpage commented on Mar 1, 2022

    @mpage
    mpagemannequin
    on Mar 1, 2022
    MannequinAuthor
    More actions

    CPython extensions providing optimized execution of Python bytecode (e.g. the Cinder JIT), or even CPython itself (e.g. the faster-cpython project) may wish to cache access to lookups in the class hierarchy (e.g. when resolving the target of a method call). Extensions that perform these optimizations need to know when to invalidate the cached values. CPython already has a mechanism to invalidate its internal state (e.g. the global method cache) when a type is modified: _PyType_Modified. We propose adding an API to allow extensions to set a callback that will be invoked by _PyType_Modified whenever a type, or any ancestor of the type in the class hierarchy, changes.

    Proposed API:

    // A callback to be invoked with the modified type and optionally the name of
    // the attribute that was modified.
    typedef void(*PyType_ModifiedCallback)(PyTypeObject* type, PyObject* attr);
    
    // Set or get the callback. The callback may be cleared by supplying a NULL callback.
    void PyType_SetModifiedCallback(PyType_ModifiedCallback callback);
    PyType_ModifiedCallback PyType_GetModifiedCallback();
    
    Reacted by Oleg Iarygin, Itamar Oren and Erlend E. Aasland
  2. mpage
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    topic-C-API
    type-featureA feature request or enhancementA feature request or enhancement
    on Mar 1, 2022
  3. mpage
    changed the title [-]Type-Modified Callbacks[/-] [+]Allow extensions to set a callback to be invoked when a type is modified[/+] on Mar 1, 2022
  4. mpage
    changed the title [-]Type-Modified Callbacks[/-] [+]Allow extensions to set a callback to be invoked when a type is modified[/+] on Mar 1, 2022
  5. mpage
    added
    3.11only security fixesonly security fixes
    on Mar 1, 2022
  6. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  7. gvanrossum commented on Sep 15, 2022

    @gvanrossum
    gvanrossum
    on Sep 15, 2022
    Member
    More actions

    I don't see any discussion here. Are you still interested in getting this in 3.12? What should happen next? Is it a simple PR, or should we have a design discussion first?

  8. itamaro commented on Sep 15, 2022

    @itamaro
    itamaro
    on Sep 15, 2022
    Contributor
    More actions

    Are you still interested in getting this in 3.12?

    yes, that's the plan!

    What should happen next? Is it a simple PR, or should we have a design discussion first?

    I think this is a simple PR (similar to #91054), so the next step is to write that PR if the proposed API looks reasonable

  9. gvanrossum
    removed
    3.11only security fixesonly security fixes
    on Sep 24, 2022
  10. 10 remaining items

  11. carljm commented on Dec 8, 2022

    @carljm
    carljm
    on Dec 8, 2022
    Member
    More actions

    Fixed in #91051.

  12. carljm
    closed this as completedon Dec 8, 2022
  13. carljm
    added 4 commits that reference this issue on Aug 11, 2023

    pythongh-91051: fix segfault when using all 8 type watchers

    1980789

    pythongh-91051: fix segfault when using all 8 type watchers

    7c249fa

    pythongh-91051: fix segfault when using all 8 type watchers

    e149aed

    gh-91051: fix segfault when using all 8 type watchers (#107853)

    66e4edd
  14. miss-islington
    added a commit that references this issue on Aug 11, 2023

    pythongh-91051: fix segfault when using all 8 type watchers (pythonGH…

    4f05fc0
  15. carljm
    added a commit that references this issue on Aug 16, 2023

    pythongh-91051: fix type watcher test to be robust to existing watcher

    8c38bd5
  16. serhiy-storchaka
    reopened this on Aug 16, 2023
  17. serhiy-storchaka commented on Aug 16, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 16, 2023
    Member
    More actions

    Reopened because not all PRs were merged yet.

  18. Yhg1s
    added a commit that references this issue on Aug 16, 2023

    [3.12] gh-91051: fix segfault when using all 8 type watchers (GH-107853…

    00bfed7
  19. miss-islington
    added a commit that references this issue on Aug 16, 2023

    pythongh-91051: fix type watcher test to be robust to existing watcher (

    f785150
  20. carljm
    added a commit that references this issue on Aug 16, 2023

    gh-91051: fix type watcher test to be robust to existing watcher (#10…

    fce93c8
  21. Yhg1s
    added a commit that references this issue on Aug 16, 2023

    [3.12] gh-91051: fix type watcher test to be robust to existing watch…

    84a4370
  22. itamaro
    closed this as completedon Aug 17, 2023
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.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-C-APItype-featureA feature request or enhancementA feature request or enhancement

    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.