Title: Useless code block in math.trunc() ? · Issue #111417 · python/cpython · GitHub
Open Graph Title: Useless code block in math.trunc() ? · Issue #111417 · python/cpython
X Title: Useless code block in math.trunc() ? · Issue #111417 · python/cpython
Description: Bug report Bug description: The math.trunc function has: cpython/Modules/mathmodule.c Lines 2073 to 2076 in f013b47 if (!_PyType_IsReady(Py_TYPE(x))) { if (PyType_Ready(Py_TYPE(x)) < 0) return NULL; } c.f. math.ceil or math.floor. This s...
Open Graph Description: Bug report Bug description: The math.trunc function has: cpython/Modules/mathmodule.c Lines 2073 to 2076 in f013b47 if (!_PyType_IsReady(Py_TYPE(x))) { if (PyType_Ready(Py_TYPE(x)) < 0) return NULL...
X Description: Bug report Bug description: The math.trunc function has: cpython/Modules/mathmodule.c Lines 2073 to 2076 in f013b47 if (!_PyType_IsReady(Py_TYPE(x))) { if (PyType_Ready(Py_TYPE(x)) < 0) return N...
Opengraph URL: https://github.com/python/cpython/issues/111417
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Useless code block in math.trunc() ?","articleBody":"# Bug report\n\n### Bug description:\n\nThe math.trunc function has:\nhttps://github.com/python/cpython/blob/f013b475047b2e9d377feda9f2e16e5cdef824d7/Modules/mathmodule.c#L2073-L2076\nc.f. [math.ceil](https://github.com/python/cpython/blob/f013b475047b2e9d377feda9f2e16e5cdef824d7/Modules/mathmodule.c#L1124-L1148) or [math.floor](https://github.com/python/cpython/blob/f013b475047b2e9d377feda9f2e16e5cdef824d7/Modules/mathmodule.c#L1193-L1217).\n\nThis seems to be a history artifact: the function was introduced in https://github.com/python/cpython/commit/400adb030a78c3fcb1eb458b25c990449fbf3c93 as a moved __builtins__.trunc(), while math.ceil/floor were here from the initial revision.\n\nI think it's safe to remove mentioned block.\n\nPS: Issue opened per @serhiy-storchaka suggestion in #110000.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-111454\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/skirpichev","@type":"Person","name":"skirpichev"},"datePublished":"2023-10-28T01:44:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/111417/cpython/issues/111417"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:99b6345e-6b46-988a-5523-ad52c29bdf57 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 89A0:247E0C:27334CE:35306F7:696ADC71 |
| html-safe-nonce | f1dcf2f2c9f1ab742c01a73659956a1e28ceb14436801915f750fdaf71379e8c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OUEwOjI0N0UwQzoyNzMzNENFOjM1MzA2Rjc6Njk2QURDNzEiLCJ2aXNpdG9yX2lkIjoiMjY2MTc0NTgyMzg1NzY5NTg1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cebe73f39d959cbf277167335eeef07a1495d75804c63c9c5386eb60a91aebf6 |
| hovercard-subject-tag | issue:1966356804 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/111417/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cbb0e9bbeb1ca03210ee947187d5b206478bdde4f8f364392a93fc0ba1c7d3d1/python/cpython/issues/111417 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cbb0e9bbeb1ca03210ee947187d5b206478bdde4f8f364392a93fc0ba1c7d3d1/python/cpython/issues/111417 |
| og:image:alt | Bug report Bug description: The math.trunc function has: cpython/Modules/mathmodule.c Lines 2073 to 2076 in f013b47 if (!_PyType_IsReady(Py_TYPE(x))) { if (PyType_Ready(Py_TYPE(x)) < 0) return NULL... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | skirpichev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 524a93f2c1f36522a3b4be4c110467ee4172245d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width