You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
For contributors:
current object_set_dict function signature doesn't support delete.
Changing it to pub fn object_set_dict(obj: PyObjectRef, dict: PySetterValue<PyDictRef>, vm: &VirtualMachine) -> PyResult<()> is the starting point.
The remaining steps will be straight-forward by understanding how PySetterValue looks like.
Activity
youknowone commentedon Jul 18, 2024
I expect that eventually be the same.
I never expect this is possible in CPython.
So this is the way to "clear"
__dict__.Mskxn commentedon Jul 18, 2024
It seems that del
__dict__is always possible in CPython (I have tried on CPython 3.10), but some relative tests have been introduced recently (3.13):https://github.com/python/cpython/blob/81fd625b5c30cc6f417c93bad404923676ad8ca3/Lib/test/test_class.py#L817
youknowone commentedon Jul 18, 2024
For contributors:
current
object_set_dictfunction signature doesn't support delete.Changing it to
pub fn object_set_dict(obj: PyObjectRef, dict: PySetterValue<PyDictRef>, vm: &VirtualMachine) -> PyResult<()>is the starting point.The remaining steps will be straight-forward by understanding how PySetterValue looks like.
fanninpm commentedon Nov 27, 2024
Just checking — did #5436 actually fix this issue?
maxweilun1989 commentedon Dec 12, 2024
@fanninpm I tried this on the latest commit and found that the issue hasn’t been resolved yet. Could you assign it to me?"
Properly handles `del val.__dict__`.
Properly handles `del val.__dict__`.
Fix del obj.__dict__ to match CPython behavior (issue RustPython#5355)
Fix del obj.__dict__ to match CPython behavior (issue RustPython#5355)
Fix del obj.__dict__ to match CPython behavior (fixes RustPython#5355) (
Fix del obj.__dict__ to match CPython behavior (fixes #5355) (#7568)