Skip to content

json.load doesn't properly forward array_hook to json.loads #149056

@KowalskiThomas

Description

@KowalskiThomas

Bug report

Bug description

The recently introduced array_hook parameter to json.load isn't being forwarded to json.loads, making it a no-op (it is always None).

This very simple reproducer shows it -- it fails with an Assertion Error.

fp = StringIO('[10, 20, 30]')
result = self.json.load(fp, array_hook=tuple)
assert isinstance(result, tuple)

CPython versions tested on

CPython main branch

Operating systems tested on

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions