Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 12, 2025

The pack_command type annotation incorrectly specified Tuple[str | int | float | bytes | memoryview], which accepts only single-element tuples. The function actually accepts variable-length tuples as evidenced by its test suite.

Changes:

  • Updated type signature from Tuple[T] to Tuple[T, ...] to accept variable-length tuples
  • Added missing -> bytes return type annotation

Example:

# These calls now type-check correctly:
libvalkey.pack_command(("SET", "key", "value"))
libvalkey.pack_command(("HSET", "foo", "key1", "val1", "key2", "val2"))

Related to redis/hiredis-py#195

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix pack_command type annotation</issue_title>
<issue_description>Similar to redis/hiredis-py#195, pack_command should be annotated to accept a tuple of more than one element. Currently it's Tuple[A], which means a tuple of exactly one element. Tuple[A, ...] is probably intended.</issue_description>

<agent_instructions>Verify if the suggested change is indeed correct</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: mkmkme <4062234+mkmkme@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix pack_command type annotation to accept multiple elements Fix pack_command type annotation to accept variable-length tuples Nov 12, 2025
Copilot AI requested a review from mkmkme November 12, 2025 23:07
Copilot finished work on behalf of mkmkme November 12, 2025 23:07
@mkmkme mkmkme marked this pull request as ready for review November 12, 2025 23:11
Copilot AI review requested due to automatic review settings November 12, 2025 23:11
@mkmkme mkmkme enabled auto-merge (squash) November 12, 2025 23:12
Copilot finished reviewing on behalf of mkmkme November 12, 2025 23:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR corrects the type annotation for the pack_command function to properly reflect that it accepts variable-length tuples rather than single-element tuples.

  • Fixed pack_command type signature from Tuple[T] to Tuple[T, ...] to accept variable-length tuples
  • Added missing -> bytes return type annotation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mkmkme mkmkme merged commit baebb61 into main Nov 13, 2025
40 checks passed
@mkmkme mkmkme deleted the copilot/fix-pack-command-annotation branch November 13, 2025 15:39
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.

Fix pack_command type annotation

3 participants