Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Stackless issue #303: PEP-578 Audit Hooks for Stackless #304

Open
wants to merge 2 commits into
base: 3.8-slp
Choose a base branch
from
Open
Show file tree
Hide file tree
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
add frame argumnet to the auditing event stackless.frame.__setstate__
  • Loading branch information
Anselm Kruis committed Aug 24, 2021
commit ca29f3b80a22297d5ab8e87ae78ddd5c8980d6ec
10 changes: 5 additions & 5 deletions Doc/library/stackless/pickling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ to execute it raises
If a program tries to unpickle a frame using a code object whose first bytecode instruction is invalid, then |SLP|
marks the frame as invalid. Any attempt to execute the frame raises :exc:`RuntimeError`.

.. audit-event:: stackless.frame.__setstate__ ""
.. audit-event:: stackless.frame.__setstate__ frame

|SLP| raises a auditing event ``stackless.frame.__setstate__`` with no arguments
on unpickling frames that could be evaluated.
On unpickling frames |SLP| raises an auditing event ``stackless.frame.__setstate__`` with the fully initialized
frame object as the argument, if the frame could be evaluated.

.. audit-event:: sys.settrace ""

|SLP| raises a auditing event ``sys.settrace`` with no arguments on unpickling frames
with a trace function that could be executed.
On unpickling frames |SLP| raises an auditing event ``sys.settrace`` with no arguments
if the frame has a trace function that could be executed.


Functions
Expand Down
4 changes: 2 additions & 2 deletions Stackless/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ What's New in Stackless 3.X.X?
'PyTasklet_GetFrame()' raises an auditing event "sys._getframe" with no
arguments.
- Unpickling of a frame that could be evaluated now raises auditing event
"stackless.frame.__setstate__" with no arguments and, if the frame has a
trace function, also auditing event "sys.settrace".
"stackless.frame.__setstate__" and, if the frame has a trace function,
also auditing event "sys.settrace".
- If Stackless pickle flag bit 'PICKLEFLAGS_PRESERVE_AG_FINALIZER' is set
then unpickling an async_generator with a pickled finalizer raises auditing
event "stackless.async_generator.set_finalizer".
Expand Down
4 changes: 2 additions & 2 deletions Stackless/pickling/prickelpit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1212,15 +1212,15 @@ frame_setstate(PyFrameObject *f, PyObject *args)

/* See if this frame is valid to be run. */
f->f_executing = valid ? f_executing : SLP_FRAME_EXECUTING_INVALID;
Py_TYPE(f) = &PyFrame_Type;
if(valid && f_executing) {
if (PySys_Audit("stackless.frame.__setstate__", NULL))
if (PySys_Audit("stackless.frame.__setstate__", "O", f))
goto err_exit;
if (f->f_trace && PySys_Audit("sys.settrace", NULL)) {
goto err_exit;
}
}

Py_TYPE(f) = &PyFrame_Type;
Py_INCREF(f);
return (PyObject *) f;
err_exit:
Expand Down