[issue42872] Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes
Hong Xu added the comment: Should we update the document at least? The document doesn't mention NotADirectoryError or its super classes at all. -- ___ Python tracker <https://bugs.python.org/issue42872> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42872] Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes
Change by Hong Xu : -- title: Inconsistent exceptions thrown by mkdir on different OSes -> Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes ___ Python tracker <https://bugs.python.org/issue42872> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42872] Inconsistent exceptions thrown by mkdir on different OSes
Change by Hong Xu : -- title: Inconsistent exception thrown by mkdir on different OSes -> Inconsistent exceptions thrown by mkdir on different OSes ___ Python tracker <https://bugs.python.org/issue42872> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42872] Inconsistent exception thrown by mkdir on different OSes
New submission from Hong Xu : Consider the following code: - import pathlib def main(): pathlib.Path('tmp').touch() pathlib.Path('tmp/tmp_sub').mkdir(parents=True) main() Run the code above in an empty directory. On Linux, it throws a `NotADirectory` exception: Traceback (most recent call last): File "", line 1, in File "main.py", line 5, in main pathlib.Path('tmp/tmp_sub').mkdir(parents=True) File "/usr/lib/python3.8/pathlib.py", line 1287, in mkdir self._accessor.mkdir(self, mode) NotADirectoryError: [Errno 20] Not a directory: 'tmp/tmp_sub' - On Windows, it throws a FileExistsError exception: Traceback (most recent call last): File "C:\Users\hong\anaconda3\lib\pathlib.py", line 1284, in mkdir self._accessor.mkdir(self, mode) FileNotFoundError: [WinError 3] The system cannot find the path specified: 'tmp\\tmp_sub' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "main.py", line 7, in main() File "main.py", line 5, in main pathlib.Path('tmp/tmp_sub').mkdir(parents=True) File "C:\Users\hong\anaconda3\lib\pathlib.py", line 1288, in mkdir self.parent.mkdir(parents=True, exist_ok=True) File "C:\Users\hong\anaconda3\lib\pathlib.py", line 1284, in mkdir self._accessor.mkdir(self, mode) FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'tmp -- components: Library (Lib), Windows messages: 384715 nosy: Hong Xu, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Inconsistent exception thrown by mkdir on different OSes versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue42872> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24935] LDSHARED is not set according when CC is set.
Change by Hong Xu : -- pull_requests: +14719 pull_request: https://github.com/python/cpython/pull/14950 ___ Python tracker <https://bugs.python.org/issue24935> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37225] Signatures of Exceptions not documented
Hong Xu added the comment: Thanks for your answer, but I believe this is a real document bug. OSError does have its signature documented, but the majority of other exception classes do not do so, neither does BaseException explains a default behavior clearly (see my quote above). As an example, ValueError accepts multiple arguments and makes use of all of them when given, but from the document, I can barely guess this out. -- ___ Python tracker <https://bugs.python.org/issue37225> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37225] Signatures of Exceptions not documented
New submission from Hong Xu : The "Builtin Exceptions" page does not document the constructors of the listed exception classes. All it says is > The tuple of arguments given to the exception constructor. Some built-in > exceptions (like OSError) expect a certain number of arguments and assign a > special meaning to the elements of this tuple, while others are usually > called only with a single string giving an error message. This is quite vague and does not really guide users for individual exception classes. -- assignee: docs@python components: Documentation messages: 345195 nosy: Hong Xu, docs@python priority: normal severity: normal status: open title: Signatures of Exceptions not documented versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue37225> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com