Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using type size in condition yields exception #559

Closed
senier opened this issue Jan 24, 2021 · 1 comment · Fixed by #614
Closed

Using type size in condition yields exception #559

senier opened this issue Jan 24, 2021 · 1 comment · Fixed by #614
Assignees
Labels
bug pyrflx Related to pyrflx package (Legacy Python API)

Comments

@senier
Copy link
Member

senier commented Jan 24, 2021

When using Some_Type'Size in a condition, PyRFLX crashes with an exception when parsing a message. Most likely this problem is similar to #525 and the solution is to substitute occurences of Some_Type'Size by the actual size of the type.

package Test is
   type T1 is mod 2**8;
   type Message is
      message
         F1 : T1
            then F2
               if F1 = Test::T1'Size;
         F2 : T1;
      end message;
end Test;
#!/usr/bin/env python3
from rflx.pyrflx import PyRFLX
SPECS = PyRFLX.from_specs(["test.rflx"], True)
TEST = SPECS["Test"]
message = TEST["Message"]
message.parse(bytes([8, 3]))
Traceback (most recent call last):
  File "./test.py", line 6, in <module>
    message.parse(bytes([8, 3]))
  File "pyrflx/typevalue.py", line 726, in parse
    current_field = self._fields[current_field_name]
KeyError: ''
@senier senier added bug pyrflx Related to pyrflx package (Legacy Python API) labels Jan 24, 2021
@jklmnn jklmnn self-assigned this Jan 24, 2021
@treiher treiher assigned rssen and unassigned jklmnn Mar 22, 2021
@treiher
Copy link
Collaborator

treiher commented Mar 22, 2021

@rssen Could you please have a look at that? I suppose the fix for this issue should be rather simple, probably _simplified_mapping just has to be extended.

rssen added a commit that referenced this issue Mar 25, 2021
rssen added a commit that referenced this issue Mar 25, 2021
@treiher treiher linked a pull request Mar 25, 2021 that will close this issue
84 tasks
rssen added a commit that referenced this issue Mar 25, 2021
rssen added a commit that referenced this issue Mar 25, 2021
rssen added a commit that referenced this issue Mar 25, 2021
rssen added a commit that referenced this issue Mar 25, 2021
@treiher treiher mentioned this issue Aug 4, 2021
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pyrflx Related to pyrflx package (Legacy Python API)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants