[3.12] gh-105603: Change the PyInterpreterConfig.own gil Field (gh-105620) (gh-105731)

We are changing it to be more flexible that a strict bool can be for possible future expanded used cases.
(cherry picked from commit b97e14a806)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-06-13 10:42:56 -07:00 committed by GitHub
parent 9c51ea5d55
commit c3a2cbb54d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 16 deletions

View file

@ -244,6 +244,10 @@ PyAPI_FUNC(PyStatus) PyConfig_SetWideStringList(PyConfig *config,
/* --- PyInterpreterConfig ------------------------------------ */
#define PyInterpreterConfig_DEFAULT_GIL (0)
#define PyInterpreterConfig_SHARED_GIL (1)
#define PyInterpreterConfig_OWN_GIL (2)
typedef struct {
// XXX "allow_object_sharing"? "own_objects"?
int use_main_obmalloc;
@ -252,7 +256,7 @@ typedef struct {
int allow_threads;
int allow_daemon_threads;
int check_multi_interp_extensions;
int own_gil;
int gil;
} PyInterpreterConfig;
#define _PyInterpreterConfig_INIT \
@ -263,7 +267,7 @@ typedef struct {
.allow_threads = 1, \
.allow_daemon_threads = 0, \
.check_multi_interp_extensions = 1, \
.own_gil = 1, \
.gil = PyInterpreterConfig_OWN_GIL, \
}
#define _PyInterpreterConfig_LEGACY_INIT \
@ -274,7 +278,7 @@ typedef struct {
.allow_threads = 1, \
.allow_daemon_threads = 1, \
.check_multi_interp_extensions = 0, \
.own_gil = 0, \
.gil = PyInterpreterConfig_SHARED_GIL, \
}
/* --- Helper functions --------------------------------------- */