Skip to content

Phase 1: Can we make c wrappers immutable by default? #17

@xFrednet

Description

@xFrednet

The Py_MakeImmutable implementation has some special handling for c wrapper types with a comment:

_Py_SetImmutable(item);

if(is_c_wrapper(item)) {
    // C functions are not mutable, so we can skip them.
    goto next;
}

After talking to @mjp41 it sounds like C functions are immutable, but doing a deep freeze would cause a lot of problems, which is why Py_MakeImmutable just processes the next item. However, my add_to_region and try_close_region implementation run into the same objects and also need to handle the c wrapper types. Currently, I've opted to just freeze them, but that adds another case, which needs a lot of explanation.

So my question is: Could we just spawn c wrapper types as immutable by default?

cc: @matajoh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions