Skip to content

Commit f42270d

Browse files
ameilyzooba
andcommitted
Apply suggestions from code review
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
1 parent 4a1be05 commit f42270d

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Modules/_ctypes/callproc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,8 +1326,8 @@ static PyObject *format_error(PyObject *self, PyObject *args)
13261326
if (!PyArg_ParseTuple(args, "|L:FormatError", &code))
13271327
return NULL;
13281328

1329-
if(code < LONG_MIN || code > ULONG_MAX) {
1330-
PyErr_SetString(PyExc_OverflowError, "int doesn't fit in long");
1329+
if((DWORD)code != code) {
1330+
PyErr_Format(PyExc_OverflowError, "error code %lld too big for int", code);
13311331
return NULL;
13321332
}
13331333

Objects/exceptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ oserror_parse_args(PyObject **p_args,
854854
return -1;
855855

856856
if(winerrcode < LONG_MIN || winerrcode > ULONG_MAX) {
857-
PyErr_SetString(PyExc_OverflowError, "int doesn't fit in long");
857+
PyErr_Format(PyExc_OverflowError, "error code %lld too big for int", winerrcode);
858858
return -1;
859859
}
860860

0 commit comments

Comments
 (0)