Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reverted Py_TPFLAGS_BASETYPE flag deletion, removed corresponding tests
  • Loading branch information
chgnrdv committed May 7, 2023
commit 6c45ff87210c6e26633e24f9a45b11adf0b4bd71
8 changes: 0 additions & 8 deletions Lib/test/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,13 +1437,5 @@ def test_reader_disallow_instantiation(self):
def test_writer_disallow_instantiation(self):
check_disallow_instantiation(self, _csv.Writer)

def test_reader_not_basetype(self):
with self.assertRaisesRegex(TypeError, "type '_csv.reader' is not an acceptable base type"):
class Foo(_csv.Reader): pass

def test_writer_not_basetype(self):
with self.assertRaisesRegex(TypeError, "type '_csv.writer' is not an acceptable base type"):
class Foo(_csv.Writer): pass

if __name__ == '__main__':
unittest.main()
4 changes: 2 additions & 2 deletions Modules/_csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ static PyType_Slot Reader_Type_slots[] = {
PyType_Spec Reader_Type_spec = {
.name = "_csv.reader",
.basicsize = sizeof(ReaderObj),
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION),
.slots = Reader_Type_slots
};
Expand Down Expand Up @@ -1430,7 +1430,7 @@ static PyType_Slot Writer_Type_slots[] = {
PyType_Spec Writer_Type_spec = {
.name = "_csv.writer",
.basicsize = sizeof(WriterObj),
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION),
.slots = Writer_Type_slots,
};
Expand Down