summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Droettboom <mdboom@gmail.com>2022-05-06 03:59:45 (GMT)
committerGitHub <noreply@github.com>2022-05-06 03:59:45 (GMT)
commitadcb6a6055c7fe6e02621f66945be237b42e945a (patch)
treebf59f688896e913075c974b366bd1f0864e5d568
parent301351c6a227249770fdf498054e6bbce1c3ee3c (diff)
downloadcpython-adcb6a6055c7fe6e02621f66945be237b42e945a.zip
cpython-adcb6a6055c7fe6e02621f66945be237b42e945a.tar.gz
cpython-adcb6a6055c7fe6e02621f66945be237b42e945a.tar.bz2
gh-92356: Fix regression in ctypes function call overhead (#92357)
38f331d introduced a delayed initialization routine to set up ctypes formattable (`_ctypes_init_fielddesc`), but inadvertently removed setting the `initialization` flag to 1 to avoid initting each time.
-rw-r--r--Misc/NEWS.d/next/Library/2022-05-05-19-25-09.gh-issue-92356.uvxWdu.rst1
-rw-r--r--Modules/_ctypes/cfield.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2022-05-05-19-25-09.gh-issue-92356.uvxWdu.rst b/Misc/NEWS.d/next/Library/2022-05-05-19-25-09.gh-issue-92356.uvxWdu.rst
new file mode 100644
index 0000000..9c9566e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-05-05-19-25-09.gh-issue-92356.uvxWdu.rst
@@ -0,0 +1 @@
+Fixed a performance regression in ctypes function calls.
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index 23c11c9..c7234fb 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -1602,6 +1602,7 @@ _ctypes_get_fielddesc(const char *fmt)
struct fielddesc *table = formattable;
if (!initialized) {
+ initialized = 1;
_ctypes_init_fielddesc();
}