Title: Import genericpath fails with python -S
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, brittanyrey, pitrou, serhiy.storchaka
Priority: normal Keywords:

Created on 2019-12-06 21:42 by brittanyrey, last changed 2019-12-09 19:48 by serhiy.storchaka. This issue is now closed.

Messages (3)
msg357947 - (view) Author: Brittany Reynoso (brittanyrey) * Date: 2019-12-06 21:42
When running python -S, attempting to run "import genericpath" fails with an attribute error due to a circular dependency between posixpath and genericpath that's triggered when "import os" is called from within 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/fbcode/platform007/lib/python3.7/", line 6, in <module>
    import os
  File "/usr/local/fbcode/platform007/lib/python3.7/", line 57, in <module>
    import posixpath as path
  File "/usr/local/fbcode/platform007/lib/python3.7/", line 130, in <module>
    splitext.__doc__ = genericpath._splitext.__doc__
AttributeError: module 'genericpath' has no attribute '_splitext'
msg358126 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2019-12-09 18:50
Thanks for the report, Brittany, but I'm closing as "won't fix" as the only way to make this happen is to import genericpath directly which one shouldn't do (it's undocumented on purpose); always get a hold of this module via 'os'.
msg358136 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-12-09 19:48
See also issue31802. I skipped genericpath because I did not expect that somebody can import it directly (unlike to posixpath, ntpath and macpath). genericpath is an internal module, it is not even documented.
Date User Action Args
2019-12-09 19:48:54serhiy.storchakasetstatus: open -> closed
stage: resolved
2019-12-09 19:48:04serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg358136
2019-12-09 18:50:54brett.cannonsetresolution: wont fix
messages: + msg358126
2019-12-07 03:11:26xtreaksetnosy: + brett.cannon, pitrou
2019-12-06 21:42:19brittanyreycreate