cdgriffith / cdgriffith/Box

Segfault (infinite recursion?) when loading YAML schema into Box with `box_dots=True`

Open
#265 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
2.8k
Forks
135
PR merge metrics
No merged PRs in 30d

Description

I have a YAML schema (see [here](https://github.com/calliope-project/calliope/blob/main/src/calliope/config/config_schema.yaml)) which I want to be able to get the flattened dict keys for - something that `Box` is well placed to provide with its dot notation.

However, I get a segfault when loading the YAML file with:

```python
from box import Box
schema = Box.from_yaml("path/to/schema.yaml", default_box=True, box_dots=True)
```

It loads successfully with:

```python
from box import Box
schema = Box.from_yaml("path/to/schema.yaml")
```

But then I lose the ability to inspect the flattened keys (`schema.keys(dotted=True)`).

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with calliope/config/config_schema.yaml using Box.from_yaml(..., default_box=True, box_dots=True), then compare it with loading the same YAML without those options. Trace the recursion or crash during schema loading; done means the schema loads without a segfault and schema.keys(dotted=True) remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.