Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3e44e9a

Browse files
bpo-44089: Allow subclassing ofcsv.Error (GH-26008) (GH-26066)
* fix subclass error* Update 2021-05-09-22-52-34.bpo-44089.IoANsN.rst(cherry picked from commit2b458c1)Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
1 parent48cb11b commit3e44e9a

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

‎Lib/test/test_csv.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,9 @@ def test__all__(self):
12371237
extra= {'__doc__','__version__'}
12381238
support.check__all__(self,csv, ('csv','_csv'),extra=extra)
12391239

1240+
deftest_subclassable(self):
1241+
# issue 44089
1242+
classFoo(csv.Error): ...
12401243

12411244
if__name__=='__main__':
12421245
unittest.main()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Allow subclassing ``csv.Error`` in 3.10 (it was allowed in 3.9 and earlier but
2+
was disallowed in early versions of 3.10).

‎Modules/_csv.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ static PyType_Slot error_slots[] = {
15151515

15161516
PyType_Specerror_spec= {
15171517
.name="_csv.Error",
1518-
.flags=Py_TPFLAGS_DEFAULT,
1518+
.flags=Py_TPFLAGS_DEFAULT |Py_TPFLAGS_BASETYPE,
15191519
.slots=error_slots,
15201520
};
15211521

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp