Skip to content

Different workaround for http://bugs.python.org/issue19611 #27

@andychu

Description

@andychu

This is much less important than the last bug, but I had an issue with the workaround in the code. (This will probably never come up for anyone else, because I'm doing something unusual: using the old pure Python compiler module, not the CPython compile.c).

I think the way I am doing it is slightly simpler though. Since you are constructing
callargs = {'.0': args[0]} anyway, I think you can just check if there is one arg and it is called .0. The name is ignored for LOAD_FAST in favor of the index (lookup by number rather than name), but the name is still emitted.

oils-for-unix/oils@65a504d#diff-702be8382fafa67a707b89a317abc246

- if PY2 and self.func_name in ["<setcomp>", "<dictcomp>", "<genexpr>"]:
+        # Different workaround for issue 19611 that works with
+        # compiler2-generated code.  Note that byterun does not use fastlocals,
+        # so the name matters.  With fastlocals, the co_varnames entry is just
+        # a comment; the index is used instead.
+        code = self.func_code
+        if code.co_argcount == 1 and code.co_varnames[0] == '.0':

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions