Skip to content

Commit

Permalink
Fix CFrame issue
Browse files Browse the repository at this point in the history
Add 3.12 tests

Signed-off-by: Kemal Akkoyun <[email protected]>
  • Loading branch information
kakkoyun committed Feb 24, 2024
1 parent 07d309f commit a576622
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pkg/python/datamap.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (p python27) Layout() runtimedata.RuntimeData {
CFrame: doesNotExist,
},
PyCFrame: PyCFrame{
CurrentFrame: 0, // TODO(kakkoyun): Set -1 (next iteration).
CurrentFrame: 0,
},
PyInterpreterState: PyInterpreterState{
TStateHead: p.PyInterpreterStateTstateHead,
Expand Down Expand Up @@ -139,7 +139,7 @@ func (p python33_39) Layout() runtimedata.RuntimeData {
CFrame: doesNotExist,
},
PyCFrame: PyCFrame{
CurrentFrame: 0, // TODO(kakkoyun): Set -1 (next iteration).
CurrentFrame: 0,
},
PyInterpreterState: PyInterpreterState{
TStateHead: p.PyInterpreterStateTstateHead,
Expand Down Expand Up @@ -207,7 +207,7 @@ func (p python310) Layout() runtimedata.RuntimeData {
CFrame: doesNotExist,
},
PyCFrame: PyCFrame{
CurrentFrame: 0, // TODO(kakkoyun): Set -1 (next iteration).
CurrentFrame: 0,
},
PyInterpreterState: PyInterpreterState{
TStateHead: p.PyInterpreterStateTstateHead,
Expand Down Expand Up @@ -322,7 +322,7 @@ type python312 struct {
PyFrameObjectFLocalsplus int64 `offsetof:"_PyInterpreterFrame.localsplus"`
PyCodeObjectCoFilename int64 `offsetof:"PyCodeObject.co_filename"`
PyCodeObjectCoName int64 `offsetof:"PyCodeObject.co_name"`
PyCodeObjectCoVarNames int64 `offsetof:"PyCodeObject.co_localsplusnames"`
PyCodeObjectCoVarNames int64 `offsetof:"PyCodeObject.co_varnames"`
PyCodeObjectCoFirstlineno int64 `offsetof:"PyCodeObject.co_firstlineno"`
PyTupleObjectObItem int64 `offsetof:"PyTupleObject.ob_item"`
}
Expand All @@ -348,7 +348,7 @@ func (p python312) Layout() runtimedata.RuntimeData {
CFrame: p.PyThreadStateCFrame,
},
PyCFrame: PyCFrame{
CurrentFrame: doesNotExist,
CurrentFrame: 0,
},
PyInterpreterState: PyInterpreterState{
TStateHead: p.PyInterpreterStateTstateHead + p.PyInterpreterStateIsPythreadsHead,
Expand Down
4 changes: 2 additions & 2 deletions pkg/python/layout/amd64/3.12.0 - 3.12.2.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
py_cframe:
current_frame: -1
current_frame: 0
py_code_object:
co_filename: 112
co_firstlineno: 68
co_name: 120
co_varnames: 96
co_varnames: 0
py_frame_object:
f_back: 8
f_code: 0
Expand Down
4 changes: 2 additions & 2 deletions pkg/python/layout/arm64/3.12.0 - 3.12.2.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
py_cframe:
current_frame: -1
current_frame: 0
py_code_object:
co_filename: 112
co_firstlineno: 68
co_name: 120
co_varnames: 96
co_varnames: 0
py_frame_object:
f_back: 8
f_code: 0
Expand Down
48 changes: 48 additions & 0 deletions pkg/python/python_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,54 @@ func TestGetLayout(t *testing.T) {
},
},
},
{
version: "3.12.2",
archs: allSupportedArchs,
want: &Layout{
PyObject: PyObject{
ObType: 8,
},
PyString: PyString{
Data: 40,
Size: -1,
},
PyTypeObject: PyTypeObject{
TPName: 24,
},
PyThreadState: PyThreadState{
Next: 8,
Interp: 16,
Frame: -1,
ThreadID: 136,
NativeThreadID: 144,
CFrame: 56,
},
PyCFrame: PyCFrame{
CurrentFrame: 0,
},
PyInterpreterState: PyInterpreterState{
TStateHead: 72,
},
PyRuntimeState: PyRuntimeState{
InterpMain: 48,
},
PyFrameObject: PyFrameObject{
FBack: 8,
FCode: 0,
FLineno: -1,
FLocalsplus: 72,
},
PyCodeObject: PyCodeObject{
CoFilename: 112,
CoName: 120,
CoVarnames: 0,
CoFirstlineno: 68,
},
PyTupleObject: PyTupleObject{
ObItem: 24,
},
},
},
}
for _, tt := range tests {
var (
Expand Down

0 comments on commit a576622

Please sign in to comment.