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
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
Diff view
Diff view
4 changes: 4 additions & 0 deletions 4 Lib/test/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def fileno(self):
a[:] = [F()] * 10
self.assertEqual(select.select([], a, []), ([], a[:5], []))

def test_disallow_instantiation(self):
tp = type(select.poll())
self.assertRaises(TypeError, tp)
Comment thread
erlend-aasland marked this conversation as resolved.

def tearDownModule():
support.reap_children()

Expand Down
17 changes: 4 additions & 13 deletions 17 Modules/selectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,6 @@ newPollObject(PyObject *module)
return self;
}

static PyObject *
poll_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyErr_Format(PyExc_TypeError, "Cannot create '%.200s' instances", _PyType_Name(type));
return NULL;
}

static void
poll_dealloc(pollObject *self)
{
Expand Down Expand Up @@ -2275,16 +2268,14 @@ static PyMethodDef poll_methods[] = {
static PyType_Slot poll_Type_slots[] = {
{Py_tp_dealloc, poll_dealloc},
{Py_tp_methods, poll_methods},
{Py_tp_new, poll_new},
{0, 0},
};

static PyType_Spec poll_Type_spec = {
"select.poll",
sizeof(pollObject),
0,
Py_TPFLAGS_DEFAULT,
poll_Type_slots
.name = "select.poll",
.basicsize = sizeof(pollObject),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
.slots = poll_Type_slots,
};

#ifdef HAVE_SYS_DEVPOLL_H
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.