Title: Docs and docstrings for io.*.seek are inconsistent · Issue #107801 · python/cpython · GitHub
Open Graph Title: Docs and docstrings for io.*.seek are inconsistent · Issue #107801 · python/cpython
X Title: Docs and docstrings for io.*.seek are inconsistent · Issue #107801 · python/cpython
Description: Documentation The documentation on text handles is misleading, in particular for the seek method. Steps to reproduce handle = open('/tmp/lines.txt') help(handle.seek) This produces the following documentation: Help on built-in function s...
Open Graph Description: Documentation The documentation on text handles is misleading, in particular for the seek method. Steps to reproduce handle = open('/tmp/lines.txt') help(handle.seek) This produces the following do...
X Description: Documentation The documentation on text handles is misleading, in particular for the seek method. Steps to reproduce handle = open('/tmp/lines.txt') help(handle.seek) This produces the foll...
Opengraph URL: https://github.com/python/cpython/issues/107801
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Docs and docstrings for io.*.seek are inconsistent","articleBody":"# Documentation\r\n\r\nThe documentation on text handles is misleading, in particular for the `seek` method.\r\n\r\n# Steps to reproduce\r\n\r\n```\r\nhandle = open('/tmp/lines.txt')\r\nhelp(handle.seek)\r\n```\r\n\r\nThis produces the following documentation:\r\n```\r\nHelp on built-in function seek:\r\n\r\nseek(cookie, whence=0, /) method of _io.TextIOWrapper instance\r\n Change stream position.\r\n \r\n Change the stream position to the given byte offset. The offset is\r\n interpreted relative to the position indicated by whence. Values\r\n for whence are:\r\n \r\n * 0 -- start of stream (the default); offset should be zero or positive\r\n * 1 -- current stream position; offset may be negative\r\n * 2 -- end of stream; offset is usually negative\r\n \r\n Return the new absolute position.\r\n```\r\n\r\n# Issues\r\n\r\n* The documentation talks about a byte offset, but the interface mentions a cookie. \r\n* The constants defined in `os` module, like `os.SEEK_END` are not mentioned.\r\n* whence=2 with negative offset fails.\r\n\r\nGenerally, the behaviour is very inconsistent, seek relative to the end fail, seek relative to the start works, but might yield a situation when `read` fails. \r\n\r\n[Full investigation of the issue](https://wiesmann.codiferes.net/wordpress/archives/36371) \r\n\r\n\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-107899\r\n* gh-107933\r\n* gh-107935\r\n* gh-107936\r\n* gh-108086\r\n* gh-108087\r\n* gh-108099\r\n* gh-108100\r\n* gh-108108\r\n* gh-108136\r\n* gh-108137\r\n* gh-108262\r\n* gh-108264\r\n* gh-108265\r\n* gh-108268\r\n* gh-108547\r\n* gh-108548\r\n* gh-108655\r\n* gh-108656\r\n\u003c!-- /gh-linked-prs --\u003e","author":{"url":"https://github.com/MatthiasWiesmann","@type":"Person","name":"MatthiasWiesmann"},"datePublished":"2023-08-09T08:09:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":16},"url":"https://github.com/107801/cpython/issues/107801"}
| 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:f7b1ee9e-d17d-6471-fab9-468390583dc2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C4C2:32375B:3AA03A:4F02DA:6969ACE6 |
| html-safe-nonce | ad51252437d79627632189e3e35317fb5ff603ca4cbef16216e91da38f485dd8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNEMyOjMyMzc1QjozQUEwM0E6NEYwMkRBOjY5NjlBQ0U2IiwidmlzaXRvcl9pZCI6IjYxNTc2NjIxNjU1NjU4MTE5NDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b8447877ca3d9d1b6233aceb5cf3b2a9db83b493605d02d0a983019897f43f17 |
| hovercard-subject-tag | issue:1842715551 |
| 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/107801/issue_layout |
| twitter:image | https://opengraph.githubassets.com/34bdb31b05346f5162096c22f3da3240f0ba4dbb54598dc8f7b310d4e1caeff5/python/cpython/issues/107801 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/34bdb31b05346f5162096c22f3da3240f0ba4dbb54598dc8f7b310d4e1caeff5/python/cpython/issues/107801 |
| og:image:alt | Documentation The documentation on text handles is misleading, in particular for the seek method. Steps to reproduce handle = open('/tmp/lines.txt') help(handle.seek) This produces the following do... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MatthiasWiesmann |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| 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 | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width