diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2018-10-14 21:02:57 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-14 21:02:57 (GMT) |
| commit | e890421e334ccf0c000c6b29c4a521d86cd12f47 (patch) | |
| tree | 17b21008d8c8faf50ca3d512e670c9a71aab4318 /Objects/bytearrayobject.c | |
| parent | de2aea0ff02fa9486365ce9d215bef150fae3a0b (diff) | |
| download | cpython-e890421e334ccf0c000c6b29c4a521d86cd12f47.zip cpython-e890421e334ccf0c000c6b29c4a521d86cd12f47.tar.gz cpython-e890421e334ccf0c000c6b29c4a521d86cd12f47.tar.bz2 | |
bpo-34974: Do not replace unexpected errors in bytes() and bytearray(). (GH-9852)
bytes and bytearray constructors converted unexpected exceptions
(e.g. MemoryError and KeyboardInterrupt) to TypeError.
Diffstat (limited to 'Objects/bytearrayobject.c')
| -rw-r--r-- | Objects/bytearrayobject.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 4e2bb60..58fe53b 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -41,7 +41,6 @@ _getbytevalue(PyObject* arg, int *value) } else { PyObject *index = PyNumber_Index(arg); if (index == NULL) { - PyErr_Format(PyExc_TypeError, "an integer is required"); *value = -1; return 0; } @@ -821,7 +820,7 @@ bytearray_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds) if (PyIndex_Check(arg)) { count = PyNumber_AsSsize_t(arg, PyExc_OverflowError); if (count == -1 && PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_OverflowError)) + if (!PyErr_ExceptionMatches(PyExc_TypeError)) return -1; PyErr_Clear(); /* fall through */ } |
