[Python-checkins] bpo-8677: use PY_DWORD_MAX instead of INT_MAX (GH-12469)

Inada Naoki webhook-mailer at python.org
Wed Mar 20 07:53:18 EDT 2019


https://github.com/python/cpython/commit/cc60cdd9c44dd15e441603ee5f78e09ea3e76929
commit: cc60cdd9c44dd15e441603ee5f78e09ea3e76929
branch: master
author: Inada Naoki <songofacandy at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-03-20T20:53:08+09:00
summary:

bpo-8677: use PY_DWORD_MAX instead of INT_MAX (GH-12469)

files:
M PC/winreg.c

diff --git a/PC/winreg.c b/PC/winreg.c
index 4dc4e0c281bd..ae0c292b7172 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -1605,13 +1605,11 @@ winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
     long rc;
 
     if (type != REG_SZ) {
-        PyErr_SetString(PyExc_TypeError,
-                        "Type must be winreg.REG_SZ");
+        PyErr_SetString(PyExc_TypeError, "type must be winreg.REG_SZ");
         return NULL;
     }
-    if (value_length >= INT_MAX) {
-        PyErr_SetString(PyExc_OverflowError,
-                        "the value is too long");
+    if ((size_t)value_length >= PY_DWORD_MAX) {
+        PyErr_SetString(PyExc_OverflowError, "value is too long");
         return NULL;
     }
 



More information about the Python-checkins mailing list