summaryrefslogtreecommitdiffstats
path: root/Python/modsupport.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-04-27 22:19:43 (GMT)
committerGitHub <noreply@github.com>2023-04-27 22:19:43 (GMT)
commitd2e2e53f733f8c8098035bbbc452bd1892796cb3 (patch)
tree4f01c11ff1f6ad9ebbcd4786bca991878226a4c6 /Python/modsupport.c
parent56c7176d1de3a0770085cad3865c1de42ba86f42 (diff)
downloadcpython-d2e2e53f733f8c8098035bbbc452bd1892796cb3.zip
cpython-d2e2e53f733f8c8098035bbbc452bd1892796cb3.tar.gz
cpython-d2e2e53f733f8c8098035bbbc452bd1892796cb3.tar.bz2
gh-94673: Ensure Builtin Static Types are Readied Properly (gh-103940)
There were cases where we do unnecessary work for builtin static types. This also simplifies some work necessary for a per-interpreter GIL.
Diffstat (limited to 'Python/modsupport.c')
-rw-r--r--Python/modsupport.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index 7569845..be229c9 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -3,6 +3,7 @@
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
+#include "pycore_object.h" // _PyType_IsReady()
#define FLAG_SIZE_T 1
typedef double va_double;
@@ -693,7 +694,7 @@ PyModule_AddStringConstant(PyObject *m, const char *name, const char *value)
int
PyModule_AddType(PyObject *module, PyTypeObject *type)
{
- if (PyType_Ready(type) < 0) {
+ if (!_PyType_IsReady(type) && PyType_Ready(type) < 0) {
return -1;
}