@@ -88,7 +88,6 @@ static int add_last_error(PyObject* self, buffer_t buffer,
88
88
89
89
message_start = buffer_save_space (buffer , 4 );
90
90
if (message_start == -1 ) {
91
- PyErr_NoMemory ();
92
91
return 0 ;
93
92
}
94
93
if (!buffer_write_int32 (buffer , (int32_t )request_id ) ||
@@ -109,7 +108,6 @@ static int add_last_error(PyObject* self, buffer_t buffer,
109
108
/* save space for length */
110
109
document_start = buffer_save_space (buffer , 4 );
111
110
if (document_start == -1 ) {
112
- PyErr_NoMemory ();
113
111
return 0 ;
114
112
}
115
113
@@ -154,7 +152,6 @@ static int init_insert_buffer(buffer_t buffer, int request_id, int options,
154
152
/* Save space for message length */
155
153
int length_location = buffer_save_space (buffer , 4 );
156
154
if (length_location == -1 ) {
157
- PyErr_NoMemory ();
158
155
return length_location ;
159
156
}
160
157
if (!buffer_write_int32 (buffer , (int32_t )request_id ) ||
@@ -212,7 +209,6 @@ static PyObject* _cbson_insert_message(PyObject* self, PyObject* args) {
212
209
}
213
210
buffer = buffer_new ();
214
211
if (!buffer ) {
215
- PyErr_NoMemory ();
216
212
destroy_codec_options (& options );
217
213
PyMem_Free (collection_name );
218
214
return NULL ;
@@ -346,7 +342,6 @@ static PyObject* _cbson_update_message(PyObject* self, PyObject* args) {
346
342
buffer = buffer_new ();
347
343
if (!buffer ) {
348
344
destroy_codec_options (& options );
349
- PyErr_NoMemory ();
350
345
PyMem_Free (collection_name );
351
346
return NULL ;
352
347
}
@@ -356,7 +351,6 @@ static PyObject* _cbson_update_message(PyObject* self, PyObject* args) {
356
351
if (length_location == -1 ) {
357
352
destroy_codec_options (& options );
358
353
PyMem_Free (collection_name );
359
- PyErr_NoMemory ();
360
354
return NULL ;
361
355
}
362
356
if (!buffer_write_int32 (buffer , (int32_t )request_id ) ||
@@ -454,7 +448,6 @@ static PyObject* _cbson_query_message(PyObject* self, PyObject* args) {
454
448
}
455
449
buffer = buffer_new ();
456
450
if (!buffer ) {
457
- PyErr_NoMemory ();
458
451
destroy_codec_options (& options );
459
452
PyMem_Free (collection_name );
460
453
return NULL ;
@@ -465,7 +458,6 @@ static PyObject* _cbson_query_message(PyObject* self, PyObject* args) {
465
458
if (length_location == -1 ) {
466
459
destroy_codec_options (& options );
467
460
PyMem_Free (collection_name );
468
- PyErr_NoMemory ();
469
461
return NULL ;
470
462
}
471
463
@@ -585,7 +577,6 @@ static PyObject* _cbson_get_more_message(PyObject* self, PyObject* args) {
585
577
}
586
578
buffer = buffer_new ();
587
579
if (!buffer ) {
588
- PyErr_NoMemory ();
589
580
PyMem_Free (collection_name );
590
581
return NULL ;
591
582
}
@@ -594,7 +585,6 @@ static PyObject* _cbson_get_more_message(PyObject* self, PyObject* args) {
594
585
length_location = buffer_save_space (buffer , 4 );
595
586
if (length_location == -1 ) {
596
587
PyMem_Free (collection_name );
597
- PyErr_NoMemory ();
598
588
return NULL ;
599
589
}
600
590
if (!buffer_write_int32 (buffer , (int32_t )request_id ) ||
@@ -665,14 +655,12 @@ static PyObject* _cbson_op_msg(PyObject* self, PyObject* args) {
665
655
}
666
656
buffer = buffer_new ();
667
657
if (!buffer ) {
668
- PyErr_NoMemory ();
669
658
goto bufferfail ;
670
659
}
671
660
672
661
// save space for message length
673
662
length_location = buffer_save_space (buffer , 4 );
674
663
if (length_location == -1 ) {
675
- PyErr_NoMemory ();
676
664
goto bufferfail ;
677
665
}
678
666
if (!buffer_write_int32 (buffer , (int32_t )request_id ) ||
@@ -879,7 +867,6 @@ static PyObject* _cbson_do_batched_insert(PyObject* self, PyObject* args) {
879
867
buffer = buffer_new ();
880
868
if (!buffer ) {
881
869
destroy_codec_options (& options );
882
- PyErr_NoMemory ();
883
870
PyMem_Free (collection_name );
884
871
return NULL ;
885
872
}
@@ -944,7 +931,6 @@ static PyObject* _cbson_do_batched_insert(PyObject* self, PyObject* args) {
944
931
int message_start ;
945
932
buffer_t new_buffer = buffer_new ();
946
933
if (!new_buffer ) {
947
- PyErr_NoMemory ();
948
934
goto iterfail ;
949
935
}
950
936
message_start = init_insert_buffer (new_buffer ,
@@ -1181,7 +1167,6 @@ _batched_op_msg(
1181
1167
/* Save space for size */
1182
1168
size_location = buffer_save_space (buffer , 4 );
1183
1169
if (size_location == -1 ) {
1184
- PyErr_NoMemory ();
1185
1170
return 0 ;
1186
1171
}
1187
1172
@@ -1325,7 +1310,6 @@ _cbson_encode_batched_op_msg(PyObject* self, PyObject* args) {
1325
1310
return NULL ;
1326
1311
}
1327
1312
if (!(buffer = buffer_new ())) {
1328
- PyErr_NoMemory ();
1329
1313
destroy_codec_options (& options );
1330
1314
return NULL ;
1331
1315
}
@@ -1381,13 +1365,11 @@ _cbson_batched_op_msg(PyObject* self, PyObject* args) {
1381
1365
return NULL ;
1382
1366
}
1383
1367
if (!(buffer = buffer_new ())) {
1384
- PyErr_NoMemory ();
1385
1368
destroy_codec_options (& options );
1386
1369
return NULL ;
1387
1370
}
1388
1371
/* Save space for message length and request id */
1389
1372
if ((buffer_save_space (buffer , 8 )) == -1 ) {
1390
- PyErr_NoMemory ();
1391
1373
goto fail ;
1392
1374
}
1393
1375
if (!buffer_write_bytes (buffer ,
@@ -1552,7 +1534,6 @@ _batched_write_command(
1552
1534
/* Save space for list document */
1553
1535
lst_len_loc = buffer_save_space (buffer , 4 );
1554
1536
if (lst_len_loc == -1 ) {
1555
- PyErr_NoMemory ();
1556
1537
return 0 ;
1557
1538
}
1558
1539
@@ -1672,7 +1653,6 @@ _cbson_encode_batched_write_command(PyObject* self, PyObject* args) {
1672
1653
return NULL ;
1673
1654
}
1674
1655
if (!(buffer = buffer_new ())) {
1675
- PyErr_NoMemory ();
1676
1656
PyMem_Free (ns );
1677
1657
destroy_codec_options (& options );
1678
1658
return NULL ;
@@ -1732,14 +1712,12 @@ _cbson_batched_write_command(PyObject* self, PyObject* args) {
1732
1712
return NULL ;
1733
1713
}
1734
1714
if (!(buffer = buffer_new ())) {
1735
- PyErr_NoMemory ();
1736
1715
PyMem_Free (ns );
1737
1716
destroy_codec_options (& options );
1738
1717
return NULL ;
1739
1718
}
1740
1719
/* Save space for message length and request id */
1741
1720
if ((buffer_save_space (buffer , 8 )) == -1 ) {
1742
- PyErr_NoMemory ();
1743
1721
goto fail ;
1744
1722
}
1745
1723
if (!buffer_write_bytes (buffer ,
0 commit comments