summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_csv.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-05-08 12:04:43 (GMT)
committerGitHub <noreply@github.com>2023-05-08 12:04:43 (GMT)
commit065e2ae99a4ac81f9c8f56b73333349b0b4cc28a (patch)
tree17db8ede93f17c8f29576d46712af700f15450dd /Lib/test/test_csv.py
parent681d5028bda41fb0755da443cea6be24bd2a0fdd (diff)
downloadcpython-065e2ae99a4ac81f9c8f56b73333349b0b4cc28a.zip
cpython-065e2ae99a4ac81f9c8f56b73333349b0b4cc28a.tar.gz
cpython-065e2ae99a4ac81f9c8f56b73333349b0b4cc28a.tar.bz2
[3.11] gh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Writer` (GH-104266) (#104278)
gh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Writer` (GH-104266) (cherry picked from commit 06c2a4858b8806abc700a0471434067910db54ec) Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_csv.py')
-rw-r--r--Lib/test/test_csv.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py
index 834217b..05653a2 100644
--- a/Lib/test/test_csv.py
+++ b/Lib/test/test_csv.py
@@ -10,7 +10,7 @@ import csv
import gc
import pickle
from test import support
-from test.support import warnings_helper
+from test.support import warnings_helper, import_helper, check_disallow_instantiation
from itertools import permutations
from textwrap import dedent
from collections import OrderedDict
@@ -1390,5 +1390,12 @@ class MiscTestCase(unittest.TestCase):
# issue 44089
class Foo(csv.Error): ...
+ @support.cpython_only
+ def test_disallow_instantiation(self):
+ _csv = import_helper.import_module("_csv")
+ for tp in _csv.Reader, _csv.Writer:
+ with self.subTest(tp=tp):
+ check_disallow_instantiation(self, tp)
+
if __name__ == '__main__':
unittest.main()