Commit cc8873c 1 parent 7070cca commit cc8873c Copy full SHA for cc8873c
File tree 3 files changed +17
-18
lines changed
3 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ typedef struct _pycontexttokenobject PyContextToken;
23
23
24
24
25
25
PyAPI_FUNC (PyContext * ) PyContext_New (void );
26
- PyAPI_FUNC (PyContext * ) PyContext_Copy (void );
26
+ PyAPI_FUNC (PyContext * ) PyContext_Copy (PyContext * );
27
+ PyAPI_FUNC (PyContext * ) PyContext_CopyCurrent (void );
27
28
28
29
PyAPI_FUNC (int ) PyContext_Enter (PyContext * );
29
30
PyAPI_FUNC (int ) PyContext_Exit (PyContext * );
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ static PyObject *
16
16
_contextvars_copy_context_impl (PyObject * module )
17
17
/*[clinic end generated code: output=1fcd5da7225c4fa9 input=89bb9ae485888440]*/
18
18
{
19
- return (PyObject * )PyContext_Copy ();
19
+ return (PyObject * )PyContext_CopyCurrent ();
20
20
}
21
21
22
22
Original file line number Diff line number Diff line change @@ -30,9 +30,6 @@ context_new_from_vars(PyHamtObject *vars);
30
30
static inline PyContext *
31
31
context_get (void );
32
32
33
- static inline PyContext *
34
- context_copy (void );
35
-
36
33
static PyContextToken *
37
34
token_new (PyContext * ctx , PyContextVar * var , PyObject * val );
38
35
@@ -61,9 +58,21 @@ PyContext_New(void)
61
58
62
59
63
60
PyContext *
64
- PyContext_Copy (void )
61
+ PyContext_Copy (PyContext * ctx )
62
+ {
63
+ return context_new_from_vars (ctx -> ctx_vars );
64
+ }
65
+
66
+
67
+ PyContext *
68
+ PyContext_CopyCurrent (void )
65
69
{
66
- return context_copy ();
70
+ PyContext * ctx = context_get ();
71
+ if (ctx == NULL ) {
72
+ return NULL ;
73
+ }
74
+
75
+ return context_new_from_vars (ctx -> ctx_vars );
67
76
}
68
77
69
78
@@ -341,17 +350,6 @@ context_get(void)
341
350
return current_ctx ;
342
351
}
343
352
344
- static inline PyContext *
345
- context_copy (void )
346
- {
347
- PyContext * ctx = context_get ();
348
- if (ctx == NULL ) {
349
- return NULL ;
350
- }
351
-
352
- return context_new_from_vars (ctx -> ctx_vars );
353
- }
354
-
355
353
static int
356
354
context_check_key_type (PyObject * key )
357
355
{
You can’t perform that action at this time.
0 commit comments