msg186290 - (view) |
Author: Michael Foord (michael.foord) *  |
Date: 2013-04-08 10:48 |
When patching builtin names (e.g. open) in a specific namespace you need to specify "create=True" or patch will refuse to create a name that doesn't exist. patch could whitelist the builtin names, when the patch target is a module object, to not require the "create=True". |
|
|
msg186291 - (view) |
Author: Kushal Das (kushal.das) *  |
Date: 2013-04-08 10:52 |
Working on this. |
|
|
msg186301 - (view) |
Author: Kushal Das (kushal.das) *  |
Date: 2013-04-08 13:26 |
Initial patchset along with documentation and tests update. |
|
|
msg186323 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2013-04-08 18:17 |
To be honest this proposal sounds like a quirk more than a feature to me. If you only special-case builtins, people will have to remember that special case and it will make the API more complicated. |
|
|
msg186347 - (view) |
Author: Michael Foord (michael.foord) *  |
Date: 2013-04-08 21:02 |
I don't think that's a particular issue. In general you only need to use "create=True" if a name is *not* available in a namespace. Builtin names are odd in that you can use them in a namespace even though they don't exist there - so you have to *remember* to use "create=True" even though the name *is* available. So this issue is about fixing that quirk. |
|
|
msg215917 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2014-04-11 06:21 |
Reviewed on Rietveld. |
|
|
msg216113 - (view) |
Author: Kushal Das (kushal.das) *  |
Date: 2014-04-14 17:07 |
Updated patch with builtins module. |
|
|
msg216201 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2014-04-14 20:25 |
New changeset e457de60028c by Michael Foord in branch 'default': Closes issue 17660. You no longer need to explicitly pass create=True when patching builtin names. http://hg.python.org/cpython/rev/e457de60028c |
|
|
msg216360 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2014-04-15 18:52 |
+ .. note:: I think using a note directive is not necessary here. Also it looks a bit ugly :) https://dl.dropboxusercontent.com/u/166024/issue17660.png + .. versionchanged:: 3.5 + If you are patching builtins in a module then you don't + need to pass `create=True`, it will be added by default. |
|
|
msg216364 - (view) |
Author: Michael Foord (michael.foord) *  |
Date: 2014-04-15 19:26 |
Personally I don't think it looks ugly and that it is a point worth calling out. Other opinions welcomed. |
|
|
msg216366 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2014-04-15 19:28 |
I noticed this in the commit; I don’t think the rendered output is really ugly, but the markup does look strange, as it’s two nested note(-like) directives. |
|
|