Author ncoghlan
Recipients bup, ncoghlan
Date 2017-12-02.04:16:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Given that, I'd say the way to cleanest way to fix this would be to remove these lines from "compute_code_flags" in compile.c:

    if (!PyDict_GET_SIZE(c->u->u_freevars) &&
        !PyDict_GET_SIZE(c->u->u_cellvars)) {
        flags |= CO_NOFREE;

and replace them with a check like the following in PyCode_New just after we ensure the Unicode string for the filename is ready:

    if (!PyTuple_GET_SIZE(freevars) &&
        !PyTuple_GET_SIZE(cellvars)) {
        flags |= CO_NOFREE;

That way CO_NOFREE will be set only when appropriate regardless of how the code object is created, rather than relying on the caller to set it correctly.
Date User Action Args
2017-12-02 04:16:57ncoghlansetrecipients: + ncoghlan, bup
2017-12-02 04:16:57ncoghlansetmessageid: <>
2017-12-02 04:16:57ncoghlanlinkissue32176 messages
2017-12-02 04:16:56ncoghlancreate