@@ -3487,26 +3487,6 @@ _PyBytesWriter_CheckConsistency(_PyBytesWriter *writer, char *str)
3487
3487
#endif
3488
3488
3489
3489
3490
- static int
3491
- PyBytesWriter_CheckPtr (PyBytesWriter * pub_writer , char * str )
3492
- {
3493
- if (str == NULL ) {
3494
- PyErr_SetString (PyExc_ValueError , "str is NULL" );
3495
- return -1 ;
3496
- }
3497
-
3498
- _PyBytesWriter * writer = (_PyBytesWriter * )pub_writer ;
3499
- const char * start = _PyBytesWriter_AsString (writer );
3500
- const char * end = start + writer -> allocated ;
3501
-
3502
- if (str < start || end < str ) {
3503
- PyErr_SetString (PyExc_ValueError , "str is out of bounds" );
3504
- return -1 ;
3505
- }
3506
- return 0 ;
3507
- }
3508
-
3509
-
3510
3490
/* Resize the buffer to make it larger.
3511
3491
The new buffer may be larger than size bytes because of overallocation.
3512
3492
Return the updated current pointer inside the buffer.
@@ -3617,9 +3597,6 @@ _PyBytesWriter_Prepare(_PyBytesWriter *writer, void *str, Py_ssize_t size)
3617
3597
int
3618
3598
PyBytesWriter_Prepare (PyBytesWriter * writer , char * * str , Py_ssize_t size )
3619
3599
{
3620
- if (PyBytesWriter_CheckPtr (writer , * str ) < 0 ) {
3621
- return -1 ;
3622
- }
3623
3600
if (size < 0 ) {
3624
3601
PyErr_SetString (PyExc_ValueError , "size must be positive" );
3625
3602
return -1 ;
@@ -3715,11 +3692,6 @@ _PyBytesWriter_Finish(_PyBytesWriter *writer, void *str)
3715
3692
PyObject *
3716
3693
PyBytesWriter_Finish (PyBytesWriter * writer , char * str )
3717
3694
{
3718
- if (PyBytesWriter_CheckPtr (writer , str ) < 0 ) {
3719
- PyMem_Free (writer );
3720
- return NULL ;
3721
- }
3722
-
3723
3695
PyObject * res = _PyBytesWriter_Finish ((_PyBytesWriter * )writer , str );
3724
3696
PyMem_Free (writer );
3725
3697
return res ;
@@ -3747,10 +3719,6 @@ int
3747
3719
PyBytesWriter_WriteBytes (PyBytesWriter * writer , char * * str ,
3748
3720
const void * bytes , Py_ssize_t size )
3749
3721
{
3750
- if (PyBytesWriter_CheckPtr (writer , * str ) < 0 ) {
3751
- return -1 ;
3752
- }
3753
-
3754
3722
char * str2 = _PyBytesWriter_WriteBytes ((_PyBytesWriter * )writer , * str ,
3755
3723
bytes , size );
3756
3724
if (str2 == NULL ) {
0 commit comments