Skip to content

Commit 2e79608

Browse files
committed
Start-Agent-Branch: codetype-interface
Target-Remote: https://github.com/metacraft-labs/codetracer-python-recorder.git
1 parent 0b1da45 commit 2e79608

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Implement an interface for the CodeType object.
2+
3+
The Python Monitoring API passes a CodeObject to each event handler. In the current implemenation of our Tracer trait the event handlers have an argument `_code: &Bound<'_, PyAny>` which gives
4+
access to this object. This is not a good interface because the type is too generic. PyO3 has a PyCodeObject type, however it doesn't expose any public members because the type is unstable,
5+
so we cannot use that one.
6+
7+
We need to create our own type CodeObjectWrapper which can simplify access to the underlying code object type. Then we should use this type in the signature of the methods in the Tracer trait.
8+
The type should allow easy access to that functionality of the underlying code object which we will need to implement a recorder for a time-travel debugger.
9+
On the other hand it is important not to introduce any performance problems. Some ideas to think about:
10+
- Minimize the copying of values
11+
- Repeated computations on each event call could be memoized
12+
- Any other approach that minimizes the performance hit
13+
14+
Propose a design of the CodeObjectWrapper type. Write the design in design-docs/code-object.md. Do not actually implement the type for now, I need to confirm the design first.
15+
16+
Here's relevant information:
17+
* design-docs/design-001.md - shows how we write design documentation
18+
* https://docs.python.org/3/library/sys.monitoring.html - Documentation of the Python sys.montoring API
19+
* https://docs.python.org/3/reference/datamodel.html#code-objects - Description of Python Code Objects.

0 commit comments

Comments
 (0)