[issue15471] importlib's __import__() argument style nit
Roundup Robot added the comment: New changeset 4240282a9f4a by Brett Cannon in branch 'default': Issue #15471: Don't use mutable object as default values for the http://hg.python.org/cpython/rev/4240282a9f4a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15471] importlib's __import__() argument style nit
Changes by Brett Cannon br...@python.org: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15471] importlib's __import__() argument style nit
Barry A. Warsaw added the comment: On Aug 05, 2012, at 11:50 PM, Brett Cannon wrote: I went with Barry's approach but made it compatible with PEP 8 (bad, FLUFL; no unneeded parens!). I actually think I picked that up from the big guy himself, but I could be misremembering. ;) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15471] importlib's __import__() argument style nit
Brett Cannon added the comment: Attached is a patch that drops all mutable default arguments to __import__() and updates the docs. I went with Barry's approach but made it compatible with PEP 8 (bad, FLUFL; no unneeded parens!). I also ignored the locals argument since __import__ doesn't even use it. Assigning to Georg as a release blocker to make a call as to whether I can apply this to 3.3 of if I need to wait until 3.4 since this is not a critical fix but a good thing to do. Just assign back to me once the decision has been made. -- assignee: brett.cannon - georg.brandl nosy: +georg.brandl priority: low - release blocker stage: patch review - commit review Added file: http://bugs.python.org/file26705/immutable_defaults_for_import.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15471] importlib's __import__() argument style nit
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15471] importlib's __import__() argument style nit
Meador Inge added the comment: LGTM. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15471] importlib's __import__() argument style nit
Georg Brandl added the comment: Looks good and safe to me. +1. -- assignee: georg.brandl - brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15471] importlib's __import__() argument style nit
Barry A. Warsaw added the comment: On Jul 30, 2012, at 04:39 AM, Meador Inge wrote: Meador Inge added the comment: How about the attached? What about something like: globals = ({} if globals is None else globals) and similarly for locals? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15471] importlib's __import__() argument style nit
Meador Inge added the comment: How about the attached? -- keywords: +patch nosy: +meador.inge stage: - patch review type: - behavior Added file: http://bugs.python.org/file26592/issue-15471.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15471] importlib's __import__() argument style nit
New submission from Barry A. Warsaw ba...@python.org: Very minor style nit. In general, it's not considered good style to use mutable objects in default argument values. importlib's _bootstrap.__import__() does just this for its globals, locals, and fromlist arguments. The implementation currently doesn't abuse this, or allow any of the extensions to abuse, it may be possible in the future to naively cause negative side-effects due to mutate the keyword arguments. It would be better to use non-mutable default values in the argument list. -- assignee: brett.cannon components: Library (Lib) keywords: easy messages: 166585 nosy: barry, brett.cannon priority: low severity: normal status: open title: importlib's __import__() argument style nit versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15471 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com