Closed cheqianh closed 1 year ago
This looks good, but would you mind adding a few more tests that demonstrate that constructor invocations that were possible before the migration away from _IonNature are still possible after this change?
Sure, I had tests in the PR, but they were reverted by accident. I'll include them in the next commit.
Description:
This PR is working on fixing https://github.com/amazon-ion/ion-python/issues/297. Users use the constructor and
from_value
method to construct Ion values. After the deprecation of IonNature, the constructor of IonPyObjects now have afrom_value
-like signature.Problem statement:
there are a few concerns we have, we need to
In this PR, I allowed both (1) Users should be able to use
from_value
method to construct Ion values. (2) Users should be able to use IonPyObjects' constructor to construct Ion values, where it's inherited from their parent class (E.g., most of them are native python class such as Int, string)However, to minimize the risk of breaking existing usage, the C extension return value constructions fall back to using
from_value
method so that IonValues constructions can reuse the existing signature.Perf Benchmarking
which introduces a 5% perf decrement. (3.5% comparing the original refactor PR)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.