Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue36188

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Remove vestiges of Python 2 unbound methods from Python 3
Type:Stage:resolved
Components:Interpreter CoreVersions:Python 3.8, Python 3.7, Python 3.6
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: benjamin.peterson, mjpieters
Priority:normalKeywords:patch

Created on2019-03-04 18:05 bymjpieters, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 12169mergedmjpieters,2019-03-04 18:09
Messages (2)
msg337142 -(view)Author: Martijn Pieters (mjpieters)*Date: 2019-03-04 18:05
The implementation of method_hash, method_call and method_descr_get all still contain assumptions that __self__ can be set to None, a holdover from Python 2 where methods could be *unbound*.These vestiges can safely be removed, because method_new() and PyMethod_New() both ensure that self is always non-null.In addition, the datamodel description of methods includes this section:      When a user-defined method object is created by retrieving another method      object from a class or instance, the behaviour is the same as for a      function object, except that the :attr:`__func__` attribute of the new      instance is not the original method object but its :attr:`__func__`      attribute.which also only applies to Python 2 unbound methods. Python 3 bound methods never change what they are bound to, let alone produce a new method object from __get__ that has to be careful about what __func__ is set to.I'm submitting a PR that removes these vestiges, no need to maintain code that never runs.
msg337167 -(view)Author: Benjamin Peterson (benjamin.peterson)*(Python committer)Date: 2019-03-05 05:19
New changesetb727239575894b060db37792e86aab818c00817a by Benjamin Peterson (Martijn Pieters) in branch 'master':closesbpo-36188: Clean up 'unbound' method left-overs. (GH-12169)https://github.com/python/cpython/commit/b727239575894b060db37792e86aab818c00817a
History
DateUserActionArgs
2022-04-11 14:59:12adminsetgithub: 80369
2019-03-05 05:19:38benjamin.petersonsetstatus: open -> closed

nosy: +benjamin.peterson
messages: +msg337167

resolution: fixed
stage: patch review -> resolved
2019-03-04 18:09:13mjpieterssetkeywords: +patch
stage: patch review
pull_requests: +pull_request12167
2019-03-04 18:05:02mjpieterscreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp