File tree Expand file tree Collapse file tree 4 files changed +13
-9
lines changed Expand file tree Collapse file tree 4 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,10 @@ static inline PyObject *CPyTuple_LoadEmptyTupleConstant(void) {
7474 return __mypyc_empty_tuple__ ;
7575}
7676
77+ // Shared unicode objects for method names
78+ extern PyObject * clear_id_unicode ;
79+ extern PyObject * copy_id_unicode ;
80+
7781// Native object operations
7882
7983
Original file line number Diff line number Diff line change @@ -15,8 +15,7 @@ static PyObject *update_id_unicode = NULL;
1515static PyObject * keys_id_unicode = NULL ;
1616static PyObject * values_id_unicode = NULL ;
1717static PyObject * items_id_unicode = NULL ;
18- static PyObject * clear_id_unicode = NULL ;
19- static PyObject * copy_id_unicode = NULL ;
18+ // clear_id_unicode and copy_id_unicode are shared with list_ops, declared in misc_ops.c
2019
2120// Dict subclasses like defaultdict override things in interesting
2221// ways, so we don't want to just directly use the dict methods. Not
Original file line number Diff line number Diff line change 99#define Py_TPFLAGS_SEQUENCE (1 << 5)
1010#endif
1111
12- static PyObject * clear_id_unicode = NULL ;
13- static PyObject * copy_id_unicode = NULL ;
12+ // clear_id_unicode and copy_id_unicode are shared with dict_ops, declared in misc_ops.c
1413
1514PyObject * CPyList_Build (Py_ssize_t len , ...) {
1615 Py_ssize_t i ;
@@ -38,7 +37,7 @@ char CPyList_Clear(PyObject *list) {
3837 } else {
3938 if (clear_id_unicode == NULL ) {
4039 _Py_IDENTIFIER (clear );
41- PyObject * clear_id_unicode = _PyUnicode_FromId (& PyId_clear );
40+ clear_id_unicode = _PyUnicode_FromId (& PyId_clear );
4241 if (clear_id_unicode == NULL ) {
4342 return 0 ;
4443 }
@@ -57,7 +56,7 @@ PyObject *CPyList_Copy(PyObject *list) {
5756 }
5857 if (copy_id_unicode == NULL ) {
5958 _Py_IDENTIFIER (copy );
60- PyObject * copy_id_unicode = _PyUnicode_FromId (& PyId_copy );
59+ copy_id_unicode = _PyUnicode_FromId (& PyId_copy );
6160 if (copy_id_unicode == NULL ) {
6261 return NULL ;
6362 }
Original file line number Diff line number Diff line change 66#include <patchlevel.h>
77#include "CPy.h"
88
9+ PyObject * clear_id_unicode = NULL ;
10+ PyObject * copy_id_unicode = NULL ;
11+ static PyObject * send_id_unicode = NULL ;
12+
913PyObject * CPy_GetCoro (PyObject * obj )
1014{
1115 // If the type has an __await__ method, call it,
@@ -20,8 +24,6 @@ PyObject *CPy_GetCoro(PyObject *obj)
2024 }
2125}
2226
23- static PyObject * send_id_unicode = NULL ;
24-
2527PyObject * CPyIter_Send (PyObject * iter , PyObject * val )
2628{
2729 // Do a send, or a next if second arg is None.
@@ -31,7 +33,7 @@ PyObject *CPyIter_Send(PyObject *iter, PyObject *val)
3133 } else {
3234 if (send_id_unicode == NULL ) {
3335 _Py_IDENTIFIER (send );
34- PyObject * send_id_unicode = _PyUnicode_FromId (& PyId_send ); /* borrowed */
36+ send_id_unicode = _PyUnicode_FromId (& PyId_send ); /* borrowed */
3537 if (send_id_unicode == NULL ) {
3638 return NULL ;
3739 }
You can’t perform that action at this time.
0 commit comments