You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AbstractContextManager should support __method__ = None #74452
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='https://github.com/Mariatta'closed_at=<Date2017-06-10.03:38:08.981>created_at=<Date2017-05-04.03:37:32.485>labels= ['3.7', 'library']
title='AbstractContextManager should support __method__ = None'updated_at=<Date2017-06-10.04:37:55.104>user='https://github.com/JelleZijlstra'
Like other ABCs, contextlib.AbstractContextManager should support the pattern where setting a method to None disables structural subtyping, which was introduced across the standard library in bpo-25958. Ivan Levkivskyi suggested making AbstractContextManager support this pattern in CR comments in https://github.com/python/cpython/pull/1412/files#r114482765.
Should this change be applied to 3.6 as well as master? I'm leaning towards yes, because the resolution to bpo-25958 (https://hg.python.org/cpython/rev/72b9f195569c) added a general statement in the documentation that "Setting a special method to None indicates that the corresponding operation is not available". Thus, the fact that contextlib.AbstractContextManager doesn't obey this rule is a bug.
New changeset 57161aa by Guido van Rossum (Jelle Zijlstra) in branch 'master': bpo-30266: support "= None" pattern in AbstractContextManager (bpo-1448) 57161aa
Activity
JelleZijlstra commentedon May 4, 2017
Like other ABCs, contextlib.AbstractContextManager should support the pattern where setting a method to None disables structural subtyping, which was introduced across the standard library in bpo-25958. Ivan Levkivskyi suggested making AbstractContextManager support this pattern in CR comments in https://github.com/python/cpython/pull/1412/files#r114482765.
Should this change be applied to 3.6 as well as master? I'm leaning towards yes, because the resolution to bpo-25958 (https://hg.python.org/cpython/rev/72b9f195569c) added a general statement in the documentation that "Setting a special method to
Noneindicates that the corresponding operation is not available". Thus, the fact that contextlib.AbstractContextManager doesn't obey this rule is a bug.I'll send a PR shortly.
gvanrossum commentedon Jun 9, 2017
New changeset 57161aa by Guido van Rossum (Jelle Zijlstra) in branch 'master':
bpo-30266: support "= None" pattern in AbstractContextManager (bpo-1448)
57161aa
gvanrossum commentedon Jun 9, 2017
This should be backported to 3.6.
Mariatta commentedon Jun 10, 2017
New changeset 753422f by Mariatta in branch '3.6':
bpo-30266: support "= None" pattern in AbstractContextManager (GH-1448) (GH-2054)
753422f
Mariatta commentedon Jun 10, 2017
PR has been backported to 3.6.
Thanks :)
gvanrossum commentedon Jun 10, 2017
Thanks Mariatta!
JelleZijlstra commentedon Jun 10, 2017
Thanks for doing the merge and backport!