Commit d022f72
Fix the signature of tp_new (#687)
According to the docs, the signature of `tp_new` should be:
`PyObject* tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)`
https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_new
We don't care about the arguments, but according to the C standard 6.3.2.3.8
this is undefined behavior:
> A pointer to a function of one type may be converted to a pointer to a
> function of another type and back again; the result shall compare equal to
> the original pointer. If a converted pointer is used to call a function whose
> type is not compatible with the pointed-to type, the behavior is undefined.
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf#page=60
In normal platforms the behavior is to work as expected, but in WebAssembly,
this crashes.
Fixes pyodide/pyodide#5015.1 parent 8e5fd14 commit d022f72
2 files changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
1389 | 1389 | | |
1390 | 1390 | | |
1391 | 1391 | | |
1392 | | - | |
| 1392 | + | |
1393 | 1393 | | |
1394 | 1394 | | |
1395 | 1395 | | |
| |||
1783 | 1783 | | |
1784 | 1784 | | |
1785 | 1785 | | |
1786 | | - | |
| 1786 | + | |
1787 | 1787 | | |
1788 | 1788 | | |
1789 | 1789 | | |
| |||
1824 | 1824 | | |
1825 | 1825 | | |
1826 | 1826 | | |
1827 | | - | |
| 1827 | + | |
1828 | 1828 | | |
1829 | 1829 | | |
1830 | 1830 | | |
| |||
0 commit comments