Is it intentional that #partial_value calls on_load?#1016
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
It is yes. |
|
I was wondering what would happen if incomplete data were passed to By the way, passing keyword arguments like |
Yes, it's because like all of JSON, there is actually no keyword arguments, it's all option hashes. I would like to transition to keyword arguments for all of But perhaps |
Fix: #1016 (comment) `json` takes option hashes across the board, mostly because its API predates the introduction of keyword arguments. I'd like to change that to only take keyword arguments and error when an unknown argument is passed, but I'm not yet sure of the backward compatibility consequences, so it might wait for the next major. But in the meantime, `ResumableParser` being a new API, it can safely use keyword arguments.
Fix: ruby/json#1016 (comment) `json` takes option hashes across the board, mostly because its API predates the introduction of keyword arguments. I'd like to change that to only take keyword arguments and error when an unknown argument is passed, but I'm not yet sure of the backward compatibility consequences, so it might wait for the next major. But in the meantime, `ResumableParser` being a new API, it can safely use keyword arguments. ruby/json@f08c66338c
Currently
#partial_valuesometimes callson_load. Is this intentional?If it is, the
in_uselock has to cover#partial_valuetoo: otherwise touching the parser from withinon_loadtriggers a use-after-free.The fix in this PR holds
in_usefor the duration of#partial_value, like#parsedoes.Personally,
#partial_valueis interesting, but I am not sure it has a real use case.