Better messages when xdis not handling Python x.y

This commit is contained in:
rocky 2021-10-24 23:22:41 -04:00
parent 51ac72ba1f
commit fa203af665

View File

@ -83,7 +83,20 @@ class Token:
self.pattr = None
if opc is None:
from xdis.std import _std_api
try:
from xdis.std import _std_api
except KeyError as e:
print(f"I don't know about Python version {e} yet.")
try:
version_tuple = tuple(int(i) for i in str(e)[1:-1].split("."))
except:
pass
else:
if version_tuple > (3, 9):
print(f"Python versions 3.9 and greater are not supported.")
else:
print(f"xdis might need to be informed about version {e}")
return
self.opc = _std_api.opc
else: