ERROR: no anchor processing for JSON when using std.parseYaml from python
- Dominant language
- Jsonnet
- Stars
- 7.6k
- Forks
- 475
- PR merge metrics
- No merged PRs in 30d
Description
When using the python bindings (jsonnet-0.20.0), an abort is hit when using `std.parseYaml` with a file containing anchors.
Steps to reproduce: using `jsonnet` import, simply `std.parseYaml` on any YAML containing anchors.
Minimal example:
```
(env) jsonnet-python-yaml]$ python3
Python 3.11.4 (main, Jul 13 2023, 11:22:49) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18.0.2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _jsonnet as jsonnet
>>> jsonnet.evaluate_snippet('test.yaml', """
... std.parseYaml(|||
... foo: &foo bar
... bar: *foo
... |||)
... """
... )
ERROR: no anchor processing for JSON
Aborted (core dumped)
```
I can confirm this same abort when using `evaluate_file` too
```
(env) jsonnet-python-yaml]$ cat test.jsonnet
std.parseYaml(|||
foo: &foo bar
bar: *foo
|||)
(env) [benjamin.jackson@stol-core1 jsonnet-python-yaml]$ python3
Python 3.11.4 (main, Jul 13 2023, 11:22:49) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18.0.2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _jsonnet as jsonnet
>>> jsonnet.evaluate_file('test.jsonnet')
ERROR: no anchor processing for JSON
Aborted (core dumped)
```
Env:
```
(env) [ jsonnet-python-yaml]$ pip freeze
jsonnet==0.20.0
(env) [jsonnet-python-yaml]$ uname -a
Linux xx 5.4.17-2011.7.4.el8uek.x86_64 #2 SMP Fri Oct 2 14:39:04 PDT 2020 x86_64 x86_64 x86_64 GNU/Linux
(env) [jsonnet-python-yaml]$ cat /etc/redhat-release
Red Hat Enterprise Linux release 8.3 (Ootpa)
```
Contributor guide
Assessment
This issue has not been assessed yet.