Validate coderef literal

Based on bytecode.c:create_code_objects(), there is one coderef object
per frame, so check the given number against the number of frames.