bpo-31802: Fix importing native path module before importing os. (#4017)

This commit is contained in:
Serhiy Storchaka 2018-01-07 17:54:31 +02:00 committed by GitHub
parent e46a8af450
commit 3460198f6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 32 deletions

View file

@ -10,6 +10,18 @@ Some of this can actually be useful on non-Posix systems too, e.g.
for manipulation of the pathname component of URLs.
"""
# Strings representing various path-related bits and pieces.
# These are primarily for export; internally, they are hardcoded.
# Should be set before imports for resolving cyclic dependency.
curdir = '.'
pardir = '..'
extsep = '.'
sep = '/'
pathsep = ':'
defpath = ':/bin:/usr/bin'
altsep = None
devnull = '/dev/null'
import os
import sys
import stat
@ -25,16 +37,6 @@ __all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"devnull","realpath","supports_unicode_filenames","relpath",
"commonpath"]
# Strings representing various path-related bits and pieces.
# These are primarily for export; internally, they are hardcoded.
curdir = '.'
pardir = '..'
extsep = '.'
sep = '/'
pathsep = ':'
defpath = ':/bin:/usr/bin'
altsep = None
devnull = '/dev/null'
def _get_sep(path):
if isinstance(path, bytes):