[issue34397] remove redundant overflow checks in tuple and list implementations

2020-05-25 Thread Cheryl Sabella
Change by Cheryl Sabella : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue34397] remove redundant overflow checks in tuple and list implementations

2020-05-25 Thread miss-islington
miss-islington added the comment: New changeset e682b26a6bc6d3db1a44d82db09d26224e82ccb5 by Sergey Fedoseev in branch 'master': bpo-34397: Remove redundant overflow checks in list and tuple implementation. (GH-8757)

[issue34397] remove redundant overflow checks in tuple and list implementations

2019-01-24 Thread Windson Yang
Windson Yang added the comment: I reviewed the patch months ago, maybe we need a core developer review this path? -- ___ Python tracker ___

[issue34397] remove redundant overflow checks in tuple and list implementations

2018-09-21 Thread Tim Peters
Tim Peters added the comment: Because the behavior of signed integer overflow isn't defined in C. Picture a 3-bit integer type, where the maximum value of the signed integer type is 3. 3+3 has no defined result. Cast them to the unsigned flavor of the integer type, though, and the result

[issue34397] remove redundant overflow checks in tuple and list implementations

2018-09-21 Thread Windson Yang
Windson Yang added the comment: Hello, Tim Peters. I wonder why we need to add size_t here: assert((size_t)Py_SIZE(a) + (size_t)Py_SIZE(b) <= (size_t)PY_SSIZE_T_MAX); AFAIK, PY_SSIZE_T_MAX = ((Py_ssize_t)(((size_t)-1)>>1)) which is signed, either Py_SIZE(a) or Py_SIZE(b) is a positive

[issue34397] remove redundant overflow checks in tuple and list implementations

2018-08-14 Thread Tim Peters
Tim Peters added the comment: Bah - the relevant thing to assert is really assert((size_t)Py_SIZE(a) + (size_t)Py_SIZE(b) <= (size_t)PY_SSIZE_T_MAX); C sucks ;-) -- ___ Python tracker

[issue34397] remove redundant overflow checks in tuple and list implementations

2018-08-14 Thread Tim Peters
Tim Peters added the comment: I agree there's pointless code now, but don't understand why the patch replaces it with mysterious asserts. For example, what's the point of this? assert(Py_SIZE(a) <= PY_SSIZE_T_MAX / sizeof(PyObject*)); assert(Py_SIZE(b) <= PY_SSIZE_T_MAX /

[issue34397] remove redundant overflow checks in tuple and list implementations

2018-08-13 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +mark.dickinson, serhiy.storchaka, tim.peters ___ Python tracker ___ ___ Python-bugs-list

[issue34397] remove redundant overflow checks in tuple and list implementations

2018-08-13 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Max size of list and tuples is limited by PY_SSIZE_T_MAX / sizeof(PyObject*), so the sum of any two list/tuples sizes always <= PY_SSIZE_T_MAX if sizeof(PyObject*) > 1, which seems true for all supported (existing?) platforms. It means that overflow

[issue34397] remove redundant overflow checks in tuple and list implementations

2018-08-13 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +8233 stage: -> patch review ___ Python tracker ___ ___