Skip to content

Inconsistency in whether function setters call _PyFunction_SetVersion #109998

Closed
@JelleZijlstra

Description

@JelleZijlstra

Bug report

The function object has a number of settable attributes. For the following, setting the value calls _PyFunction_SetVersion(op, 0):

  • __defaults__
  • __kwdefaults__
  • __code__
  • __annotations__

But for the following, there is no such call:

  • __dict__
  • __name__
  • __qualname__
  • __type_params__

I don't think any of these four should affect the interpreter loop, but neither should __annotations__. Should these setters also set the version for consistency, or should __annotations__ not set it as changing the annotations shouldn't affect the runtime?

cc @markshannon who added this in #27078.

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions