Title: Remove Dead Code in PyObject_Print · Issue #98421 · python/cpython · GitHub
Open Graph Title: Remove Dead Code in PyObject_Print · Issue #98421 · python/cpython
X Title: Remove Dead Code in PyObject_Print · Issue #98421 · python/cpython
Description: Bug report While working on covering PyObject_Print, I noticed that I couldn't hit some lines with any test. Specifically, the part that checks the type of the representation of the object returned by PyObject_Str or PyObject_Repr: cpyth...
Open Graph Description: Bug report While working on covering PyObject_Print, I noticed that I couldn't hit some lines with any test. Specifically, the part that checks the type of the representation of the object returned...
X Description: Bug report While working on covering PyObject_Print, I noticed that I couldn't hit some lines with any test. Specifically, the part that checks the type of the representation of the object retu...
Opengraph URL: https://github.com/python/cpython/issues/98421
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Remove Dead Code in PyObject_Print","articleBody":"# Bug report\r\n\r\nWhile working on covering `PyObject_Print`, I noticed that I couldn't hit some lines with any test. Specifically, the part that checks the type of the representation of the object returned by `PyObject_Str` or `PyObject_Repr`:\r\nhttps://github.com/python/cpython/blob/f4ead4874b558efa6379e3a130b0c491fec3acb1/Objects/object.c#L280-L308\r\n\r\nAs pointed out by @encukou, both aforementioned functions already check and **ensure** that the return type is a Python string:\r\nhttps://github.com/python/cpython/blob/f4ead4874b558efa6379e3a130b0c491fec3acb1/Objects/object.c#L492-L498\r\nhttps://github.com/python/cpython/blob/f4ead4874b558efa6379e3a130b0c491fec3acb1/Objects/object.c#L433-L439\r\n\r\nSo it is possible to simplify the function by excluding the useless checks of types diffent from Python string.\r\n\r\n","author":{"url":"https://github.com/MonadChains","@type":"Person","name":"MonadChains"},"datePublished":"2022-10-18T23:16:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/98421/cpython/issues/98421"}
| 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:e7073503-c91d-8810-ffd6-926a3e51454e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 93A8:11D50D:A2A61F:D8F761:696991C3 |
| html-safe-nonce | 3f50eec65cc1e71fd54f62b5d26316f6119dbc8226925b0d44e7d40bc055a2e9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5M0E4OjExRDUwRDpBMkE2MUY6RDhGNzYxOjY5Njk5MUMzIiwidmlzaXRvcl9pZCI6IjczNDA1NzA0Mjc0NTg2ODc0MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 043f1bd12416284b422a872b6c3f9c434b2bb01d5b56483baa9e199d8ee78758 |
| hovercard-subject-tag | issue:1413958829 |
| 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/98421/issue_layout |
| twitter:image | https://opengraph.githubassets.com/80ebebda61f80c817c05be224f1ba289a6eb22f27dee2113cd5afad8125a943e/python/cpython/issues/98421 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/80ebebda61f80c817c05be224f1ba289a6eb22f27dee2113cd5afad8125a943e/python/cpython/issues/98421 |
| og:image:alt | Bug report While working on covering PyObject_Print, I noticed that I couldn't hit some lines with any test. Specifically, the part that checks the type of the representation of the object returned... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MonadChains |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3542e147982176a7ebaa23dfb559c8af16f721c03ec560c68c56b64a0f35e751 |
| 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 | af80af7cc9e3de9c336f18b208a600950a3c187c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width