File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ typedef struct _pycontexttokenobject PyContextToken;
2323
2424
2525PyAPI_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 );
2728
2829PyAPI_FUNC (int ) PyContext_Enter (PyContext * );
2930PyAPI_FUNC (int ) PyContext_Exit (PyContext * );
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ static PyObject *
1616_contextvars_copy_context_impl (PyObject * module )
1717/*[clinic end generated code: output=1fcd5da7225c4fa9 input=89bb9ae485888440]*/
1818{
19- return (PyObject * )PyContext_Copy ();
19+ return (PyObject * )PyContext_CopyCurrent ();
2020}
2121
2222
Original file line number Diff line number Diff line change @@ -30,9 +30,6 @@ context_new_from_vars(PyHamtObject *vars);
3030static inline PyContext *
3131context_get (void );
3232
33- static inline PyContext *
34- context_copy (void );
35-
3633static PyContextToken *
3734token_new (PyContext * ctx , PyContextVar * var , PyObject * val );
3835
@@ -61,9 +58,21 @@ PyContext_New(void)
6158
6259
6360PyContext *
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 )
6569{
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 );
6776}
6877
6978
@@ -341,17 +350,6 @@ context_get(void)
341350 return current_ctx ;
342351}
343352
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-
355353static int
356354context_check_key_type (PyObject * key )
357355{
You can’t perform that action at this time.
0 commit comments