Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Document that the runtime is free to optimize away function creation
  • Loading branch information
mpage committed Nov 22, 2022
commit dd41468ea8109dd8f2a643a4c7abb81b04d80250
6 changes: 5 additions & 1 deletion Doc/c-api/function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ There are a few functions specific to Python functions.
If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked
after `func` has been fully initialized. Otherwise, the callback is invoked
before the modification to *func* takes place, so the prior state of *func*
can be inspected.
can be inspected. The runtime is permitted to optimize away the creation of
function objects when possible. In such cases no event will be emitted.
Although this creates the possitibility of an observable difference of
runtime behavior depending on optimization decisions, it does not change
the semantics of the Python code being executed.

Comment thread
mpage marked this conversation as resolved.
If the callback returns with an exception set, it must return ``-1``; this
exception will be printed as an unraisable exception using
Expand Down