classification
Title: 'import posixpath' fails if 'os.path' has not be imported already.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Mark.Shannon, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-10-17 09:45 by Mark.Shannon, last changed 2018-04-30 14:09 by Mark.Shannon. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4017 merged serhiy.storchaka, 2017-10-17 11:54
PR 5129 merged python-dev, 2018-01-07 15:55
Messages (3)
msg304494 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2017-10-17 09:45
$ 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.
msg309624 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-01-07 15:54
New changeset 3460198f6ba40a839f105c381f07179aba1e8c61 by Serhiy Storchaka in branch 'master':
bpo-31802: Fix importing native path module before importing os. (#4017)
https://github.com/python/cpython/commit/3460198f6ba40a839f105c381f07179aba1e8c61
msg309626 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-01-07 16:35
New changeset 94a3facc0e5ce02ef34d9fa595703cd96cb95984 by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6':
bpo-31802: Fix importing native path module before importing os. (GH-4017) (#5129)
https://github.com/python/cpython/commit/94a3facc0e5ce02ef34d9fa595703cd96cb95984
History
Date User Action Args
2018-04-30 14:09:11Mark.Shannonsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-01-07 16:35:30serhiy.storchakasetmessages: + msg309626
2018-01-07 15:55:41python-devsetpull_requests: + pull_request4990
2018-01-07 15:54:36serhiy.storchakasetmessages: + msg309624
2017-10-17 11:54:28serhiy.storchakasetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request3991
2017-10-17 10:46:12serhiy.storchakasetversions: + Python 2.7, Python 3.6, Python 3.7
nosy: + serhiy.storchaka

assignee: serhiy.storchaka
components: + Library (Lib)
type: crash -> behavior
2017-10-17 09:45:21Mark.Shannoncreate