New submission from Eric Cousineau <eric.cousineau@tri.global>:

We ran into an issue with our library; we build a submodule named `math.so`, 
and have a test `math_test` which is ran in the same directory as this module 
(since this is how we've written it with Bazel's generated Python binaries):
https://github.com/RobotLocomotion/drake/issues/8041

This happens for us on HighSierra / Sierra MacOS (for *.py and *.so modules); 
Ubuntu Linux seems fine.

I have a reproduction script just for *.py files here:
https://github.com/EricCousineau-TRI/repro/blob/b08bc47/bug/mac_builtin_shadow/test.sh#L38
(attached this as `test.sh`)

The module is exposed on the path given that it neighbors the first execution 
of the `import_test.py` script. The second execution (where the 
`import_test.py` script is moved up one level) succeeds on Mac (s.t. the 
`math.py` is not in `sys.path`).

This behavior seems to violate the documentation:
https://docs.python.org/2/tutorial/modules.html#the-module-search-path

----------
components: macOS
files: test.sh
messages: 312183
nosy: Eric Cousineau, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Mac: Local modules can shadow builtins (e.g. a local `math.py` can 
shadow `math`)
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file47442/test.sh

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

Reply via email to