Skip to content

Inconsist with cpython in deleting __dict__ #5355

@Mskxn

Description

@Mskxn

In CPython, the following code can execute normally.

class Foo: pass
f = Foo()
print(f.__dict__)
del f.__dict__

But in rustpython, it triggers TypeError:

Traceback (most recent call last):
File "temp.py", line 4, in <module>
                  del f.__dict__
TypeError: can't delete attribute

I am not sure if it is a design or a bug.
P.S., Are there any docs to explain the consistency between CPython and rustpython, or they should be exactly the same?

Metadata

Metadata

Assignees

Labels

A-stdlibC-compatA discrepancy between RustPython and CPython

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions