pyasn1's getComponentByName() method modifies the internal data structure to materialize the component. This changes the value of a CHOICE data structure. The problem caused bug #192.
I talked Ilya about the issue. There are multiple ways to solve the problem:
- use the native encoder, which turns an ASN.1 data structure in a nice Python data structure, available since pyasn1 0.2.1
- for choices, replace
c.getComponentByName("value") code with "value" in c, fully supported since pyasn1 0.3.4
- use
c.getComponentByName("value", instantiate=False), available since pyasn1 0.4.1
I'd prefer to rewrite all pyasn1 handling to native encoder, but that's much more work. Most controls are not covered by proper unit and integration tests, too. Since we already require pyasn1 >= 0.3.7, option 2 is the simplest way to go.
pyasn1's
getComponentByName()method modifies the internal data structure to materialize the component. This changes the value of a CHOICE data structure. The problem caused bug #192.I talked Ilya about the issue. There are multiple ways to solve the problem:
c.getComponentByName("value")code with"value" in c, fully supported since pyasn1 0.3.4c.getComponentByName("value", instantiate=False), available since pyasn1 0.4.1I'd prefer to rewrite all pyasn1 handling to native encoder, but that's much more work. Most controls are not covered by proper unit and integration tests, too. Since we already require pyasn1 >= 0.3.7, option 2 is the simplest way to go.