Skip to content

fix doubled_tree_sitter_prefix in python binding (with null check) #5

Open
ScottRBK wants to merge 2 commits intoCodeAnt-AI:mainfrom
ScottRBK:main
Open

fix doubled_tree_sitter_prefix in python binding (with null check) #5
ScottRBK wants to merge 2 commits intoCodeAnt-AI:mainfrom
ScottRBK:main

Conversation

@ScottRBK
Copy link

@ScottRBK ScottRBK commented Feb 5, 2026

User description

The tree-sitter CLI scaffolding generated binding.c with a doubled prefix (tree_sitter_tree_sitter_vb_dotnet) because the repo name tree-sitter-vb-dotnet already contains the tree-sitter- prefix.

The actual grammar in parser.c export tree_sitter_vb_dotnet. This causes an ImportError: undefined symbol at runtime, making the Python package unusable.

Changes:

  • Fix function name in binding.c to match parser.c export
  • Add NULL check on the return value before wrapping in PyCapsule (following code ant bot nitpick :))

CodeAnt-AI Description

Fix Python binding name and add null check for VB.NET grammar

What Changed

  • The Python binding now uses the correct exported grammar symbol so importing the package no longer fails with an undefined symbol error
  • If the VB.NET grammar fails to load, the module raises a clear RuntimeError instead of producing an invalid capsule or crashing

Impact

✅ Fixes ImportError on package import
✅ Clearer error when grammar fails to load
✅ Python VB.NET binding is now usable

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The scaffolding tool generated tree_sitter_tree_sitter_vb_dotnet() but
parser.c exports tree_sitter_vb_dotnet(). This caused an undefined symbol
error on import.
@codeant-ai
Copy link

codeant-ai bot commented Feb 5, 2026

CodeAnt AI is reviewing your PR.

@codeant-ai codeant-ai bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Feb 5, 2026
@codeant-ai
Copy link

codeant-ai bot commented Feb 5, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Symbol mismatch
    Ensure the declared function name tree_sitter_vb_dotnet exactly matches the exported symbol from the generated parser (parser.c). If the parser still exports a different name the Python import will fail at runtime with an undefined symbol.

@codeant-ai
Copy link

codeant-ai bot commented Feb 5, 2026

CodeAnt AI finished reviewing your PR.

@ScottRBK
Copy link
Author

ScottRBK commented Feb 5, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Symbol mismatchEnsure the declared function name tree_sitter_vb_dotnet exactly matches the exported symbol from the generated parser (parser.c). If the parser still exports a different name the Python import will fail at runtime with an undefined symbol.

the symbols match and this is exactly what the change is for so should be fine for merge.

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

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants