8000 bpo-44089: Allow subclassing of ``csv.Error`` by Fidget-Spinner · Pull Request #26008 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44089: Allow subclassing of csv.Error #26008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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 8000
Diff view
Diff view
3 changes: 3 additions & 0 deletions Lib/test/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,9 @@ def test__all__(self):
extra = {'__doc__', '__version__'}
support.check__all__(self, csv, ('csv', '_csv'), extra=extra)

def test_subclassable(self):
# issue 44089
class Foo(csv.Error): ...

if __name__ == '__main__':
unittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Allow subclassing ``csv.Error`` in 3.10 (it was allowed in 3.9 and earlier but
was disallowed in early versions of 3.10).
2 changes: 1 addition & 1 deletion Modules/_csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ static PyType_Slot error_slots[] = {

PyType_Spec error_spec = {
.name = "_csv.Error",
.flags = Py_TPFLAGS_DEFAULT,
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.slots = error_slots,
};

Expand Down
0