More errors when using default values with numeric enumerated fields
After the fixes of 0.155.2 for my previous issue, the example code now throws this exception:
Traceback (most recent call last):
File "/home/navetal/tests/example.py", line 5, in <module>
c = asn1tools.compile_files('./example.asn', fmt, numeric_enums=numeric)
File "/home/navetal/tests/venv/lib/python3.8/site-packages/asn1tools/compiler.py", line 376, in compile_files
return compile_dict(parse_files(filenames, encoding),
File "/home/navetal/tests/venv/lib/python3.8/site-packages/asn1tools/compiler.py", line 308, in compile_dict
return Specification(codec.compile_dict(specification,
File "/home/navetal/tests/venv/lib/python3.8/site-packages/asn1tools/codecs/ber.py", line 1692, in compile_dict
return Compiler(specification, numeric_enums).process()
File "/home/navetal/tests/venv/lib/python3.8/site-packages/asn1tools/codecs/compiler.py", line 199, in process
self.pre_process()
File "/home/navetal/tests/venv/lib/python3.8/site-packages/asn1tools/codecs/compiler.py", line 243, in pre_process
self.pre_process_default_value(type_descriptors, module_name)
File "/home/navetal/tests/venv/lib/python3.8/site-packages/asn1tools/codecs/compiler.py", line 441, in pre_process_default_value
for key, value in member['values']:
KeyError: 'values'
Process finished with exit code 1
I beleive the erroneous line (asn1tools/codecs/compiler.py, line 441) should be for key, value in resolved_member['values']: instead (it seems to have fixed the problems in my code and the example code I used to test it).
Update: When downloading the package using pip3 it seems the very line I said seemed to cause problems has been fixed just like I thought it should be, but the version in this repo (and the one PyCharm downloaded using its package manager, which is probably this one) doesn't...
Odd.
Yep, didn't catch this in my new unit test, since the enum used there was defined inside the sequence and did not need to be resolved.
I will fix it now, your suggestion is correct.