Skip to content

Fix evaluate_class_def for Assign Attribute target in LocalPythonExecutor #1357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

albertvillanova
Copy link
Member

@albertvillanova albertvillanova commented May 20, 2025

Fix evaluate_class_def for Assign Attribute target in LocalPythonExecutor.

Currently, the following code raises an error:

class B:
    dummy = 1

class A:
    b = B()
    b.c = "value"

A.b.c

InterpreterError: Code execution failed at line 'A.b.c' due to: AttributeError: 'B' object has no attribute 'c'

Additionally, currently it behaves unexpectedly:

class B:
    c = 1

class A:
    b = B()
    b.c = "value"

A.b.c  # equals 1 instead of "value"

@albertvillanova albertvillanova changed the title Fix evaluate_class_def for Assign Attribute target Fix evaluate_class_def for Assign Attribute target in LocalPythonExecutor May 20, 2025
@albertvillanova albertvillanova merged commit 0a9c53a into huggingface:main May 21, 2025
3 checks passed
@albertvillanova albertvillanova deleted the fix-class-def-assign-attribute-target branch May 21, 2025 14:18
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.

2 participants