This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Gabriele Tornetta
Recipients Gabriele Tornetta
Date 2021-06-28.22:35:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1624919733.39.0.974767657181.issue44530@roundup.psfhosted.org>
In-reply-to
Content
When dumping profiling data out of code objects using out-of-process tools like Austin (https://github.com/p403n1x87/austin) one has access only to file name, function name, and line number. Consider the flame graph generated by running the following script, and aggregating on function names

----
class Foo:
    def on_cpu(self, n):
        a = []
        for i in range(n):
            a.append(i)


class Bar:
    def on_cpu(self, n):
        a = []
        for i in range(n):
            a.append(i)


if __name__ == "__main__":
    f = Foo()
    b = Bar()

    f.on_cpu(1_000_000)
    b.on_cpu(5_000_000)
----

Without the extra information coming from the actual Python source, one would not be able to tell, by looking at the flame graph alone, that on_cpu has contributions from two different methods. By propagating the qualname information from the compiler to code objects, such names would be disambiguated and the resulting flame graph would be clearer.

I would like to propose adding the co_qualname field to the PyCodeObject structure, which is to be set to NULL except for when the code object is created by the compiler in compile.c.
History
Date User Action Args
2021-06-28 22:35:33Gabriele Tornettasetrecipients: + Gabriele Tornetta
2021-06-28 22:35:33Gabriele Tornettasetmessageid: <1624919733.39.0.974767657181.issue44530@roundup.psfhosted.org>
2021-06-28 22:35:33Gabriele Tornettalinkissue44530 messages
2021-06-28 22:35:33Gabriele Tornettacreate