Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

The getStringViewLength and stringViewToString methods declared bytes parameter types, but contained str handling logic that was unreachable since Cython enforces type constraints at the C boundary.

Changes

  • Remove bytes type annotation from sv parameter (now untyped/object)
  • Update docstrings to reflect Union[bytes, str] acceptance
  • Existing isinstance checks and .encode() logic now reachable
# Before: str never reaches function body
def getStringViewLength(self, bytes sv):
    if isinstance(sv, str):  # unreachable
        v0 = sv.encode('utf-8')

# After: both types reach function body
def getStringViewLength(self, sv):
    if isinstance(sv, str):  # now works
        v0 = sv.encode('utf-8')

💡 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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Copilot AI changed the title [WIP] Update bytes parameter type in STL container converters tests Fix unreachable str handling in string_view wrapper methods Nov 28, 2025
@timosachsenberg timosachsenberg marked this pull request as ready for review November 28, 2025 13:23
@poshul poshul merged commit 7d9278e into stl17_support Nov 28, 2025
20 of 26 checks passed
@timosachsenberg
Copy link
Collaborator

Ah I see Sam merged it. Wasn’t sure - I think cleanup is not tested so nothing failed and I was not sure how to properly test

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.

3 participants