mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
gh-111417: Remove unused code block in math.trunc() and round() (GH-111454)
_PyObject_LookupSpecial() now ensures that the type is ready.
This commit is contained in:
parent
28bb2961ba
commit
efc489021c
2 changed files with 0 additions and 10 deletions
|
@ -2074,11 +2074,6 @@ math_trunc(PyObject *module, PyObject *x)
|
||||||
return PyFloat_Type.tp_as_number->nb_int(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);
|
math_module_state *state = get_math_module_state(module);
|
||||||
trunc = _PyObject_LookupSpecial(x, state->str___trunc__);
|
trunc = _PyObject_LookupSpecial(x, state->str___trunc__);
|
||||||
if (trunc == NULL) {
|
if (trunc == NULL) {
|
||||||
|
|
|
@ -2382,11 +2382,6 @@ builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits)
|
||||||
{
|
{
|
||||||
PyObject *round, *result;
|
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__));
|
round = _PyObject_LookupSpecial(number, &_Py_ID(__round__));
|
||||||
if (round == NULL) {
|
if (round == NULL) {
|
||||||
if (!PyErr_Occurred())
|
if (!PyErr_Occurred())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue