Repository navigation
Add get_key and get_value_type to dict_pkg - #1229
Conversation
|
Needed by the Python dict support in VUnit/vunit-python-bridge#11, which enumerates a |
|
Also fixes |
Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The pointer pool recycles pointers that can be longer than requested, while dict_t uses the pointer lengths as the bucket count and bucket sizes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
e719a52 to
4899efe
Compare
Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
to_string(natural) is VHDL-2008 only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dict_t argument needs get_key and get_value_type of dict_pkg. Revert before merging, once a VUnit release has them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Needs the new_dict fix of VUnit/vunit#1229. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The dict_t argument needs get_key and get_value_type of dict_pkg. Revert before merging, once a VUnit release has them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| @@ -0,0 +1 @@ | |||
| Added ``get_key`` and ``get_value_type`` to ``dict_pkg`` for enumerating a ``dict_t`` and reading each value by type. | |||
There was a problem hiding this comment.
The shall be named after the PR number, i.e. 1229.feature.rst.
There was a problem hiding this comment.
Fixed in 52e807a: renamed to docs/news.d/1229.feature.rst.
| @@ -0,0 +1 @@ | |||
| Fixed ``new_dict`` crashing after ``deallocate`` of a dict that had grown beyond one bucket, caused by recycled pointers being longer than requested. | |||
There was a problem hiding this comment.
The shall be named after the PR number, i.e. 1229.bugfix.rst.
There was a problem hiding this comment.
Fixed in 52e807a: renamed to docs/news.d/1229.bugfix.rst.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Why
The vunit-python-bridge needs to enumerate a dict_t and read each value by type through public subprograms, without touching the private p_bucket_* fields.
API added (dict_pkg)
get_key: 0 <= index < num_keys(dict); order unspecified but stable while the dict is unmodified; reports an error if out of range. get_value_type reports an error if the key is missing. dict_pkg-2008p needs no change.
Tests
New tb_dict case enumerating a dict of mixed types, checking get_key/get_value_type after remove and across a resize (200 keys). Ran with NVC: 41 of 41 pass in the data_types run.py (tb_dict). The out-of-range error path is not tested (no existing failing-check pattern in tb_dict).
A news fragment is included.
🤖 Generated with Claude Code