Created on 2019-02-08 16:34 by lukasz.langa, last changed 2019-02-19 12:16 by miss-islington. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11831 | merged | pablogsal, 2019-02-12 22:40 | |
| PR 11912 | merged | miss-islington, 2019-02-18 10:46 | |
| PR 11934 | merged | serhiy.storchaka, 2019-02-19 11:23 | |
| PR 11932 | merged | serhiy.storchaka, 2019-02-19 11:50 | |
| PR 11937 | merged | miss-islington, 2019-02-19 11:55 | |
| Messages (6) | |||
|---|---|---|---|
| msg335094 - (view) | Author: Ćukasz Langa (lukasz.langa) * | Date: 2019-02-08 16:34 | |
>>> class K: ... def __fspath__(self): ... return 1 ... >>> import os >>> os.stat(K()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: stat: path should be string, bytes, os.PathLike or integer, not int This error message is internally inconsistent: - it suggests that the error is about the path argument whereas it's in fact about the value returned from `__fspath__()` - it hilariously states "should be integer, not int" - it claims os.PathLike is fine as a return value from `__fspath__()` whereas it's not I would advise removing the custom `__fspath__()` handling from `path_converter` and just directly using PyOS_FSPath which returns a valid error in this case (example from pypy3): >>>> class K: .... def __fspath__(self): .... return 1 .... >>>> import os >>>> os.open(K(), os.O_RDONLY) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: expected K.__fspath__() to return str or bytes, not int |
|||
| msg335756 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-02-17 06:39 | |
The custom `__fspath__()` handling is used in `path_converter` for better error reporting. The error message can include names of the function and the argument. PyOS_FSPath() can not provides this information. I agree that error reporting about incorrect type of the __fspath__() result should be improved. |
|||
| msg335804 - (view) | Author: Pablo Galindo Salgado (pablogsal) * | Date: 2019-02-18 10:46 | |
New changeset 09fbcd6085e18b534fd4161844ff39f77eb4a082 by Pablo Galindo in branch 'master': bpo-35942: Improve the error message if __fspath__ returns invalid types in path_converter (GH-11831) https://github.com/python/cpython/commit/09fbcd6085e18b534fd4161844ff39f77eb4a082 |
|||
| msg335809 - (view) | Author: miss-islington (miss-islington) | Date: 2019-02-18 11:05 | |
New changeset a01065a3588d3f0d0c57ea35107aa97e722fe2b2 by Miss Islington (bot) in branch '3.7': bpo-35942: Improve the error message if __fspath__ returns invalid types in path_converter (GH-11831) https://github.com/python/cpython/commit/a01065a3588d3f0d0c57ea35107aa97e722fe2b2 |
|||
| msg335935 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-02-19 11:52 | |
New changeset 8d01eb49fc7ff914feeb2e2090d1d6ef15c932ab by Serhiy Storchaka in branch 'master': Fix syntax warnings in tests introduced in bpo-35942. (GH-11934) https://github.com/python/cpython/commit/8d01eb49fc7ff914feeb2e2090d1d6ef15c932ab |
|||
| msg335939 - (view) | Author: miss-islington (miss-islington) | Date: 2019-02-19 12:16 | |
New changeset a8834905df853510f38d4e2d628bed8229fd7482 by Miss Islington (bot) in branch '3.7': Fix syntax warnings in tests introduced in bpo-35942. (GH-11934) https://github.com/python/cpython/commit/a8834905df853510f38d4e2d628bed8229fd7482 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-02-19 12:16:41 | miss-islington | set | messages: + msg335939 |
| 2019-02-19 11:55:22 | miss-islington | set | pull_requests: + pull_request11962 |
| 2019-02-19 11:52:37 | serhiy.storchaka | set | messages: + msg335935 |
| 2019-02-19 11:50:38 | serhiy.storchaka | set | pull_requests: + pull_request11961 |
| 2019-02-19 11:24:56 | serhiy.storchaka | set | pull_requests: - pull_request11956 |
| 2019-02-19 11:23:24 | serhiy.storchaka | set | pull_requests: + pull_request11958 |
| 2019-02-19 11:08:26 | serhiy.storchaka | set | pull_requests: + pull_request11956 |
| 2019-02-18 11:38:39 | pablogsal | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-02-18 11:05:55 | miss-islington | set | nosy:
+ miss-islington messages: + msg335809 |
| 2019-02-18 10:46:48 | miss-islington | set | pull_requests: + pull_request11938 |
| 2019-02-18 10:46:48 | pablogsal | set | nosy:
+ pablogsal messages: + msg335804 |
| 2019-02-17 06:39:18 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg335756 |
| 2019-02-12 22:40:57 | pablogsal | set | keywords:
+ patch stage: needs patch -> patch review pull_requests: + pull_request11862 |
| 2019-02-08 16:34:39 | lukasz.langa | create | |