Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

inspect.ismethoddescriptor(): lack of __delete__() is not checked #120381

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@zuo

Description

@zuo

Bug report

Bug description:

Theinspect.ismethoddescriptor() function reports descriptor objects which implement__delete__() but not__set__() asmethod descriptors, even though they are, in fact,data descriptors:

Actual behavior example:

>>>importinspect>>>classDescriptor:...def__get__(self,*_):pass...def__delete__(self,*_):pass# Note: `__set__()` *not* defined....>>>inspect.ismethoddescriptor(Descriptor())# Wrong result:True

Expected result:

>>>inspect.ismethoddescriptor(Descriptor())# Correct result:False

See also:https://discuss.python.org/t/inspect-ismethoddescriptor-checks-for-the-lack-of-set-but-ignores-delete-should-it-be-fixed/55039


There is an additional question:to which Python versions should the fix be applied?

IMHO, the fix can be safely applied to the branches 3.14 (main) and 3.13 (still in the beta phase). Backporting it to the earlier versions might be considered too disruptive. Obviously, the decision will need to be made by a core developer, not me.


CPython versions tested on:

3.8, 3.9, 3.10, 3.11, 3.12, 3.13, CPython main branch

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp