Title: bpo-36865: allow 'rt' mode in FileInput by natgaertner · Pull Request #13221 · python/cpython · GitHub
Open Graph Title: bpo-36865: allow 'rt' mode in FileInput by natgaertner · Pull Request #13221 · python/cpython
X Title: bpo-36865: allow 'rt' mode in FileInput by natgaertner · Pull Request #13221 · python/cpython
Description: The FileInput class (https://github.com/python/cpython/blob/master/Lib/fileinput.py) delegates to the open function, gzip, or bz2. Each of these delegates supports the 'rt' mode flag, so FileInput can probably support it as well. This might clear up some confusion as in https://bugs.python.org/issue5758, which, in accordance with the FileInput docs, assumes all files opened with the 'r' flag will be opened in text mode. For gzip and bz2 this is not the case, they will be opened in binary 'rb' mode. This pull request adds the 'rt' mode to the allowed modes, expands the unit test for FileInput to test opening with all allowed modes, and makes the documentation in FileInput about the behavior of the 'r' flag more accurate. https://bugs.python.org/issue36865
Open Graph Description: The FileInput class (https://github.com/python/cpython/blob/master/Lib/fileinput.py) delegates to the open function, gzip, or bz2. Each of these delegates supports the 'rt' mode flag, so Fi...
X Description: The FileInput class (https://github.com/python/cpython/blob/master/Lib/fileinput.py) delegates to the open function, gzip, or bz2. Each of these delegates supports the 'rt' mode fla...
Opengraph URL: https://github.com/python/cpython/pull/13221
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ee5e6379-765f-ce6d-e03b-301fd91e0f9d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CE2A:2BC60D:E46D47:148B593:6A58B6BF |
| html-safe-nonce | 85ce89ec70bd87e059c530f146959dd10c7ddb4883141680ea95e30cc3321755 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTJBOjJCQzYwRDpFNDZENDc6MTQ4QjU5Mzo2QTU4QjZCRiIsInZpc2l0b3JfaWQiOiI0NjkwMjUyODU2MjI5OTM0NzgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 54e47acc058781389ae79fe1337f8eb27c4ffb64c965eb6bb1b3b14fe0cc45ed |
| hovercard-subject-tag | pull_request:277479309 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/13221/files |
| twitter:image | https://avatars.githubusercontent.com/u/1240870?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1240870?s=400&v=4 |
| og:image:alt | The FileInput class (https://github.com/python/cpython/blob/master/Lib/fileinput.py) delegates to the open function, gzip, or bz2. Each of these delegates supports the 'rt' mode flag, so Fi... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width