Skip to content

Conversation

Copy link

Copilot AI commented Feb 8, 2026

InternalPythonInterpreter raised "AugAssign is not supported" when encountering augmented assignment operators (+=, -=, *=, etc.), breaking code execution for common Python patterns.

from camel.prompts import CodePrompt
from camel.interpreters import InternalPythonInterpreter

# Previously failed with "AugAssign is not supported"
code_prompt = CodePrompt("a = 1 + 1\na += 1", code_type="python")
output = code_prompt.execute(interpreter=InternalPythonInterpreter())
# Now returns: 3

Changes

  • Added _execute_augassign method - Handles all augmented assignment operators (+=, -=, *=, /=, //=, %=, **=, <<=, >>=, |=, ^=, &=, @=)
  • Updated AST dispatcher - Routes ast.AugAssign nodes to the new handler
  • Updated tests - Replaced failing test with comprehensive validation of augmented assignment operations

The implementation follows the existing pattern used for binary operators in _execute_binop.

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] AugAssign is not supported in PythonInterpreter</issue_title>
<issue_description>### Required prerequisites

What version of camel are you using?

0.1.1

System information

3.10.11 (main, May 15 2023, 19:29:30) [Clang 14.0.6 ] darwin
0.1.1

Problem description

1 code_prompt = CodePrompt("a = 1 + 1\na += 1", code_type="python")
----> 2 output, state = code_prompt.execute()


InterpreterError: Evaluation of the code stopped at node 1. See:
AugAssign is not supported.

Reproducible example code

The Python snippets:

Command lines:

Extra dependencies:


Steps to reproduce:

Traceback

No response

Expected behavior

No response

Additional context

No response</issue_description>

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

@dandansamax Thank you for your feedback! BTW, #400 changes the default code interpreter to subprocess interpreter. It can be a work around. Could you please check that?

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix AugAssign support in PythonInterpreter Add augmented assignment operator support to InternalPythonInterpreter Feb 8, 2026
Copilot AI requested a review from lightaime February 8, 2026 02:40
@lightaime lightaime marked this pull request as ready for review February 8, 2026 03:09
Copy link
Collaborator

@waleedalzarooni waleedalzarooni left a comment

Choose a reason for hiding this comment

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

LGTM

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.

[BUG] AugAssign is not supported in PythonInterpreter

3 participants