Skip to content

Commit dd41468

Browse files
committed
Document that the runtime is free to optimize away function creation
1 parent 9804bba commit dd41468

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Doc/c-api/function.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ There are a few functions specific to Python functions.
167167
If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked
168168
after `func` has been fully initialized. Otherwise, the callback is invoked
169169
before the modification to *func* takes place, so the prior state of *func*
170-
can be inspected.
170+
can be inspected. The runtime is permitted to optimize away the creation of
171+
function objects when possible. In such cases no event will be emitted.
172+
Although this creates the possitibility of an observable difference of
173+
runtime behavior depending on optimization decisions, it does not change
174+
the semantics of the Python code being executed.
171175
172176
If the callback returns with an exception set, it must return ``-1``; this
173177
exception will be printed as an unraisable exception using

0 commit comments

Comments
 (0)