File tree 2 files changed +8
-12
lines changed
Filter options
2 files changed +8
-12
lines changed
Original file line number Diff line number Diff line change @@ -720,16 +720,8 @@ PyInit__io(void)
720
720
// Add types
721
721
for (size_t i = 0 ; i < Py_ARRAY_LENGTH (static_types ); i ++ ) {
722
722
PyTypeObject * type = static_types [i ];
723
- // Private type not exposed in the _io module
724
- if (type == & _PyBytesIOBuffer_Type ) {
725
- if (PyType_Ready (type ) < 0 ) {
726
- goto fail ;
727
- }
728
- }
729
- else {
730
- if (PyModule_AddType (m , type ) < 0 ) {
731
- goto fail ;
732
- }
723
+ if (PyModule_AddType (m , type ) < 0 ) {
724
+ goto fail ;
733
725
}
734
726
}
735
727
Original file line number Diff line number Diff line change @@ -1448,12 +1448,10 @@ test_from_contiguous(PyObject* self, PyObject *Py_UNUSED(ignored))
1448
1448
}
1449
1449
1450
1450
#if (defined(__linux__ ) || defined(__FreeBSD__ )) && defined(__GNUC__ )
1451
- extern PyTypeObject _PyBytesIOBuffer_Type ;
1452
1451
1453
1452
static PyObject *
1454
1453
test_pep3118_obsolete_write_locks (PyObject * self , PyObject * Py_UNUSED (ignored ))
1455
1454
{
1456
- PyTypeObject * type = & _PyBytesIOBuffer_Type ;
1457
1455
PyObject * b ;
1458
1456
char * dummy [1 ];
1459
1457
int ret , match ;
@@ -1466,7 +1464,13 @@ test_pep3118_obsolete_write_locks(PyObject* self, PyObject *Py_UNUSED(ignored))
1466
1464
goto error ;
1467
1465
1468
1466
/* bytesiobuf_getbuffer() */
1467
+ PyTypeObject * type = (PyTypeObject * )_PyImport_GetModuleAttrString (
1468
+ "_io" , "_BytesIOBuffer" );
1469
+ if (type == NULL ) {
1470
+ return NULL ;
1471
+ }
1469
1472
b = type -> tp_alloc (type , 0 );
1473
+ Py_DECREF (type );
1470
1474
if (b == NULL ) {
1471
1475
return NULL ;
1472
1476
}
You can’t perform that action at this time.
0 commit comments