Hacker News new | past | comments | ask | show | jobs | submit login

Also Python won’t call __del__ if there are circular references! And also there are no warnings if there re circular references.



> Also Python won’t call __del__ if there are circular references!

Why not?


Python uses cycle breaking i.e. it chooses an object on a circular path and simply deletes it, which essentially bricks the entire connected set for reference counting purposes. This means that if you ran __del__ code in this circumstance it could access references to deleted objects, i.e. use after free.

__del__ is simply an unsound part of Python.


Ah I assumed it marked, ran destructors, then swept.


> Python doesn't know the order in which it's safe to destroy objects that hold circular references to each other, so as a design decision, it just doesn't call the destructors for such methods!




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: