Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Commit 7b370d0

Browse files
aasun-googleb-daniels
authored andcommitted
Automated g4 rollback of changelist 143733607.
*** Reason for rollback *** Failing guitar tests, not getting class name in MVM/GAE *** Original change description *** [Python] Include class name in function name in the call stack *** ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143821844
1 parent c024217 commit 7b370d0

1 file changed

Lines changed: 8 additions & 24 deletions

File tree

src/googleclouddebugger/capture_collector.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
# TODO(vlif): rename this file to collector.py.
1818

19-
from collections import namedtuple
2019
import copy
2120
import datetime
2221
import inspect
@@ -251,25 +250,19 @@ def Collect(self, top_frame):
251250

252251
while frame and (len(breakpoint_frames) < self.max_frames):
253252
code = frame.f_code
254-
function = code.co_name
255-
frame_arguments = []
256-
frame_locals = []
257253
if len(breakpoint_frames) < self.max_expand_frames:
258-
frame_capture = self.CaptureFrameLocals(frame)
259-
frame_arguments = frame_capture.arguments
260-
frame_locals = frame_capture.locals
261-
if frame_capture.classname:
262-
function = frame_capture.classname + '.' + code.co_name
254+
frame_arguments, frame_locals = self.CaptureFrameLocals(frame)
255+
else:
256+
frame_arguments = []
257+
frame_locals = []
263258

264259
breakpoint_frames.append({
265-
'function': function,
260+
'function': code.co_name,
266261
'location': {
267262
'path': NormalizePath(code.co_filename),
268-
'line': frame.f_lineno
269-
},
263+
'line': frame.f_lineno},
270264
'arguments': frame_arguments,
271-
'locals': frame_locals
272-
})
265+
'locals': frame_locals})
273266
frame = frame.f_back
274267

275268
# Explore variables table in BFS fashion. The variables table will grow
@@ -324,20 +317,11 @@ def CaptureFrameLocals(self, frame):
324317
if frame.f_code.co_flags & inspect.CO_VARARGS: nargs += 1
325318
if frame.f_code.co_flags & inspect.CO_VARKEYWORDS: nargs += 1
326319

327-
# Retrieve class name of function if we think it is a member function
328-
# This functions under the assumption that member functions will name their
329-
# first parameter argument 'self' but has some edge-cases.
330-
if nargs >= 1 and 'self' == frame.f_code.co_varnames[0]:
331-
frame_class = frame.f_locals['self'].__class__.__name__
332-
else:
333-
frame_class = None
334-
335320
frame_arguments = []
336321
for argname in frame.f_code.co_varnames[:nargs]:
337322
if argname in variables: frame_arguments.append(variables.pop(argname))
338323

339-
frame = namedtuple('frame', 'classname arguments locals')
340-
return frame(frame_class, frame_arguments, list(variables.viewvalues()))
324+
return (frame_arguments, list(variables.viewvalues()))
341325

342326
def CaptureNamedVariable(self, name, value, depth, limits):
343327
"""Appends name to the product of CaptureVariable.

0 commit comments

Comments
 (0)