New submission from André Anjos:

Apparently, "import site; site.main()" does not seem to work anymore on Python 
3.6 and superior.

The reason is a change on the behavior of "os.path.abspath(None)". Before 
Python 3.6, it used to report an AttributeError which is properly caught inside 
"site.abs_paths" (see: 
https://github.com/python/cpython/blob/master/Lib/site.py#L99), making it 
ignore __main__, one of sys.modules, which has __file__ and __cached__ set to 
None.

With Python 3.6 and superior, os.path.abspath(None) reports a TypeError, which 
makes calling "site.main()" raise an exception and stop.

How to reproduce: On python 3.6 or superior, do "import site; site.main()".

Expected behavior: Exception is properly caught and treated inside 
"site.abs_paths", ignoring modules in which __file__ and/or __cached__ are set 
to None.

----------
components: Library (Lib)
messages: 292325
nosy: anjos
priority: normal
severity: normal
status: open
title: site.main() does not work on Python 3.6 and superior
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30167>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to