Skip to content

Commit 9e3353b

Browse files
Yhg1smeta-codesync[bot]
authored andcommitted
Prevent module shadow check inlining
Summary: Mark `_PyModule_IsPossiblyShadowing` as no-inline in Python 3.14, 3.15, and main (3.16). The helper contains two `PATH_MAX`-sized wide-character buffers. PGO indirect-call promotion caused it to be folded into `PyObject_GetAttr` in 3.14, increasing every attribute lookup stack frame by about 32 KiB and allowing recursive calls to skip the physical-stack recovery margin. The annotation keeps those buffers in a separate frame entered only by module shadowing diagnostics. Adds managed pyimport patches for all three source trees. Reviewed By: alexmalyshev Differential Revision: D123615531 fbshipit-source-id: b0fa0f521244da8793c0ec5a211a80999418a9d2
1 parent a9f4439 commit 9e3353b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Objects/moduleobject.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ _PyModuleSpec_GetFileOrigin(PyObject *spec, PyObject **p_origin)
12351235
return 1;
12361236
}
12371237

1238-
int
1238+
Py_NO_INLINE int
12391239
_PyModule_IsPossiblyShadowing(PyObject *origin)
12401240
{
12411241
// origin must be a unicode subtype

0 commit comments

Comments
 (0)