@@ -397,6 +397,7 @@ static const unsigned char ascii_linebreak[] = {
397397
398398static int convert_uc (PyObject * obj , void * addr );
399399
400+ struct encoding_map ;
400401#include "clinic/unicodeobject.c.h"
401402
402403_Py_error_handler
@@ -8331,69 +8332,44 @@ PyUnicode_DecodeCharmap(const char *s,
83318332
83328333/* Charmap encoding: the lookup table */
83338334
8335+ /*[clinic input]
8336+ class EncodingMap "struct encoding_map *" "&EncodingMapType"
8337+ [clinic start generated code]*/
8338+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=14e46bbb6c522d22]*/
8339+
83348340struct encoding_map {
83358341 PyObject_HEAD
83368342 unsigned char level1 [32 ];
83378343 int count2 , count3 ;
83388344 unsigned char level23 [1 ];
83398345};
83408346
8341- static PyObject *
8342- encoding_map_size (PyObject * obj , PyObject * args )
8347+ /*[clinic input]
8348+ EncodingMap.size
8349+
8350+ Return the size (in bytes) of this object.
8351+ [clinic start generated code]*/
8352+
8353+ static PyObject *
8354+ EncodingMap_size_impl (struct encoding_map * self )
8355+ /*[clinic end generated code: output=c4c969e4c99342a4 input=004ff13f26bb5366]*/
83438356{
8344- struct encoding_map * map = (struct encoding_map * )obj ;
8345- return PyLong_FromLong (sizeof (* map ) - 1 + 16 * map -> count2 +
8346- 128 * map -> count3 );
8357+ return PyLong_FromLong ((sizeof (* self ) - 1 ) + 16 * self -> count2 +
8358+ 128 * self -> count3 );
83478359}
83488360
83498361static PyMethodDef encoding_map_methods [] = {
8350- {"size" , encoding_map_size , METH_NOARGS ,
8351- PyDoc_STR ("Return the size (in bytes) of this object" ) },
8352- { 0 }
8362+ ENCODINGMAP_SIZE_METHODDEF
8363+ {NULL , NULL }
83538364};
83548365
83558366static PyTypeObject EncodingMapType = {
83568367 PyVarObject_HEAD_INIT (NULL , 0 )
8357- "EncodingMap" , /*tp_name*/
8358- sizeof (struct encoding_map ), /*tp_basicsize*/
8359- 0 , /*tp_itemsize*/
8368+ .tp_name = "EncodingMap" ,
8369+ .tp_basicsize = sizeof (struct encoding_map ),
83608370 /* methods */
8361- 0 , /*tp_dealloc*/
8362- 0 , /*tp_vectorcall_offset*/
8363- 0 , /*tp_getattr*/
8364- 0 , /*tp_setattr*/
8365- 0 , /*tp_as_async*/
8366- 0 , /*tp_repr*/
8367- 0 , /*tp_as_number*/
8368- 0 , /*tp_as_sequence*/
8369- 0 , /*tp_as_mapping*/
8370- 0 , /*tp_hash*/
8371- 0 , /*tp_call*/
8372- 0 , /*tp_str*/
8373- 0 , /*tp_getattro*/
8374- 0 , /*tp_setattro*/
8375- 0 , /*tp_as_buffer*/
8376- Py_TPFLAGS_DEFAULT , /*tp_flags*/
8377- 0 , /*tp_doc*/
8378- 0 , /*tp_traverse*/
8379- 0 , /*tp_clear*/
8380- 0 , /*tp_richcompare*/
8381- 0 , /*tp_weaklistoffset*/
8382- 0 , /*tp_iter*/
8383- 0 , /*tp_iternext*/
8384- encoding_map_methods , /*tp_methods*/
8385- 0 , /*tp_members*/
8386- 0 , /*tp_getset*/
8387- 0 , /*tp_base*/
8388- 0 , /*tp_dict*/
8389- 0 , /*tp_descr_get*/
8390- 0 , /*tp_descr_set*/
8391- 0 , /*tp_dictoffset*/
8392- 0 , /*tp_init*/
8393- 0 , /*tp_alloc*/
8394- 0 , /*tp_new*/
8395- 0 , /*tp_free*/
8396- 0 , /*tp_is_gc*/
8371+ .tp_flags = Py_TPFLAGS_DEFAULT ,
8372+ .tp_methods = encoding_map_methods ,
83978373};
83988374
83998375PyObject *
0 commit comments