Skip to content

Segfaut following param_descrs garbage collection #7622

@clslgrnc

Description

@clslgrnc
sys.version='3.10.12 (main, Feb  4 2025, 14:57:36) [GCC 11.4.0]'
z3.get_full_version()='4.14.1.0'

The following consistently leads to a segmentation fault:

import z3

z3.Context().param_descrs()
z3.Context()  # --> Segmentation fault

or equivalently:

import z3

a = z3.Context().param_descrs()
del a
z3.Context()  # --> Segmentation fault

If the result of z3.Context().param_descrs() is not explicitly or implicitly (by not being assigned to a variable) discarded, then the code terminate without any error:

import z3

a = z3.Context().param_descrs()
z3.Context()  # Ok

param_descrs returns the global parameter description set. I suspect its ref count is not properly set and python does not know of the global holding it.

param_descrs was introduced by 7da9f12 in version 4.9.0, all versions seem to be affected.

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