Skip to content
Merged
Prev Previous commit
Merge branch 'master' into ctypes-no-hasattr
  • Loading branch information
serhiy-storchaka committed Dec 4, 2018
commit 4cf77fe357a05dd831961f1d31f129478484d1ef
10 changes: 6 additions & 4 deletions Lib/ctypes/test/test_arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,12 @@ class T(Array):
class T(Array):
_type_ = c_int
_length_ = sys.maxsize * 2
with self.assertRaises(TypeError):
class T(Array):
_type_ = c_int
_length_ = 1.87

def test_zero_length(self):
# _length_ can be zero.
class T(Array):
_type_ = c_int
_length_ = 0

@unittest.skipUnless(sys.maxsize > 2**32, 'requires 64bit platform')
@bigmemtest(size=_2G, memuse=1, dry_run=False)
Expand Down
6 changes: 0 additions & 6 deletions Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1434,12 +1434,6 @@ PyCArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
"class must define a '_length_' attribute");
goto error;
}
if (!PyLong_Check(length_attr)) {
PyErr_SetString(PyExc_TypeError,
"The '_length_' attribute must be a positive integer");
Py_DECREF(length_attr);
goto error;
}

if (!PyLong_Check(length_attr)) {
Py_DECREF(length_attr);
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.