Message268485
Thanks Serhiy. I've attached a new file (issue27122_broken_cm.py) with a context manager that is deliberately buggy in the same way as contextlib._GeneratorContextManager is currently, so the new test can be made independent of #27122 being fixed (Greg Smith has a pending patch to make that CM well behaved again, which would currently lead to your new test passing for the wrong reasons)
issue27122_broken_cm.py also shows why I think "make it work" is the right answer here - the odd context chaining is tolerated in the case where the interpreter is implicitly setting the exception context, so I believe it should also be tolerated when ExitStack sets the context explicitly. If we "do the right thing" (where "right" = "the same as what the interpreter does") in the setter, then not only ExitStack, but anyone else setting __context__ should automatically benefit from the adjustment. |
|
Date |
User |
Action |
Args |
2016-06-13 23:03:57 | ncoghlan | set | recipients:
+ ncoghlan, gvanrossum, georg.brandl, gregory.p.smith, vstinner, larry, Yury.Selivanov, serhiy.storchaka, yselivanov, oconnor663, Rotem Yaari |
2016-06-13 23:03:57 | ncoghlan | set | messageid: <1465859037.17.0.208706878098.issue25782@psf.upfronthosting.co.za> |
2016-06-13 23:03:57 | ncoghlan | link | issue25782 messages |
2016-06-13 23:03:57 | ncoghlan | create | |
|