Revive util and add comprehensive tests.
#865
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #445.
Revives the
utilmodule by fixing a critical bug, and introduces a comprehensive test suite.The
utilmodule provides essential helper functions for advanced COM interoperability, but it has lacked dedicated tests.Fixing a
RuntimeErrorin_calc_offsetThe function was incorrectly comparing the
PyCArgObject.tag(abytesliteral,b'P') with astrliteral ("P"), causing the validation to fail and aRuntimeErrorto be raised.This has been corrected by changing the literal to
b'P', allowing the function to work as intended.Adding comprehensive tests for
utilfunctionsbyref_atTests now cover basic ctypes, array offsets, pointer arithmetic simulation, COM interfaces, large offsets, and memory safety.
cast_fieldTests validate behavior with basic ctypes, type reinterpretation, pointers, nested structures/unions, arrays, and v-table-like structures.