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

Embedding IonPyValues in dict #95

Closed
robcalhounjr opened this issue Sep 4, 2019 · 1 comment
Closed

Embedding IonPyValues in dict #95

robcalhounjr opened this issue Sep 4, 2019 · 1 comment
Assignees

Comments

@robcalhounjr
Copy link

I'm seeing some inexplicable behavior when I embed IonPyValues in a standard dict and then load that to Ion.

from amazon.ion.simpleion import loads, dumps
my_struct = {'spam': "eggs", 'count': 12}
i_struct = loads(dumps(my_struct))
other_struct = {'other': 24, 'embedded': i_struct["count"]}
io_struct = loads(dumps(other_struct))
dumps(io_struct, binary=False)

prints:

'$ion_1_0 {other:24,count:12}'

My expectation is that it would print:

'$ion_1_0 {other:24,embedded:12}'
@dlurton dlurton self-assigned this Sep 4, 2019
dlurton added a commit that referenced this issue Sep 4, 2019
This memoization was causing #95 because the IonEvent.field_name field
was being used when writing out struct fields instead of the key of the
field within IonPyDict.  This meant that field with a value that
originated from another IonPyDict to retain field name from the original
IonPyDict.
dlurton added a commit that referenced this issue Sep 4, 2019
Remove memoization of eents in _IonNature.

This memoization was causing #95 because the IonEvent.field_name field
was being used when writing out struct fields instead of the key of the
field within IonPyDict.  This meant that field with a value that
originated from another IonPyDict to retain field name from the original
IonPyDict.
@dlurton
Copy link
Contributor

dlurton commented Sep 4, 2019

Fixed in PR #97

@dlurton dlurton closed this as completed Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants