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

Appearance settings

gh-104265 Disallow instantiation of _csv.Reader and _csv.Writer #104266

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 13 commits into from
May 7, 2023
Merged
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
applied suggestion by erlend-aasland
  • Loading branch information
chgnrdv committed May 7, 2023
commit 8255467fac91c691367f1b38a1a89a28f68dd5bc
14 changes: 7 additions & 7 deletions 14 Lib/test/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
from io import StringIO
from tempfile import TemporaryFile
import csv
import _csv
import gc
import pickle
from test import support
from test.support import warnings_helper, check_disallow_instantiation
from test.support import warnings_helper, import_helper, check_disallow_instantiation
from itertools import permutations
from textwrap import dedent
from collections import OrderedDict
Expand Down Expand Up @@ -1431,11 +1430,12 @@ def test_subclassable(self):
# issue 44089
class Foo(csv.Error): ...

def test_reader_disallow_instantiation(self):
check_disallow_instantiation(self, _csv.Reader)

def test_writer_disallow_instantiation(self):
check_disallow_instantiation(self, _csv.Writer)
@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()
Morty Proxy This is a proxified and sanitized view of the page, visit original site.