| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| All necessary data for executing a Python function (local variables, stack, | ||
| etc) is now kept in a per-thread stack. Frame objects are lazily allocated | ||
| on demand. This increases performance by about 7% on the standard benchmark | ||
| suite. Introspection and debugging are unaffected as frame objects are | ||
| always available when needed. Patch by Mark Shannon. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -3,7 +3,7 @@ | |
| #include "pycore_pymem.h" // _Py_tracemalloc_config | ||
| #include "pycore_traceback.h" | ||
| #include "pycore_hashtable.h" | ||
| #include "frameobject.h" // PyFrame_GetBack() | ||
| #include <pycore_frame.h> | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI’m curious why this one is included with <> when all the headers above use ""
Sorry, something went wrong.
gst reacted with thumbs up emoji
All reactions
|
||
|
|
||
| #include "clinic/_tracemalloc.c.h" | ||
| /*[clinic input] | ||
| Expand Down Expand Up | @@ -299,18 +299,16 @@ hashtable_compare_traceback(const void *key1, const void *key2) | |
|
|
||
|
|
||
| static void | ||
| tracemalloc_get_frame(PyFrameObject *pyframe, frame_t *frame) | ||
| tracemalloc_get_frame(InterpreterFrame *pyframe, frame_t *frame) | ||
| { | ||
| frame->filename = unknown_filename; | ||
| int lineno = PyFrame_GetLineNumber(pyframe); | ||
| int lineno = PyCode_Addr2Line(pyframe->f_code, pyframe->f_lasti*2); | ||
| if (lineno < 0) { | ||
| lineno = 0; | ||
| } | ||
| frame->lineno = (unsigned int)lineno; | ||
|
|
||
| PyCodeObject *code = PyFrame_GetCode(pyframe); | ||
| PyObject *filename = code->co_filename; | ||
| Py_DECREF(code); | ||
| PyObject *filename = pyframe->f_code->co_filename; | ||
|
|
||
| if (filename == NULL) { | ||
| #ifdef TRACE_DEBUG | ||
| Expand Down Expand Up | @@ -395,7 +393,7 @@ traceback_get_frames(traceback_t *traceback) | |
| return; | ||
| } | ||
|
|
||
| PyFrameObject *pyframe = PyThreadState_GetFrame(tstate); | ||
| InterpreterFrame *pyframe = tstate->frame; | ||
| for (; pyframe != NULL;) { | ||
| if (traceback->nframe < _Py_tracemalloc_config.max_nframe) { | ||
| tracemalloc_get_frame(pyframe, &traceback->frames[traceback->nframe]); | ||
| Expand All | @@ -406,8 +404,7 @@ traceback_get_frames(traceback_t *traceback) | |
| traceback->total_nframe++; | ||
| } | ||
|
|
||
| PyFrameObject *back = PyFrame_GetBack(pyframe); | ||
| Py_DECREF(pyframe); | ||
| InterpreterFrame *back = pyframe->previous; | ||
| pyframe = back; | ||
| } | ||
| } | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.