Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

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

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-97670: Remove sys.getdxp() and analyze_dxp.py script
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.
  • Loading branch information
vstinner committed Oct 4, 2022
commit 7337383db8be493245f99c609fe033da1777386b
9 changes: 1 addition & 8 deletions 9 Lib/test/test_tools/test_sundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestSundryScripts(unittest.TestCase):
# scripts that use windows-only modules
windows_only = ['win_add2path']
# denylisted for other reasons
other = ['analyze_dxp', '2to3']
other = ['2to3']

skiplist = denylist + allowlist + windows_only + other

Expand All @@ -50,13 +50,6 @@ def test_sundry_windows(self):
for name in self.windows_only:
import_tool(name)

def test_analyze_dxp_import(self):
if hasattr(sys, 'getdxp'):
import_tool('analyze_dxp')
else:
with self.assertRaises(RuntimeError):
import_tool('analyze_dxp')


if __name__ == '__main__':
unittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Remove the :func:`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 :option:`./configure --enable-pystats
<--enable-pystats>` to gather statistics on Python opcodes. Patch by Victor
Stinner.
55 changes: 0 additions & 55 deletions 55 Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -7207,61 +7207,6 @@ format_awaitable_error(PyThreadState *tstate, PyTypeObject *type, int oparg)
}
}

#ifdef Py_STATS

static PyObject *
getarray(uint64_t a[256])
{
int i;
PyObject *l = PyList_New(256);
if (l == NULL) return NULL;
for (i = 0; i < 256; i++) {
PyObject *x = PyLong_FromUnsignedLongLong(a[i]);
if (x == NULL) {
Py_DECREF(l);
return NULL;
}
PyList_SET_ITEM(l, i, x);
}
for (i = 0; i < 256; i++)
a[i] = 0;
return l;
}

PyObject *
_Py_GetDXProfile(PyObject *self, PyObject *args)
{
int i;
PyObject *l = PyList_New(257);
if (l == NULL) return NULL;
for (i = 0; i < 256; i++) {
PyObject *x = getarray(_py_stats_struct.opcode_stats[i].pair_count);
if (x == NULL) {
Py_DECREF(l);
return NULL;
}
PyList_SET_ITEM(l, i, x);
}
PyObject *counts = PyList_New(256);
if (counts == NULL) {
Py_DECREF(l);
return NULL;
}
for (i = 0; i < 256; i++) {
PyObject *x = PyLong_FromUnsignedLongLong(
_py_stats_struct.opcode_stats[i].execution_count);
if (x == NULL) {
Py_DECREF(counts);
Py_DECREF(l);
return NULL;
}
PyList_SET_ITEM(counts, i, x);
}
PyList_SET_ITEM(l, 256, counts);
return l;
}

#endif

Py_ssize_t
_PyEval_RequestCodeExtraIndex(freefunc free)
Expand Down
8 changes: 0 additions & 8 deletions 8 Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2014,11 +2014,6 @@ sys__debugmallocstats_impl(PyObject *module)
extern PyObject *_Py_GetObjects(PyObject *, PyObject *);
#endif

#ifdef Py_STATS
/* Defined in ceval.c because it uses static globals in that file */
extern PyObject *_Py_GetDXProfile(PyObject *, PyObject *);
#endif

#ifdef __cplusplus
}
#endif
Expand Down Expand Up @@ -2217,9 +2212,6 @@ static PyMethodDef sys_methods[] = {
SYS_GETDEFAULTENCODING_METHODDEF
SYS_GETDLOPENFLAGS_METHODDEF
SYS_GETALLOCATEDBLOCKS_METHODDEF
#ifdef Py_STATS
{"getdxp", _Py_GetDXProfile, METH_VARARGS},
#endif
SYS_GETFILESYSTEMENCODING_METHODDEF
SYS_GETFILESYSTEMENCODEERRORS_METHODDEF
SYS__GETQUICKENEDCOUNT_METHODDEF
Expand Down
1 change: 0 additions & 1 deletion 1 Tools/scripts/README
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ useful while building, extending or managing Python.

2to3 Main script for running the 2to3 conversion tool
abitype.py Converts a C file to use the PEP 384 type definition API
analyze_dxp.py Analyzes the result of sys.getdxp()
combinerefs.py A helper for analyzing PYTHONDUMPREFS output
diff.py Print file diffs in context, unified, or ndiff formats
eptags.py Create Emacs TAGS file for Python modules
Expand Down
129 changes: 0 additions & 129 deletions 129 Tools/scripts/analyze_dxp.py

This file was deleted.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.