@@ -22,34 +22,34 @@ class templatelib.Interpolation "interpolationobject *" "&_PyInterpolation_Type"
22
22
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=5b183514b4d7e5af]*/
23
23
24
24
int
25
- _conversion_converter (PyObject * arg , PyObject * * conv )
25
+ _conversion_converter (PyObject * arg , PyObject * * conversion )
26
26
{
27
27
if (arg == Py_None ) {
28
28
return 1 ;
29
29
}
30
30
31
31
if (!PyUnicode_Check (arg )) {
32
- _PyArg_BadArgument ("Interpolation" , "argument 'conv '" , "str" , arg );
32
+ _PyArg_BadArgument ("Interpolation" , "argument 'conversion '" , "str" , arg );
33
33
return 0 ;
34
34
}
35
35
36
36
Py_ssize_t len ;
37
37
const char * conv_str = PyUnicode_AsUTF8AndSize (arg , & len );
38
38
if (len != 1 || !(conv_str [0 ] == 'a' || conv_str [0 ] == 'r' || conv_str [0 ] == 's' )) {
39
39
PyErr_SetString (PyExc_ValueError ,
40
- "Interpolation() argument 'conv ' must be one of 's', 'a' or 'r'" );
40
+ "Interpolation() argument 'conversion ' must be one of 's', 'a' or 'r'" );
41
41
return 0 ;
42
42
}
43
43
44
- * conv = arg ;
44
+ * conversion = arg ;
45
45
return 1 ;
46
46
}
47
47
48
48
typedef struct {
49
49
PyObject_HEAD
50
50
PyObject * value ;
51
- PyObject * expr ;
52
- PyObject * conv ;
51
+ PyObject * expression ;
52
+ PyObject * conversion ;
53
53
PyObject * format_spec ;
54
54
} interpolationobject ;
55
55
@@ -58,24 +58,25 @@ typedef struct {
58
58
templatelib.Interpolation.__new__ as interpolation_new
59
59
60
60
value: object
61
- expr : object(subclass_of='&PyUnicode_Type')
62
- conv : object(converter='_conversion_converter') = None
61
+ expression : object(subclass_of='&PyUnicode_Type')
62
+ conversion : object(converter='_conversion_converter') = None
63
63
format_spec: object(subclass_of='&PyUnicode_Type', c_default='&_Py_STR(empty)') = ""
64
64
[clinic start generated code]*/
65
65
66
66
static PyObject *
67
- interpolation_new_impl (PyTypeObject * type , PyObject * value , PyObject * expr ,
68
- PyObject * conv , PyObject * format_spec )
69
- /*[clinic end generated code: output=417d59bccab99648 input=348d81ee06c4be20]*/
67
+ interpolation_new_impl (PyTypeObject * type , PyObject * value ,
68
+ PyObject * expression , PyObject * conversion ,
69
+ PyObject * format_spec )
70
+ /*[clinic end generated code: output=6488e288765bc1a9 input=0abc8e498fb744a7]*/
70
71
{
71
72
interpolationobject * self = (interpolationobject * ) type -> tp_alloc (type , 0 );
72
73
if (!self ) {
73
74
return NULL ;
74
75
}
75
76
76
77
Py_XSETREF (self -> value , Py_NewRef (value ));
77
- Py_XSETREF (self -> expr , Py_NewRef (expr ));
78
- Py_XSETREF (self -> conv , Py_NewRef (conv ));
78
+ Py_XSETREF (self -> expression , Py_NewRef (expression ));
79
+ Py_XSETREF (self -> conversion , Py_NewRef (conversion ));
79
80
Py_XSETREF (self -> format_spec , Py_NewRef (format_spec ));
80
81
return (PyObject * ) self ;
81
82
}
@@ -84,8 +85,8 @@ static void
84
85
interpolation_dealloc (interpolationobject * self )
85
86
{
86
87
Py_CLEAR (self -> value );
87
- Py_CLEAR (self -> expr );
88
- Py_CLEAR (self -> conv );
88
+ Py_CLEAR (self -> expression );
89
+ Py_CLEAR (self -> conversion );
89
90
Py_CLEAR (self -> format_spec );
90
91
Py_TYPE (self )-> tp_free (self );
91
92
}
@@ -95,8 +96,8 @@ interpolation_repr(interpolationobject *self)
95
96
{
96
97
return PyUnicode_FromFormat ("%s(%R, %R, %R, %R)" ,
97
98
_PyType_Name (Py_TYPE (self )),
98
- self -> value , self -> expr ,
99
- self -> conv , self -> format_spec );
99
+ self -> value , self -> expression ,
100
+ self -> conversion , self -> format_spec );
100
101
}
101
102
102
103
static PyObject *
@@ -116,11 +117,11 @@ interpolation_compare(interpolationobject *self, PyObject *other, int op)
116
117
if (valueeq == -1 ) {
117
118
return NULL ;
118
119
}
119
- int expreq = PyUnicode_Compare (self -> expr , other_i -> expr );
120
+ int expreq = PyUnicode_Compare (self -> expression , other_i -> expression );
120
121
if (expreq == -1 && PyErr_Occurred ()) {
121
122
return NULL ;
122
123
}
123
- int conveq = PyObject_RichCompareBool (self -> conv , other_i -> conv , Py_EQ ); // conv might be Py_None
124
+ int conveq = PyObject_RichCompareBool (self -> conversion , other_i -> conversion , Py_EQ ); // conversion might be Py_None
124
125
if (conveq == -1 ) {
125
126
return NULL ;
126
127
}
@@ -136,7 +137,7 @@ interpolation_compare(interpolationobject *self, PyObject *other, int op)
136
137
static Py_hash_t
137
138
interpolation_hash (interpolationobject * self )
138
139
{
139
- PyObject * tuple = PyTuple_Pack (4 , self -> value , self -> expr , self -> conv , self -> format_spec );
140
+ PyObject * tuple = PyTuple_Pack (4 , self -> value , self -> expression , self -> conversion , self -> format_spec );
140
141
if (!tuple ) {
141
142
return -1 ;
142
143
}
@@ -148,15 +149,15 @@ interpolation_hash(interpolationobject *self)
148
149
149
150
static PyMemberDef interpolation_members [] = {
150
151
{"value" , Py_T_OBJECT_EX , offsetof(interpolationobject , value ), Py_READONLY , "Value" },
151
- {"expr " , Py_T_OBJECT_EX , offsetof(interpolationobject , expr ), Py_READONLY , "Expr " },
152
- {"conv " , Py_T_OBJECT_EX , offsetof(interpolationobject , conv ), Py_READONLY , "Conversion" },
152
+ {"expression " , Py_T_OBJECT_EX , offsetof(interpolationobject , expression ), Py_READONLY , "Expression " },
153
+ {"conversion " , Py_T_OBJECT_EX , offsetof(interpolationobject , conversion ), Py_READONLY , "Conversion" },
153
154
{"format_spec" , Py_T_OBJECT_EX , offsetof(interpolationobject , format_spec ), Py_READONLY , "Format specifier" },
154
155
{NULL }
155
156
};
156
157
157
158
PyTypeObject _PyInterpolation_Type = {
158
159
PyVarObject_HEAD_INIT (NULL , 0 )
159
- .tp_name = "templatelib.Interpolation" ,
160
+ .tp_name = "string. templatelib.Interpolation" ,
160
161
.tp_doc = PyDoc_STR ("Interpolation object" ),
161
162
.tp_basicsize = sizeof (interpolationobject ),
162
163
.tp_itemsize = 0 ,
@@ -172,32 +173,32 @@ PyTypeObject _PyInterpolation_Type = {
172
173
static PyObject *
173
174
_get_match_args (void )
174
175
{
175
- PyObject * value = NULL , * expr = NULL , * conv = NULL , * format_spec = NULL ;
176
+ PyObject * value = NULL , * expression = NULL , * conversion = NULL , * format_spec = NULL ;
176
177
PyObject * tuple = NULL ;
177
178
178
179
value = PyUnicode_FromString ("value" );
179
180
if (!value ) {
180
181
goto error ;
181
182
}
182
- expr = PyUnicode_FromString ("expr " );
183
- if (!expr ) {
183
+ expression = PyUnicode_FromString ("expression " );
184
+ if (!expression ) {
184
185
goto error ;
185
186
}
186
- conv = PyUnicode_FromString ("conv " );
187
- if (!conv ) {
187
+ conversion = PyUnicode_FromString ("conversion " );
188
+ if (!conversion ) {
188
189
goto error ;
189
190
}
190
191
format_spec = PyUnicode_FromString ("format_spec" );
191
192
if (!format_spec ) {
192
193
goto error ;
193
194
}
194
195
195
- tuple = PyTuple_Pack (4 , value , expr , conv , format_spec );
196
+ tuple = PyTuple_Pack (4 , value , expression , conversion , format_spec );
196
197
197
198
error :
198
199
Py_XDECREF (value );
199
- Py_XDECREF (expr );
200
- Py_XDECREF (conv );
200
+ Py_XDECREF (expression );
201
+ Py_XDECREF (conversion );
201
202
Py_XDECREF (format_spec );
202
203
return tuple ;
203
204
@@ -240,8 +241,8 @@ _PyInterpolation_FromStackRefSteal(_PyStackRef *values)
240
241
PyTuple_SET_ITEM (args , 0 , PyStackRef_AsPyObjectSteal (values [0 ]));
241
242
PyTuple_SET_ITEM (args , 1 , PyStackRef_AsPyObjectSteal (values [1 ]));
242
243
243
- PyObject * conv = PyStackRef_AsPyObjectSteal (values [2 ]);
244
- PyTuple_SET_ITEM (args , 2 , conv ? conv : Py_NewRef (Py_None ));
244
+ PyObject * conversion = PyStackRef_AsPyObjectSteal (values [2 ]);
245
+ PyTuple_SET_ITEM (args , 2 , conversion ? conversion : Py_NewRef (Py_None ));
245
246
246
247
PyObject * format_spec = PyStackRef_AsPyObjectSteal (values [3 ]);
247
248
PyTuple_SET_ITEM (args , 3 , format_spec ? format_spec : & _Py_STR (empty ));
0 commit comments