]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-92356: Fix regression in ctypes function call overhead (#92357)
authorMichael Droettboom <mdboom@gmail.com>
Fri, 6 May 2022 03:59:45 +0000 (23:59 -0400)
committerGitHub <noreply@github.com>
Fri, 6 May 2022 03:59:45 +0000 (20:59 -0700)
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.

Misc/NEWS.d/next/Library/2022-05-05-19-25-09.gh-issue-92356.uvxWdu.rst [new file with mode: 0644]
Modules/_ctypes/cfield.c

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 (file)
index 0000000..9c9566e
--- /dev/null
@@ -0,0 +1 @@
+Fixed a performance regression in ctypes function calls.
index 23c11c98b2afce0225f53281a9dd7ff028382a91..c7234fbb18a0fa8e60ae6a717e5e292382903795 100644 (file)
@@ -1602,6 +1602,7 @@ _ctypes_get_fielddesc(const char *fmt)
     struct fielddesc *table = formattable;
 
     if (!initialized) {
+        initialized = 1;
         _ctypes_init_fielddesc();
     }