@@ -2275,7 +2275,7 @@ Struct_pack_impl(PyStructObject *self, PyObject * const *values,
22752275Struct.pack_into
22762276
22772277 buffer: Py_buffer(accept={rwbuffer})
2278- offset as offset_obj: object
2278+ offset: Py_ssize_t
22792279 /
22802280 *values: array
22812281
@@ -2289,11 +2289,10 @@ help(struct) for more on format strings.
22892289
22902290static PyObject *
22912291Struct_pack_into_impl (PyStructObject * self , Py_buffer * buffer ,
2292- PyObject * offset_obj , PyObject * const * values ,
2292+ Py_ssize_t offset , PyObject * const * values ,
22932293 Py_ssize_t values_length )
2294- /*[clinic end generated code: output=b0c2ef496135dad3 input=d0de9b9f138c782d ]*/
2294+ /*[clinic end generated code: output=aa9d9a93f5f8f77b input=9d842a368ee14245 ]*/
22952295{
2296- Py_ssize_t offset ;
22972296 _structmodulestate * state = get_struct_state_structinst (self );
22982297
22992298 ENSURE_STRUCT_IS_READY (self );
@@ -2304,12 +2303,6 @@ Struct_pack_into_impl(PyStructObject *self, Py_buffer *buffer,
23042303 return NULL ;
23052304 }
23062305
2307- /* Extract the offset from the first argument */
2308- offset = PyNumber_AsSsize_t (offset_obj , PyExc_IndexError );
2309- if (offset == -1 && PyErr_Occurred ()) {
2310- return NULL ;
2311- }
2312-
23132306 /* Support negative offsets. */
23142307 if (offset < 0 ) {
23152308 /* Check that negative offset is low enough to fit data */
@@ -2546,7 +2539,7 @@ pack_into
25462539
25472540 format as s_object: cache_struct
25482541 buffer: Py_buffer(accept={rwbuffer})
2549- offset as offset_obj: object
2542+ offset: Py_ssize_t
25502543 /
25512544 *values: array
25522545
@@ -2560,11 +2553,11 @@ strings.
25602553
25612554static PyObject *
25622555pack_into_impl (PyObject * module , PyStructObject * s_object , Py_buffer * buffer ,
2563- PyObject * offset_obj , PyObject * const * values ,
2556+ Py_ssize_t offset , PyObject * const * values ,
25642557 Py_ssize_t values_length )
2565- /*[clinic end generated code: output=148ef659a490eec3 input=3c5fe5bd3b6fd396 ]*/
2558+ /*[clinic end generated code: output=e8bf7d422b2088ef input=086867c0f5d8a8e4 ]*/
25662559{
2567- return Struct_pack_into_impl (s_object , buffer , offset_obj ,
2560+ return Struct_pack_into_impl (s_object , buffer , offset ,
25682561 values , values_length );
25692562}
25702563
0 commit comments