Commit 4adde68
committed
Disable unsafe identical code folding in BOLT
astral-sh/uv#13610 reported a misbehavior that is the result of a subclass of
str incorrectly having its ->tp_as_number->nb_add slot filled in with the value
of PyUnicode_Type->tp_as_sequence->sq_concat. There are some times when this is
an appropriate thing to do iwhen subclassing, but this is not one of them. The
logic to prevent it in this case relies on two helper functions in the file,
wrap_binaryfunc and wrap_binaryfunc_l, having different addresses, even though
they contain identical code.
For some reason BOLT does not do this optimization in the shared library
(even though those are static functions and not exported), so we only
started seeing this in the static build.1 parent 482a9bc commit 4adde68
2 files changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
274 | 279 | | |
275 | 280 | | |
276 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments