[Python-Dev] [Python-checkins] cpython: Close #19762: Fix name of _get_traces() and _get_object_traceback() function

Jim Jewett jimjjewett at gmail.com
Mon Nov 25 16:04:21 CET 2013


Why are these functions (get_traces and get_object_traceback) private?

(1)  Is the whole module provisional?  At one point, I had thought so, but
I don't see that in the PEP or implementation.  (I'm not sure that it
should be provisional, but I want to be sure that the decision is
intentional.)

(2)  This implementation does lock in certain choices about the nature of
traces.  (What data to include for analysis vs excluding to save memory;
which events are tracked separately and which combined into a single total;
organizing the data that is saved in a hash by certain keys; etc)

While I would prefer more flexibility, the existing code provides a
reasonable default, and I can't forsee changing traces so much that these
functions *can't* be reasonably supported unless the rest of the module API
changes too.

(3)  get_object_traceback is the killer app that justifies the specific
data-collection choices Victor made; if it isn't public, the implementation
starts to look overbuilt.

(4) get_traces is about the only way to get at even the all the data that
*is* stored, prior to additional summarization.  If it isn't public, those
default summarization options become even more locked in..

-jJ

On Mon, Nov 25, 2013 at 3:34 AM, victor.stinner
<python-checkins at python.org>wrote:

> http://hg.python.org/cpython/rev/2e2ec595dc58
> changeset:   87551:2e2ec595dc58
> user:        Victor Stinner <victor.stinner at gmail.com>
> date:        Mon Nov 25 09:33:18 2013 +0100
> summary:
>   Close #19762: Fix name of _get_traces() and _get_object_traceback()
> function
> name in their docstring. Patch written by Vajrasky Kok.
>
> files:
>   Modules/_tracemalloc.c |  4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
>
> diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
> --- a/Modules/_tracemalloc.c
> +++ b/Modules/_tracemalloc.c
> @@ -1018,7 +1018,7 @@
>  }
>
>  PyDoc_STRVAR(tracemalloc_get_traces_doc,
> -    "get_traces() -> list\n"
> +    "_get_traces() -> list\n"
>      "\n"
>      "Get traces of all memory blocks allocated by Python.\n"
>      "Return a list of (size: int, traceback: tuple) tuples.\n"
> @@ -1083,7 +1083,7 @@
>  }
>
>  PyDoc_STRVAR(tracemalloc_get_object_traceback_doc,
> -    "get_object_traceback(obj)\n"
> +    "_get_object_traceback(obj)\n"
>      "\n"
>      "Get the traceback where the Python object obj was allocated.\n"
>      "Return a tuple of (filename: str, lineno: int) tuples.\n"
>
> --
> Repository URL: http://hg.python.org/cpython
>
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> https://mail.python.org/mailman/listinfo/python-checkins
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20131125/21db312f/attachment.html>


More information about the Python-Dev mailing list