Skip to content

Commit

Permalink
bpo-46370: Move the static initializer for _PyRuntime to its own head…
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsnowcurrently committed Jan 13, 2022
1 parent 276c234 commit bc02eac
Show file tree
Hide file tree
Showing 9 changed files with 611 additions and 583 deletions.
569 changes: 1 addition & 568 deletions Include/internal/pycore_global_objects.h

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Include/internal/pycore_object.h
Expand Up @@ -12,6 +12,19 @@ extern "C" {
#include "pycore_interp.h" // PyInterpreterState.gc
#include "pycore_pystate.h" // _PyInterpreterState_GET()


#define _PyObject_IMMORTAL_INIT(type) \
{ \
.ob_refcnt = 999999999, \
.ob_type = type, \
}
#define _PyVarObject_IMMORTAL_INIT(type, size) \
{ \
.ob_base = _PyObject_IMMORTAL_INIT(type), \
.ob_size = size, \
}


PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type);
PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content);

Expand Down
15 changes: 0 additions & 15 deletions Include/internal/pycore_runtime.h
Expand Up @@ -148,21 +148,6 @@ typedef struct pyruntimestate {
PyInterpreterState _main_interpreter;
} _PyRuntimeState;

#define _PyThreadState_INIT \
{ \
._static = 1, \
}
#define _PyInterpreterState_INIT \
{ \
._static = 1, \
._initial_thread = _PyThreadState_INIT, \
}
#define _PyRuntimeState_INIT \
{ \
.global_objects = _Py_global_objects_INIT, \
._main_interpreter = _PyInterpreterState_INIT, \
}


/* other API */

Expand Down

0 comments on commit bc02eac

Please sign in to comment.