mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
parent
0a37a30037
commit
14709144b5
3 changed files with 52 additions and 1 deletions
|
@ -547,6 +547,15 @@ frame_sizeof(PyFrameObject *f)
|
|||
PyDoc_STRVAR(sizeof__doc__,
|
||||
"F.__sizeof__() -> size of F in memory, in bytes");
|
||||
|
||||
static PyObject *
|
||||
frame_repr(PyFrameObject *f)
|
||||
{
|
||||
int lineno = PyFrame_GetLineNumber(f);
|
||||
return PyUnicode_FromFormat(
|
||||
"<frame at %p, file %R, line %d, code %S>",
|
||||
f, f->f_code->co_filename, lineno, f->f_code->co_name);
|
||||
}
|
||||
|
||||
static PyMethodDef frame_methods[] = {
|
||||
{"clear", (PyCFunction)frame_clear, METH_NOARGS,
|
||||
clear__doc__},
|
||||
|
@ -565,7 +574,7 @@ PyTypeObject PyFrame_Type = {
|
|||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
(reprfunc)frame_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue