Skip to content

Commit

Permalink
pythongh-111417: Remove unused code block in math.trunc() and round() (
Browse files Browse the repository at this point in the history
…pythonGH-111454)

_PyObject_LookupSpecial() now ensures that the type is ready.
  • Loading branch information
Jason-Y-Z authored and aisk committed Feb 11, 2024
1 parent 73f0b57 commit 6ee8a57
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
5 changes: 0 additions & 5 deletions Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2074,11 +2074,6 @@ math_trunc(PyObject *module, PyObject *x)
return PyFloat_Type.tp_as_number->nb_int(x);
}

if (!_PyType_IsReady(Py_TYPE(x))) {
if (PyType_Ready(Py_TYPE(x)) < 0)
return NULL;
}

math_module_state *state = get_math_module_state(module);
trunc = _PyObject_LookupSpecial(x, state->str___trunc__);
if (trunc == NULL) {
Expand Down
5 changes: 0 additions & 5 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2382,11 +2382,6 @@ builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits)
{
PyObject *round, *result;

if (!_PyType_IsReady(Py_TYPE(number))) {
if (PyType_Ready(Py_TYPE(number)) < 0)
return NULL;
}

round = _PyObject_LookupSpecial(number, &_Py_ID(__round__));
if (round == NULL) {
if (!PyErr_Occurred())
Expand Down

0 comments on commit 6ee8a57

Please sign in to comment.