rocky / rocky/python-xdis

xdis.std.Instruction should not take "has_arg" parameter #86

Open
#32 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
371
Forks
106
PR merge metrics
No merged PRs in 30d

Description

Although we want has_stdarg in the underlying bytecode instruction, in in std.Instruction() it shouldn't be passed as a parameter but computed based on the opc, e.g. has_arg = opname >= opc.HAVE_ARGUMENT.

In an ideal world, fields argrepr and opname wouldn't need to be passed in std.Instruction(). We could either create another function or have setting these to be None to mean that they get filled in. And opname probably should be checked against opcode.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at xdis.std.Instruction and inspect how has_stdarg, has_arg, argrepr, opname, and opcode are represented; compare the current argument handling with opc.HAVE_ARGUMENT. Consider how omitted argrepr and opname should be filled and how opname should be checked against opcode. Done means the Instruction interface no longer requires has_arg and the requested consistency checks and defaults are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, devtools
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.