]> granicus.if.org Git - python/commit
[3.6] bpo-32176: Set CO_NOFREE in the code object constructor (GH-4684)
authorNick Coghlan <ncoghlan@gmail.com>
Sun, 3 Dec 2017 13:32:54 +0000 (23:32 +1000)
committerGitHub <noreply@github.com>
Sun, 3 Dec 2017 13:32:54 +0000 (23:32 +1000)
commitc8f32aae0aa173e122cf4c0592caec620d0d1de9
treea12510b536a9b6bb07c9370c3ef1eb89144dc991
parent2ad350a713360e89ae6d264924cd28f519b8b22c
[3.6] bpo-32176: Set CO_NOFREE in the code object constructor (GH-4684)

Previously, CO_NOFREE was set in the compiler, which meant
it could end up being set incorrectly when code objects
were created directly. Setting it in the constructor based
on freevars and cellvars ensures it is always accurate,
regardless of how the code object is defined.

(cherry picked from commit 078f1814f1a4413a2a0fdb8cf4490ee0fc98ef34)
Lib/test/test_code.py
Misc/NEWS.d/next/Core and Builtins/2017-12-02-21-37-22.bpo-32176.Wt25-N.rst [new file with mode: 0644]
Objects/codeobject.c
Python/compile.c