From: Michael Droettboom Date: Fri, 6 May 2022 03:59:45 +0000 (-0400) Subject: gh-92356: Fix regression in ctypes function call overhead (#92357) X-Git-Tag: v3.11.0b1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adcb6a6055c7fe6e02621f66945be237b42e945a;p=thirdparty%2FPython%2Fcpython.git 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. --- 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 000000000000..9c9566e5b9d7 --- /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 23c11c98b2af..c7234fbb18a0 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(); }