Skip to content

fix: add AugAssign and AnnAssign support to InternalPythonInterpreter#3960

Open
r266-tech wants to merge 1 commit intocamel-ai:masterfrom
r266-tech:fix/augassign-support
Open

fix: add AugAssign and AnnAssign support to InternalPythonInterpreter#3960
r266-tech wants to merge 1 commit intocamel-ai:masterfrom
r266-tech:fix/augassign-support

Conversation

@r266-tech
Copy link
Copy Markdown

Related Issue

Fixes #418

Description

The currently raises when encountering augmented assignment operators like . This is a commonly-used Python construct that should be supported.

Changes

  • _execute_augassign(): New method handling all augmented assignment operators:

    • Arithmetic: +=, -=, *=, /=, //=, %=, **=
    • Bitwise: <<=, >>=, &=, |=, ^=
    • Matrix: @=
    • Supports both simple names (x += 1) and subscript targets (lst[0] += 1)
  • _execute_annassign(): New method handling annotated assignments (e.g., x: int = 5). Declarations without values (e.g., x: int) return None.

  • Tests: Updated the existing test that expected AugAssign to fail, replaced with comprehensive tests for all operators and annotated assignments.

Verification

Checklist

  • I have read and agree to the AI-Generated Code Policy (required)
  • I have linked this PR to an issue (required)
  • I have checked that no dependencies need to be added or updated
  • I have updated the tests accordingly
  • No documentation changes needed (internal interpreter feature)

Fixes camel-ai#418

- Add _execute_augassign() method supporting all augmented assignment
  operators: +=, -=, *=, /=, //=, %=, **, <<, >>, &, |, ^, @
- Add _execute_annassign() method for annotated assignments (e.g. x: int = 5)
- Update test_expression_not_support to test_augassign_add (now passes)
- Add tests for multiple augassign operators and annotated assignments
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 22, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 20ba0f3d-9b8c-4d35-ab7e-550c989857b8

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

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

1 participant