[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-05-28 Thread Piotr Karkut


Piotr Karkut  added the comment:

Bump?

--

___
Python tracker 
<https://bugs.python.org/issue36053>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-07-24 Thread Piotr Karkut


Piotr Karkut  added the comment:

bump

--

___
Python tracker 
<https://bugs.python.org/issue36053>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.pah

2019-02-20 Thread Piotr Karkut

New submission from Piotr Karkut :

When walk_packages encounter a package with a name that is available in 
sys.path, it will abandon the current package, and start walking the package 
from the sys.path.

Consider this file layout:

```
PYTHONPATH/
├──package1/
|   ├──core   
|   |   ├──some_package/
|   |   |   ├──__init__.py
|   |   |   └──mod.py
|   |   └──__init__.py
|   └──__init__.py
└──some_package/
   |   ├──__init__.py
   |   └──another_mod.py
   └──__init__.py
```

The result of walking package1 will be:

```
>> pkgutil.walk_packages('PYTHONPATH/package1')

ModuleInfo(module_finder=FileFinder('PYTHONPATH/package1/core'), 
name='some_package', ispkg=True)
ModuleInfo(module_finder=FileFinder('PYTHONPATH/some_package), 
name='another_mod', ispkg=False)
```

I'm not sure if it is a security issue, but it definitely should not jump off 
the given path.

--
components: Library (Lib)
messages: 336111
nosy: karkucik
priority: normal
severity: normal
status: open
title: pkgutil.walk_packages jumps out from given path if there is package with 
the same name in sys.pah
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 
<https://bugs.python.org/issue36053>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-02-20 Thread Piotr Karkut


Change by Piotr Karkut :


--
title: pkgutil.walk_packages jumps out from given path if there is package with 
the same name in sys.pah -> pkgutil.walk_packages jumps out from given path if 
there is package with the same name in sys.path

___
Python tracker 
<https://bugs.python.org/issue36053>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-02-20 Thread Piotr Karkut


Change by Piotr Karkut :


--
keywords: +patch
pull_requests: +11982
stage:  -> patch review

___
Python tracker 
<https://bugs.python.org/issue36053>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-03-28 Thread Piotr Karkut


Piotr Karkut  added the comment:

Bump

--

___
Python tracker 
<https://bugs.python.org/issue36053>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-04-08 Thread Piotr Karkut


Piotr Karkut  added the comment:

Nick: From what I've checked, it jumps in case the module is already imported. 
The problem is that the original implementation is quite naive, and it's trying 
to import the module before looking for it in `sys.modules` - So if the module 
with a conflicting name is in PYTHONPATH and has higher priority, it'd be 
imported instead of the correct one. And then, as the module is imported, it'd 
be available in `sys.modules`.

--

___
Python tracker 
<https://bugs.python.org/issue36053>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com