mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
bpo-46417: Clear more static types (GH-30796)
* Move PyContext static types into object.c static_types list. * Rename PyContextTokenMissing_Type to _PyContextTokenMissing_Type and declare it in pycore_context.h. * _PyHamtItems types are no long exported: replace PyAPI_DATA() with extern.
This commit is contained in:
parent
1f8014c5b4
commit
500c146387
7 changed files with 30 additions and 54 deletions
|
@ -1260,7 +1260,7 @@ context_token_missing_tp_repr(PyObject *self)
|
|||
}
|
||||
|
||||
|
||||
PyTypeObject PyContextTokenMissing_Type = {
|
||||
PyTypeObject _PyContextTokenMissing_Type = {
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"Token.MISSING",
|
||||
sizeof(PyContextTokenMissing),
|
||||
|
@ -1279,7 +1279,7 @@ get_token_missing(void)
|
|||
}
|
||||
|
||||
_token_missing = (PyObject *)PyObject_New(
|
||||
PyContextTokenMissing, &PyContextTokenMissing_Type);
|
||||
PyContextTokenMissing, &_PyContextTokenMissing_Type);
|
||||
if (_token_missing == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1323,25 +1323,12 @@ _PyContext_Fini(PyInterpreterState *interp)
|
|||
|
||||
|
||||
PyStatus
|
||||
_PyContext_InitTypes(PyInterpreterState *interp)
|
||||
_PyContext_Init(PyInterpreterState *interp)
|
||||
{
|
||||
if (!_Py_IsMainInterpreter(interp)) {
|
||||
return _PyStatus_OK();
|
||||
}
|
||||
|
||||
PyStatus status = _PyHamt_InitTypes(interp);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if ((PyType_Ready(&PyContext_Type) < 0) ||
|
||||
(PyType_Ready(&PyContextVar_Type) < 0) ||
|
||||
(PyType_Ready(&PyContextToken_Type) < 0) ||
|
||||
(PyType_Ready(&PyContextTokenMissing_Type) < 0))
|
||||
{
|
||||
return _PyStatus_ERR("can't init context types");
|
||||
}
|
||||
|
||||
PyObject *missing = get_token_missing();
|
||||
if (PyDict_SetItemString(
|
||||
PyContextToken_Type.tp_dict, "MISSING", missing))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue