Skip to content

A better JSON check_circular #137103

@aivarsk

Description

@aivarsk

Feature or enhancement

Proposal:

json.dump(check_circular=True) uses a dictionary to track all objects already visited and creates keys with PyLong_FromVoidPtr. There is another solution for recursive container types in CPython already: Py_ReprEnter and Py_ReprLeave.

I have a patch to replace the dictionary and custom object tracking with the CPython functions and that removes some code and also avoids allocating Long objects for each recursive call.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-refactorCode refactoring (with no changes in behavior)

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy