Message351001
A weak reference may try to invoke a callback object that is being
cleaned (tp_clear) by the garbage collector and it may be in an
inconsistent state. As the garbage collector explicitly does not
invoke callbacks that are part of the same cycle isolate as the
weak reference (pretending that the weak reference was destroyed first),
we should act in the same way when invoking callbacks using Objects/weakrefobject.c:handle_callback.
For example, consider the following scenario:
- F is a function.
- An object O is in a cycle with F.
- O has a weak reference with F as a callback.
When running the garbage collector, is possible to end in Objects/weakrefobject.c:handle_callback if the tp_clear of F decrements the references of O, invoking the weak
reference callback that will try to call F, which is in an incosistent
state as is in the middle of its tp_clear and some internal fields may
be NULL. |
|
Date |
User |
Action |
Args |
2019-09-02 13:56:33 | pablogsal | set | recipients:
+ pablogsal, pitrou, vstinner |
2019-09-02 13:56:33 | pablogsal | set | messageid: <1567432593.55.0.481148483159.issue38009@roundup.psfhosted.org> |
2019-09-02 13:56:33 | pablogsal | link | issue38009 messages |
2019-09-02 13:56:33 | pablogsal | create | |
|