Merge pull request #40092 from tg-at-google:patch-14

PiperOrigin-RevId: 314529785
Change-Id: Ice746e17c95d85b96eb00284dfbdca0715a9edcb
This commit is contained in:
TensorFlower Gardener 2020-06-03 07:55:55 -07:00
commit 1ebcb20dbf
1 changed files with 2 additions and 1 deletions

View File

@ -83,7 +83,8 @@ std::vector<FrameSummary> ExtractStack(ssize_t limit, const py::list& mappers,
std::vector<FrameSummary> ret;
// 16 is somewhat arbitrary, but TensorFlow stack traces tend to be deep.
ret.reserve(limit < 0 ? 16 : static_cast<size_t>(limit));
for (; f != nullptr && (limit < 0 || ret.size() < limit); f = f->f_back) {
for (; f != nullptr && (limit < 0 || ret.size() < static_cast<size_t>(limit));
f = f->f_back) {
const PyCodeObject* co = f->f_code;
int lineno = PyFrame_GetLineNumber(const_cast<PyFrameObject*>(f));
auto filename = py::reinterpret_borrow<py::str>(co->co_filename);