Commit b47926d
committed
WIP Adding WB to object.c
- [ ] Line 1176: if(Py_CHECKWRITE(v)){
- [ ] Line 1193: if(Py_CHECKWRITE(v)){
- [x] Line 1639: if(!Py_CHECKWRITE(obj)){
The first two cases are in `PyObject_SetAttr`.
I believe that `PyObject_SetAttr` falls out for free with the default
`tp_setattro` implementation which simply calls `PyObjectGenericSetAttr`
which in turn always ends up in `dictobject.c` -- unless we hit line
1567 which uses `tp_descr_set`, overloading of `__set__`.
However, `__set__` descriptors' behaviour should fall out for free as
they will eventually hit a "normal" store which should be trapped by
the write barrier.
The normal `tp_setattro` implementation is changed by `__setattr__`
being overridden by user. We should expect things to fall out for free
in this case since that code will eventually hit a "normal" store.
Exceptions: unless the implementation of `__setattr__` or `__set__` is
written in C. **Question: how to handle this case?**
The third and last case is a call to `PyObject_GenericSetDict` which
is the setter for `o.__dict__ = v`. In this case, we need an add ref
on the v and a remove ref on the old value of `o.__dict__`. This has
been implemented. However, I have so far been unable to trigger this
code. `o.__dict__ = v` runs `subtype_setdict` which I have extended
in a similar fashion.
I have potentially discovered a couple of places missing a CHECKWRITE
which I will report on in an issue.1 parent 338f19e commit b47926d
File tree
4 files changed
+25
-4
lines changed- Include/internal
- Objects
4 files changed
+25
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1667 | 1667 | | |
1668 | 1668 | | |
1669 | 1669 | | |
1670 | | - | |
1671 | | - | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
1672 | 1676 | | |
1673 | 1677 | | |
1674 | 1678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1297 | 1297 | | |
1298 | 1298 | | |
1299 | 1299 | | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
1300 | 1307 | | |
1301 | 1308 | | |
1302 | 1309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
2940 | 2941 | | |
2941 | 2942 | | |
2942 | 2943 | | |
2943 | | - | |
2944 | | - | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
2945 | 2953 | | |
2946 | 2954 | | |
2947 | 2955 | | |
| |||
0 commit comments