rocky/python-xdis

make_std_api has examples showing float input; requires sys.version_info

charles-dyfis-net opened this issue · 1 comments

From the code:

    from xdis.std import make_std_api
    dis = make_std_api(2.4)
    # dis can now disassemble code objects from python 2.4

In practice:

>>> from xdis.std import make_std_api
>>> dis = make_std_api(2.4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/6dsfg70znajh7h5x80pgk7adc5v4ayw4-python2.7-xdis-3.8.7/lib/python2.7/site-packages/xdis/std.py", line 208, in make_std_api
    return _StdApi(python_version, variant)
  File "/nix/store/6dsfg70znajh7h5x80pgk7adc5v4ayw4-python2.7-xdis-3.8.7/lib/python2.7/site-packages/xdis/std.py", line 72, in __init__
    self.opc = opc = get_opcode_module(python_version, variant)
  File "/nix/store/6dsfg70znajh7h5x80pgk7adc5v4ayw4-python2.7-xdis-3.8.7/lib/python2.7/site-packages/xdis/op_imports.py", line 116, in get_opcode_module
    vers_str = '.'.join([str(v) for v in version_info[0:3]])
TypeError: 'float' object has no attribute '__getitem__'

Frankly, it surprises me that I haven't found a mechanism to get a dis interface given a magic integer -- one would need to have one to read a .pyc file, after all. Presumably haven't poked around the API enough.