Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'import posixpath' fails if 'os.path' has not be imported already. #75983

Closed
markshannon opened this issue Oct 17, 2017 · 3 comments
Closed

'import posixpath' fails if 'os.path' has not be imported already. #75983

markshannon opened this issue Oct 17, 2017 · 3 comments
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@markshannon
Copy link
Member

BPO 31802
Nosy @markshannon, @serhiy-storchaka
PRs
  • bpo-31802: Fix importing native path module before importing os. #4017
  • [3.6] bpo-31802: Fix importing native path module before importing os. (GH-4017) #5129
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2018-04-30.14:09:11.868>
    created_at = <Date 2017-10-17.09:45:21.322>
    labels = ['3.7', 'type-bug', 'library']
    title = "'import posixpath' fails if 'os.path' has not be imported already."
    updated_at = <Date 2018-04-30.14:09:11.867>
    user = 'https://github.com/markshannon'

    bugs.python.org fields:

    activity = <Date 2018-04-30.14:09:11.867>
    actor = 'Mark.Shannon'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2018-04-30.14:09:11.868>
    closer = 'Mark.Shannon'
    components = ['Library (Lib)']
    creation = <Date 2017-10-17.09:45:21.322>
    creator = 'Mark.Shannon'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31802
    keywords = ['patch']
    message_count = 3.0
    messages = ['304494', '309624', '309626']
    nosy_count = 2.0
    nosy_names = ['Mark.Shannon', 'serhiy.storchaka']
    pr_nums = ['4017', '5129']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31802'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7']

    @markshannon
    Copy link
    Member Author

    $ 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.

    @markshannon markshannon added the type-crash A hard crash of the interpreter, possibly with a core dump label Oct 17, 2017
    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir 3.7 (EOL) end of life labels Oct 17, 2017
    @serhiy-storchaka serhiy-storchaka self-assigned this Oct 17, 2017
    @serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels Oct 17, 2017
    @serhiy-storchaka
    Copy link
    Member

    New changeset 3460198 by Serhiy Storchaka in branch 'master':
    bpo-31802: Fix importing native path module before importing os. (bpo-4017)
    3460198

    @serhiy-storchaka
    Copy link
    Member

    New changeset 94a3fac by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6':
    bpo-31802: Fix importing native path module before importing os. (GH-4017) (bpo-5129)
    94a3fac

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants