Skip to content

Commit efc4890

Browse files
authored
gh-111417: Remove unused code block in math.trunc() and round() (GH-111454)
_PyObject_LookupSpecial() now ensures that the type is ready.
1 parent 28bb296 commit efc4890

File tree

2 files changed

+0
-10
lines changed

2 files changed

+0
-10
lines changed

Modules/mathmodule.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,11 +2074,6 @@ math_trunc(PyObject *module, PyObject *x)
20742074
return PyFloat_Type.tp_as_number->nb_int(x);
20752075
}
20762076

2077-
if (!_PyType_IsReady(Py_TYPE(x))) {
2078-
if (PyType_Ready(Py_TYPE(x)) < 0)
2079-
return NULL;
2080-
}
2081-
20822077
math_module_state *state = get_math_module_state(module);
20832078
trunc = _PyObject_LookupSpecial(x, state->str___trunc__);
20842079
if (trunc == NULL) {

Python/bltinmodule.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,11 +2382,6 @@ builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits)
23822382
{
23832383
PyObject *round, *result;
23842384

2385-
if (!_PyType_IsReady(Py_TYPE(number))) {
2386-
if (PyType_Ready(Py_TYPE(number)) < 0)
2387-
return NULL;
2388-
}
2389-
23902385
round = _PyObject_LookupSpecial(number, &_Py_ID(__round__));
23912386
if (round == NULL) {
23922387
if (!PyErr_Occurred())

0 commit comments

Comments
 (0)