Skip to content

fix: correct isinstance check to include bytearray in kafka conversion#267

Merged
xSAVIKx merged 1 commit intocloudevents:v2from
sophotechlabs:fix/kafka-bytearray-isinstance
Mar 7, 2026
Merged

fix: correct isinstance check to include bytearray in kafka conversion#267
xSAVIKx merged 1 commit intocloudevents:v2from
sophotechlabs:fix/kafka-bytearray-isinstance

Conversation

@archy-rock3t-cloud
Copy link

@archy-rock3t-cloud archy-rock3t-cloud commented Mar 2, 2026

Changes

isinstance(data, (bytes, bytes, memoryview)) in v1/kafka/conversion.py has bytes listed twice — the second should be bytearray, matching core/bindings/kafka.py and v1/event/base.py.

One line description for the changelog

Fix isinstance check to include bytearray in kafka structured conversion

  • Tests pass
  • Appropriate changes to README are included in PR

The isinstance check in to_structured had a duplicate `bytes` entry
instead of `bytearray`, meaning bytearray data would not be correctly
base64-encoded in the structured kafka message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Artem Muterko <artem@sopho.tech>
@archy-rock3t-cloud archy-rock3t-cloud force-pushed the fix/kafka-bytearray-isinstance branch from 89fabd9 to c6cb965 Compare March 2, 2026 20:12
@xSAVIKx xSAVIKx merged commit 47b02d1 into cloudevents:v2 Mar 7, 2026
19 checks passed
@xSAVIKx
Copy link
Member

xSAVIKx commented Mar 7, 2026

Thank you for the fix @archy-rock3t-cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants