On 11/7/22, Eryk Sun <eryk...@gmail.com> wrote: > > def isjunction(path): > """Test whether a path is a junction. > """ > try: > st = os.lstat(path) > except (OSError, ValueError, AttributeError): > return False > return bool(st.st_reparse_tag & stat.IO_REPARSE_TAG_MOUNT_POINT)
The bitwise AND check in the above is wrong. It should check whether the tag *equals* IO_REPARSE_TAG_MOUNT_POINT. Sorry, this was an editing mistake when I simplified the expression to remove a redundant check of st_file_attributes. This idea is being developed for Python 3.12: https://github.com/python/cpython/issues/99547 https://github.com/python/cpython/pull/99548 _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/GEUZJE2Q2ACFGSMPHWPO5437CXRRNAZ3/ Code of Conduct: http://python.org/psf/codeofconduct/