@@ -3487,26 +3487,6 @@ _PyBytesWriter_CheckConsistency(_PyBytesWriter *writer, char *str)
34873487#endif
34883488
34893489
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-
35103490/* Resize the buffer to make it larger.
35113491 The new buffer may be larger than size bytes because of overallocation.
35123492 Return the updated current pointer inside the buffer.
@@ -3617,9 +3597,6 @@ _PyBytesWriter_Prepare(_PyBytesWriter *writer, void *str, Py_ssize_t size)
36173597int
36183598PyBytesWriter_Prepare (PyBytesWriter * writer , char * * str , Py_ssize_t size )
36193599{
3620- if (PyBytesWriter_CheckPtr (writer , * str ) < 0 ) {
3621- return -1 ;
3622- }
36233600 if (size < 0 ) {
36243601 PyErr_SetString (PyExc_ValueError , "size must be positive" );
36253602 return -1 ;
@@ -3715,11 +3692,6 @@ _PyBytesWriter_Finish(_PyBytesWriter *writer, void *str)
37153692PyObject *
37163693PyBytesWriter_Finish (PyBytesWriter * writer , char * str )
37173694{
3718- if (PyBytesWriter_CheckPtr (writer , str ) < 0 ) {
3719- PyMem_Free (writer );
3720- return NULL ;
3721- }
3722-
37233695 PyObject * res = _PyBytesWriter_Finish ((_PyBytesWriter * )writer , str );
37243696 PyMem_Free (writer );
37253697 return res ;
@@ -3747,10 +3719,6 @@ int
37473719PyBytesWriter_WriteBytes (PyBytesWriter * writer , char * * str ,
37483720 const void * bytes , Py_ssize_t size )
37493721{
3750- if (PyBytesWriter_CheckPtr (writer , * str ) < 0 ) {
3751- return -1 ;
3752- }
3753-
37543722 char * str2 = _PyBytesWriter_WriteBytes ((_PyBytesWriter * )writer , * str ,
37553723 bytes , size );
37563724 if (str2 == NULL ) {
0 commit comments