[issue36366] Patcher stop method should be idempotent

2019-03-28 Thread Brett Cannon
Brett Cannon added the comment: Thanks, everyone! -- nosy: +brett.cannon resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue36366] Patcher stop method should be idempotent

2019-03-28 Thread miss-islington
miss-islington added the comment: New changeset 02b84cb1b4f5407309c81c8b1ae0397355d6e568 by Miss Islington (bot) (Xtreak) in branch 'master': bpo-36366: Return None on stopping unstarted patch object (GH-12472) https://github.com/python/cpython/commit/02b84cb1b4f5407309c81c8b1ae0397355d6e568

[issue36366] Patcher stop method should be idempotent

2019-03-20 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- keywords: +patch pull_requests: +12424 stage: -> patch review ___ Python tracker ___ ___ Py

[issue36366] Patcher stop method should be idempotent

2019-03-19 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Thanks for the confirmation. I will raise a PR for this. -- ___ Python tracker ___ ___

[issue36366] Patcher stop method should be idempotent

2019-03-19 Thread Michael Foord
Michael Foord added the comment: It's almost certainly an oversight rather than a design decision. I'd be happy with the change you suggest Karthikeyan. -- ___ Python tracker ___

[issue36366] Patcher stop method should be idempotent

2019-03-19 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: When mock.patch is creates a patch object and patch.start calls __enter__ that sets is_local. On stop __exit__ is called where a check is done is to make sure is_local attribute is present and then cleanup is done along with deleting calling del se

[issue36366] Patcher stop method should be idempotent

2019-03-19 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +cjw296, mariocj89, michael.foord ___ Python tracker ___ ___ Python-bugs-list mailing

[issue36366] Patcher stop method should be idempotent

2019-03-19 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: @Samuel, 1. What's the version of Python? 2. Could you provide a script with an example? Thank you -- nosy: +matrixise ___ Python tracker _

[issue36366] Patcher stop method should be idempotent

2019-03-19 Thread Samuel Freilich
New submission from Samuel Freilich : Currently, it's an error to call the stop() method of a patcher object created by mock.patch repeatedly: >>> patch = mock.patch.object(Foo, 'BAR', 'x') >>> patch.start() 'x' >>> patch.stop() >>> patch.stop() RuntimeError: stop called on unstarted patcher