[New-bugs-announce] [issue31802] 'import posixpath' fails if 'os.path' has not be imported already.

Mark Shannon report at bugs.python.org
Tue Oct 17 05:45:21 EDT 2017


New submission from Mark Shannon <mark at hotpy.org>:

$ python3.7 -S
>>> import posixpath
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "--/Lib/posixpath.py", line 13, in <module>
    import os
  File "--/Lib/os.py", line 92, in <module>
    from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
ImportError: cannot import name 'curdir' from 'posixpath' (--/Lib/posixpath.py)

Whether this counts as a bug or not is debatable. It could be argued that you shouldn't be importing 'posixpath' directly, in which case it ought to be called '_posixpath', but I guess it is too late to be changing the name.

----------
messages: 304494
nosy: Mark.Shannon
priority: normal
severity: normal
stage: needs patch
status: open
title: 'import posixpath' fails if 'os.path' has not be imported already.
type: crash

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31802>
_______________________________________


More information about the New-bugs-announce mailing list