[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2019-12-14 Thread Géry
Géry added the comment: @ncoghlan > Reviewing the discussion, I assume this was left open to cover reordering the > __aenter__ and __aexit__ checks for async with, but that can just as easily > be handled as a separate issue (which would also be clearer at the NEWS > level). Here it is:

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2019-12-14 Thread Géry
Change by Géry : -- pull_requests: +17081 pull_request: https://github.com/python/cpython/pull/17609 ___ Python tracker ___ ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2019-12-14 Thread Géry
Change by Géry : -- pull_requests: -17079 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2019-12-14 Thread Géry
Change by Géry : -- pull_requests: +17079 pull_request: https://github.com/python/cpython/pull/17609 ___ Python tracker ___ ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2019-12-13 Thread Géry
Change by Géry : -- nosy: +maggyero ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2017-04-04 Thread Nick Coghlan
Nick Coghlan added the comment: Reviewing the discussion, I assume this was left open to cover reordering the __aenter__ and __aexit__ checks for async with, but that can just as easily be handled as a separate issue (which would also be clearer at the NEWS level). -- stage: patch

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2017-04-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Can this be closed now? -- ___ Python tracker ___ ___ Python-bugs-list

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2017-04-01 Thread Martin Panter
Changes by Martin Panter : -- nosy: -martin.panter ___ Python tracker ___ ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2017-03-31 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: -1060 ___ Python tracker ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2017-03-31 Thread Donald Stufft
Changes by Donald Stufft : -- pull_requests: +1060 ___ Python tracker ___ ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-24 Thread Roundup Robot
Roundup Robot added the comment: New changeset e11df6aa5bf1 by Raymond Hettinger in branch '3.6': Issue #27100: Silence deprecation warning in Lib/test/test_with.py https://hg.python.org/cpython/rev/e11df6aa5bf1 -- ___ Python tracker

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Since the patch is simple and fixes a regression introduced > just before releasing beta 4, I'm fine with fixing it. We are > trying to support tests warnings-free. Some buildbots can run > tests with -We. +1 --

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Oh, how I missed this? I usually run tests with -Wa. Since the patch is simple and fixes a regression introduced just before releasing beta 4, I'm fine with fixing it. We are trying to support tests warnings-free. Some buildbots can run tests with -We.

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-23 Thread Martin Panter
Martin Panter added the comment: The tests changes also produce a DeprecationWarning: == ERROR: testEnterAttributeError1 (test.test_with.FailureTestCase) --

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: Yuri, do you want to do the same for async-with? -- assignee: rhettinger -> yselivanov priority: release blocker -> normal ___ Python tracker

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Roundup Robot
Roundup Robot added the comment: New changeset 749c5d6c4ba5 by Raymond Hettinger in branch '3.6': Issue #27100: Fix ref leak https://hg.python.org/cpython/rev/749c5d6c4ba5 -- ___ Python tracker

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The patch LGTM. -- assignee: serhiy.storchaka -> rhettinger ___ Python tracker ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: Serhiy, do you care to double check this patch? Martin, I'll leave the async_with for Yuri to fix-up. I believe that is his code, so he should do the honors. -- assignee: rhettinger -> serhiy.storchaka nosy: +serhiy.storchaka, yselivanov

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Raymond Hettinger
Changes by Raymond Hettinger : Added file: http://bugs.python.org/file45604/fix_with_refleak.diff ___ Python tracker ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- Removed message: http://bugs.python.org/msg281495 ___ Python tracker ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: Martin, do you want to make a patch? -- ___ Python tracker ___ ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- priority: normal -> release blocker ___ Python tracker ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Martin Panter
Martin Panter added the comment: Hmm, it seems I already discovered this leak six months ago: https://bugs.python.org/review/27100 -- ___ Python tracker

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-22 Thread Martin Panter
Martin Panter added the comment: https://mail.python.org/pipermail/python-checkins/2016-November/147171.html test_collections leaked [0, 0, 7] memory blocks, sum=7 test_contextlib leaked [38, 38, 38] references, sum=114 test_contextlib leaked [13, 12, 12] memory blocks, sum=37 test_descr leaked

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the patch Jonathan. Nick, thanks for chiming in. -- resolution: -> fixed status: open -> closed ___ Python tracker

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-11-21 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3aafb232f2db by Raymond Hettinger in branch '3.6': Issue #27100: With statement reports missing __enter__ before __exit__. (Contributed by Jonathan Ellington.) https://hg.python.org/cpython/rev/3aafb232f2db -- nosy: +python-dev

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-09-29 Thread Nick Coghlan
Nick Coghlan added the comment: Due to the expected semantics of AttributeError being relatively precise, changing to a protocol check rather than just changing the order we look up the protocol attributes would also involving changing from AttributeError to TypeError. Since that's a

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-09-28 Thread Spencer Brown
Spencer Brown added the comment: Alternatively, SETUP_WITH could additionally check for the other method, and raise an AttributeError with a custom message mentioning both methods. -- nosy: +Spencer Brown ___ Python tracker

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-09-28 Thread Ned Deily
Changes by Ned Deily : -- stage: -> patch review versions: +Python 3.6 ___ Python tracker ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-09-28 Thread Nick Coghlan
Nick Coghlan added the comment: +1 for 3.6 from me - as you say, this is fixing a usability bug in the error handling rather than being a new feature. -- ___ Python tracker

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-09-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I don't see any problem with switching the lookup order now, > and I agree that should be less confusing, Thanks Nick. I concur as well and will apply this. Would it be reasonable to apply this to 3.6? IMO, it isn't a new feature, it is more of a

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-09-27 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- versions: +Python 3.7 -Python 3.6 ___ Python tracker ___

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-05-24 Thread Nick Coghlan
Nick Coghlan added the comment: As Jonathan notes, the cause for confusion here is that we currently retrieve the attributes in the opposite order from the way we execute them, prompting the "Why is it looking for __exit__ first?", "Oh, __enter__ must be optional, so it didn't care that it

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-05-23 Thread Benjamin Peterson
Benjamin Peterson added the comment: I don't completely understand. If you get an AttributeError for __enter__, will you think only an __enter__ is required? -- nosy: +benjamin.peterson ___ Python tracker

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-05-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Nick, I've seen the come-up several times with people learning about context managers. The current error message seems cause confusion because it checks for __exit__ before __enter__, implying that the __enter__ is optional which it isn't. Do you have

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-05-23 Thread Xiang Zhang
Xiang Zhang added the comment: This seems to be designed. From PEP343 it tells clearly: If either of the relevant methods are not found as expected, the interpreter will raise AttributeError, in the order that they are tried (__exit__, __enter__). But currently I don't find out

[issue27100] Attempting to use class with both __enter__ & __exit__ undefined yields __exit__ attribute error

2016-05-23 Thread Jonathan Ellington
New submission from Jonathan Ellington: Attempting to use class that has both __exit__() and __enter__() undefined as a context manager yields an AttributeError referring to __exit__: >>> class A(): ... pass ... >>> with A(): ... pass ... Traceback (most recent call last): File "",