[issue2292] Missing *-unpacking generalizations

Joshua Landau report at bugs.python.org
Thu Jan 22 23:36:02 CET 2015


Joshua Landau added the comment:

I imagine it like (in the map unpacking code)

    func_offset = (oparg >> 8) & 0xFF;
    num_maps = oparg & 0xFF;

    // later
    if (func_offset) {
        // do checks
        if (repeated_argument) {
            raise_error_from_function(PEEK(func_offset + num_maps));
        }
    }

This code should be relatively quick, in an already-slow opcode, and rather short.

If adding to CALL_FUNCTION_XXX, you would have to add an EXTENDED_ARG opcode (because CALL_FUNCTION_XXX already uses the bottom 16 bits), add checks for the top bits in the opcode, duplicate the (large) dictionary merging function. This doesn't seem like it saves much work.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2292>
_______________________________________


More information about the Python-bugs-list mailing list