This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mwilbz
Recipients carljm, levkivskyi, methane, mwilbz, serhiy.storchaka, sir-sigurd, vstinner
Date 2018-11-20.16:25:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542731127.74.0.788709270274.issue34995@psf.upfronthosting.co.za>
In-reply-to
Content
Inada-san, I think it's fair to ask for a broader vision about how ABCs are used. In that respect I'm wondering about some inconsistencies in the existing functools module about whether wrappers should maintain the wrapped function's __isabstractmethod__ attribute.

Both singledispatchmethod and partialmethod implement their own way of copying __isabstractmethod__ from the wrapped function. singledispatchmethod does this in addition to calling update_wrapper, whereas partialmethod doesn't seem to use update_wrapper at all.

In terms of a broader vision, then, should the decorators in functools be more consistent about whether the __isabstractmethod__ attribute of a wrapped function is preserved in the wrapped version? Should update_wrapper be the way to standardize this? If so, it would make sense either to remove the __isabstractmethod__ copying from those decorators, or otherwise to add __isabstractmethod__ to the list of attributes that are copied from the wrapped function by update_wrapper.

Hopefully viewing the problem in this way avoids the pitfalls of adding random code to the codebase, as you are pointing out. Let me know if this discussion belongs in a broader issue than this one. Thank you :)
History
Date User Action Args
2018-11-20 16:25:27mwilbzsetrecipients: + mwilbz, vstinner, carljm, methane, serhiy.storchaka, levkivskyi, sir-sigurd
2018-11-20 16:25:27mwilbzsetmessageid: <1542731127.74.0.788709270274.issue34995@psf.upfronthosting.co.za>
2018-11-20 16:25:27mwilbzlinkissue34995 messages
2018-11-20 16:25:27mwilbzcreate