File tree 2 files changed +6
-21
lines changed
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[] = {
30
30
static int
31
31
_contextvars_exec (PyObject * m )
32
32
{
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 ) {
38
34
return -1 ;
39
35
}
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 ) {
46
37
return -1 ;
47
38
}
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 ) {
54
40
return -1 ;
55
41
}
56
-
57
42
return 0 ;
58
43
}
59
44
Original file line number Diff line number Diff line change @@ -703,7 +703,7 @@ static PyMappingMethods PyContext_as_mapping = {
703
703
704
704
PyTypeObject PyContext_Type = {
705
705
PyVarObject_HEAD_INIT (& PyType_Type , 0 )
706
- "Context" ,
706
+ "_contextvars. Context" ,
707
707
sizeof (PyContext ),
708
708
.tp_methods = PyContext_methods ,
709
709
.tp_as_mapping = & PyContext_as_mapping ,
@@ -1056,7 +1056,7 @@ static PyMethodDef PyContextVar_methods[] = {
1056
1056
1057
1057
PyTypeObject PyContextVar_Type = {
1058
1058
PyVarObject_HEAD_INIT (& PyType_Type , 0 )
1059
- "ContextVar" ,
1059
+ "_contextvars. ContextVar" ,
1060
1060
sizeof (PyContextVar ),
1061
1061
.tp_methods = PyContextVar_methods ,
1062
1062
.tp_members = PyContextVar_members ,
@@ -1197,7 +1197,7 @@ static PyMethodDef PyContextTokenType_methods[] = {
1197
1197
1198
1198
PyTypeObject PyContextToken_Type = {
1199
1199
PyVarObject_HEAD_INIT (& PyType_Type , 0 )
1200
- "Token" ,
1200
+ "_contextvars. Token" ,
1201
1201
sizeof (PyContextToken ),
1202
1202
.tp_methods = PyContextTokenType_methods ,
1203
1203
.tp_getset = PyContextTokenType_getsetlist ,
You can’t perform that action at this time.
0 commit comments