Title: Some os and os.path function signatures do not admit legal integer (file descriptor) arguments · Issue #1653 · python/typeshed · GitHub
Open Graph Title: Some os and os.path function signatures do not admit legal integer (file descriptor) arguments · Issue #1653 · python/typeshed
X Title: Some os and os.path function signatures do not admit legal integer (file descriptor) arguments · Issue #1653 · python/typeshed
Description: From the docs: 16.1.5. Files and Directories On some Unix platforms, many of these functions support one or more of these features: specifying a file descriptor: For some functions, the path argument can be not only a string giving a pat...
Open Graph Description: From the docs: 16.1.5. Files and Directories On some Unix platforms, many of these functions support one or more of these features: specifying a file descriptor: For some functions, the path argume...
X Description: From the docs: 16.1.5. Files and Directories On some Unix platforms, many of these functions support one or more of these features: specifying a file descriptor: For some functions, the path argume...
Opengraph URL: https://github.com/python/typeshed/issues/1653
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Some os and os.path function signatures do not admit legal integer (file descriptor) arguments","articleBody":"From the docs:\r\n\r\n>16.1.5. Files and Directories\r\n>On some Unix platforms, many of these functions support one or more of these features:\r\n>\r\n>specifying a file descriptor: For some functions, the path argument can be not only a string giving a path name, but also a file descriptor. The function will then operate on the file referred to by the descriptor. (For POSIX systems, Python will call the f... version of the function.)\r\n>\r\n>You can check whether or not path can be specified as a file descriptor on your platform using os.supports_fd. If it is unavailable, using it will raise a NotImplementedError.\r\n\r\nNot sure if we want to widen the types for all platforms, or try to special case just for Posix. Here is a list of offenders (via `suports_fd` on python3.7): chdir, chmod, chown, listdir, pathconf, scandir, stat, statvfs, truncate, utime.\r\n\r\nI also looked through os.path manually, and found one more: os.path.exists.\r\n\r\n\r\n### `os.chdir(path)`\r\n> Change the current working directory to path.\r\n> This function can support specifying a file descriptor. The descriptor must refer to an opened directory, not an open file.\r\n\r\ntypeshed: `def chdir(path: _PathType) -> None: ...`\r\n\r\n\r\n### `os.chmod(path, mode, *, dir_fd=None, follow_symlinks=True)`\r\n> New in version 3.3: Added support for specifying path as an open file descriptor, and the dir_fd and follow_symlinks arguments.\r\n\r\ntypeshed: `def chmod(path: _PathType, mode: int) -> None: ...`\r\n\r\n\r\n### `os.chown(path, uid, gid, *, dir_fd=None, follow_symlinks=True)`\r\n> New in version 3.3: Added support for specifying an open file descriptor for path, and the dir_fd and follow_symlinks arguments.\r\n\r\ntypeshed: `def chown(path: _PathType, uid: int, gid: int) -> None: ... # Unix only`\r\n\r\n\r\n### `os.listdir(path=’.’)`\r\n> New in version 3.3: Added support for specifying an open file descriptor for path.\r\n\r\ntypeshed:\r\n```\r\n@overload\r\ndef listdir(path: str = ...) -> List[str]: ...\r\n@overload\r\ndef listdir(path: bytes) -> List[bytes]: ...\r\n```\r\n\r\n\r\n### `os.pathconf(path, name)`\r\n> This function can support specifying a file descriptor.\r\n\r\ntypeshed: `def pathconf(path: _PathType, name: Union[str, int]) -> int: ... # Unix only`\r\n\r\n\r\n### `os.stat(path, *, dir_fd=None, follow_symlinks=True)`\r\n> New in version 3.3: Added the dir_fd and follow_symlinks arguments, specifying a file descriptor instead of a path.\r\n\r\ntypeshed: `def stat(path: _PathType) -> stat_result: ...`\r\n\r\n\r\n### `os.statvfs(path)`\r\n> New in version 3.3: Added support for specifying an open file descriptor for path.\r\n\r\ntypeshed: `def statvfs(path: _PathType) -> statvfs_result: ... # Unix only`\r\n\r\n\r\n### `os.truncate(path, length)`\r\n> This function can support specifying a file descriptor.\r\n\r\ntypeshed: `def truncate(path: Union[_PathType, int], length: int) -> None: ... # Unix only up to version 3.4`\r\n\r\n\r\n### `os.utime(path, times=None, *, [ns, ]dir_fd=None, follow_symlinks=True)`\r\n> New in version 3.3: Added support for specifying an open file descriptor for path, and the dir_fd, follow_symlinks, and ns parameters.\r\n\r\ntypeshed: `def utime(path: _PathType, times: Optional[Union[Tuple[int, int], Tuple[float, float]]] = ...,`\r\n\r\n\r\n### `os.path.exists(path)`\r\n> Return True if path refers to an existing path or an open file descriptor.\r\n\r\ntypeshed: `def exists(path: _PathType) -> bool: ...`\r\n\r\n\r\n","author":{"url":"https://github.com/gwk","@type":"Person","name":"gwk"},"datePublished":"2017-10-06T15:58:55Z","url":"https://github.com/python/typeshed/issues/1653"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:40aede01-f911-76ed-d546-d1fde3f47023 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C930:196792:2CCF388:3B4BFB6:6B002262 |
| html-safe-nonce | 6abb99bc6f1acc6ae007199288a39b3fa355fd69ba789ab817370a3e4f6212bd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTMwOjE5Njc5MjoyQ0NGMzg4OjNCNEJGQjY6NkIwMDIyNjIiLCJ2aXNpdG9yX2lkIjoiODQzNTU4NTIyMDIwNzQ1Mjc3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 25d596ea3c619805c93a76d003b72754f06519159d2598f65650ab402ecff0e5 |
| hovercard-subject-tag | issue:263494332 |
| 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/typeshed/1653/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0543c11477650519caadebbb40f07bd9ee75299a01e06d3feac6b8c24eb69b3e/python/typeshed/issues/1653 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0543c11477650519caadebbb40f07bd9ee75299a01e06d3feac6b8c24eb69b3e/python/typeshed/issues/1653 |
| og:image:alt | From the docs: 16.1.5. Files and Directories On some Unix platforms, many of these functions support one or more of these features: specifying a file descriptor: For some functions, the path argume... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gwk |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width