[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2021-02-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: New changeset 863eb7170b3017399fb2b786a1e3feb6457e54c2 by Miss Islington (bot) in branch '3.9': bpo-16781: In 'exec' doc, add 'nonlocal' to 'yield' and 'return' (GH-2446) https://github.com/python/cpython/commit/863eb7170b3017399fb2b786a1e3feb6457e54c2

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2021-02-06 Thread miss-islington
miss-islington added the comment: New changeset 920bf6a3a656e329c2bcbb761eb8c13c46c8cd05 by Miss Islington (bot) in branch '3.8': bpo-16781: In 'exec' doc, add 'nonlocal' to 'yield' and 'return' (GH-2446) https://github.com/python/cpython/commit/920bf6a3a656e329c2bcbb761eb8c13c46c8cd05

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2021-02-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: PR is based on 'Note:...' directly above. I am still thinking about a patch for the namespace paragraph. -- nosy: -miss-islington stage: patch review -> needs patch ___ Python tracker

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2021-02-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +23265 pull_request: https://github.com/python/cpython/pull/24471 ___ Python tracker ___

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2021-02-06 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 6.0 -> 7.0 pull_requests: +23264 pull_request: https://github.com/python/cpython/pull/24470 ___ Python tracker

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2021-02-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: New changeset 0ec57e25c918b859b9f8d464e34e0ac859c2f8b3 by Terry Jan Reedy in branch 'master': bpo-16781: In 'exec' doc, add 'nonlocal' to 'yield' and 'return' (GH-2446) https://github.com/python/cpython/commit/0ec57e25c918b859b9f8d464e34e0ac859c2f8b3

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2021-02-06 Thread Terry J. Reedy
Change by Terry J. Reedy : -- keywords: +patch pull_requests: +23263 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/24469 ___ Python tracker

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2020-11-10 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.6, Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker ___

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2012-12-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: This is at most a further doc clarification issue as the code is working as documented. In a previous issue, I added the following sentence to all current versions to try to clarify this type of behavior: If exec gets two separate objects as globals and

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2012-12-28 Thread R. David Murray
R. David Murray added the comment: It looks like you are correct Terry. The problem, I think, is that the behavior of name spaces inside a class definition is probably the least intuitive aspect of python scoping, so that sentence, while technically complete, doesn't provide enough guidance.

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2012-12-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: I suppose you could say that I kicked that particular can over to the class doc ;-). The fundamental problem with exec is that it is at least as complicated as Python, since it executes any legal python code, and in fact is even more complicated* because

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2012-12-28 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16781 ___

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2012-12-26 Thread R. David Murray
R. David Murray added the comment: Do you mean that *modifying* locals() in the function scope is undefined behavior? That makes sense, and is a documented limitation. So we need to clarify the execfile/exec documentation to note that if called in anything other than the global scope,

[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2012-12-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: The best thing would be if we could kill the default use of locals() and globals() in execfile, but that's probably Py4 material. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16781