Skip to content
New issue

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

gh-97670: Remove sys.getdxp() and analyze_dxp.py script #97671

Merged
merged 1 commit into from
Oct 4, 2022
Merged

gh-97670: Remove sys.getdxp() and analyze_dxp.py script #97671

merged 1 commit into from
Oct 4, 2022

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 30, 2022

Remove the sys.getdxp() function and the Tools/scripts/analyze_dxp.py script. DXP stands for "dynamic execution pairs". They were related to DYNAMIC_EXECUTION_PROFILE and DXPAIRS macros which have been removed in Python 3.11. Python can now be built with "./configure --enable-pystats" to gather statistics on Python opcodes.

@vstinner
Copy link
Member Author

@markshannon: Would you mind to review this PR?

@vstinner
Copy link
Member Author

vstinner commented Oct 3, 2022

@brandtbucher: Would you mind to review this PR?

@markshannon
Copy link
Member

Removing the script seems fine.
Do we know for sure that no one is using sys.getdxp()?

@vstinner
Copy link
Member Author

vstinner commented Oct 4, 2022

Do we know for sure that no one is using sys.getdxp()?

I just searched in the PyPI top 5000 projects: I found 0 projects using getdxp(). I cannot be 100% sure. But if a project uses getdxp(), it can be updated to use the new way to gather stats, no? Also, we can add back the function if someone comes with a use case for it. For me, it's mostly a tool to develop and optimize Python. So if no Python core dev uses it, I don't think that we should worry about removing this function.

@vstinner
Copy link
Member Author

vstinner commented Oct 4, 2022

@smontanaro: I found a script using sys.getdxp() in "BitTorrent-master" . Are you still using it?

# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
(...)
def report(email, appname):
    """
    Send an RLE encoded version of sys.getdxp() off to our Top Men (tm)
    for analysis.
    """
    if hasattr(sys, 'getdxp') and appname:
        dxp = xmlrpclib.ServerProxy("http://manatee.mojam.com:7304")
        dxp.add_dx_info(appname, email, sys.version_info[:3], rle(sys.getdxp()))

See twisted/python/dxprofile.py for the full source with the rle() function.

This script was part of Twisted and was removed in Twisted Core 8.0.0 (2008-03-17) because it no longer worked (issue #2908).

@vstinner
Copy link
Member Author

vstinner commented Oct 4, 2022

I found references to getdxp() by @smontanaro on python-dev mailing list in 2001-2003:

@vstinner
Copy link
Member Author

vstinner commented Oct 4, 2022

Ah by the way, as you can see in this PR, sys.getdxp() is not documented and not tested at all. There is just a test on the script.

@smontanaro
Copy link
Contributor

@vstinner As you might have expected, I'm no longer using the dxp stuff, but thanks for checking. :-)

Remove the sys.getdxp() function and the Tools/scripts/analyze_dxp.py
script. DXP stands for "dynamic execution pairs". They were related
to DYNAMIC_EXECUTION_PROFILE and DXPAIRS macros which have been
removed in Python 3.11. Python can now be built with "./configure
--enable-pystats" to gather statistics on Python opcodes.
@vstinner vstinner merged commit 116fa62 into python:main Oct 4, 2022
@vstinner vstinner deleted the remove_dxp branch October 4, 2022 13:29
@vstinner
Copy link
Member Author

vstinner commented Oct 4, 2022

Thanks for reviews. It's now removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants