File tree Expand file tree Collapse file tree 2 files changed +6
-21
lines changed Expand file tree Collapse file tree 2 files changed +6
-21
lines changed Original file line number Diff line number Diff line change @@ -30,30 +30,15 @@ static PyMethodDef _contextvars_methods[] = {
3030static int
3131_contextvars_exec (PyObject * m )
3232{
33- Py_INCREF (& PyContext_Type );
34- if (PyModule_AddObject (m , "Context" ,
35- (PyObject * )& PyContext_Type ) < 0 )
36- {
37- Py_DECREF (& PyContext_Type );
33+ if (PyModule_AddType (m , & PyContext_Type ) < 0 ) {
3834 return -1 ;
3935 }
40-
41- Py_INCREF (& PyContextVar_Type );
42- if (PyModule_AddObject (m , "ContextVar" ,
43- (PyObject * )& PyContextVar_Type ) < 0 )
44- {
45- Py_DECREF (& PyContextVar_Type );
36+ if (PyModule_AddType (m , & PyContextVar_Type ) < 0 ) {
4637 return -1 ;
4738 }
48-
49- Py_INCREF (& PyContextToken_Type );
50- if (PyModule_AddObject (m , "Token" ,
51- (PyObject * )& PyContextToken_Type ) < 0 )
52- {
53- Py_DECREF (& PyContextToken_Type );
39+ if (PyModule_AddType (m , & PyContextToken_Type ) < 0 ) {
5440 return -1 ;
5541 }
56-
5742 return 0 ;
5843}
5944
Original file line number Diff line number Diff line change @@ -703,7 +703,7 @@ static PyMappingMethods PyContext_as_mapping = {
703703
704704PyTypeObject PyContext_Type = {
705705 PyVarObject_HEAD_INIT (& PyType_Type , 0 )
706- "Context" ,
706+ "_contextvars. Context" ,
707707 sizeof (PyContext ),
708708 .tp_methods = PyContext_methods ,
709709 .tp_as_mapping = & PyContext_as_mapping ,
@@ -1056,7 +1056,7 @@ static PyMethodDef PyContextVar_methods[] = {
10561056
10571057PyTypeObject PyContextVar_Type = {
10581058 PyVarObject_HEAD_INIT (& PyType_Type , 0 )
1059- "ContextVar" ,
1059+ "_contextvars. ContextVar" ,
10601060 sizeof (PyContextVar ),
10611061 .tp_methods = PyContextVar_methods ,
10621062 .tp_members = PyContextVar_members ,
@@ -1197,7 +1197,7 @@ static PyMethodDef PyContextTokenType_methods[] = {
11971197
11981198PyTypeObject PyContextToken_Type = {
11991199 PyVarObject_HEAD_INIT (& PyType_Type , 0 )
1200- "Token" ,
1200+ "_contextvars. Token" ,
12011201 sizeof (PyContextToken ),
12021202 .tp_methods = PyContextTokenType_methods ,
12031203 .tp_getset = PyContextTokenType_getsetlist ,
You can’t perform that action at this time.
0 commit comments