[issue26367] importlib.__import__ does not fail for invalid relative import

2017-07-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset c824cc8426a16dd9f3949a3ed135523d37787bae by Serhiy Storchaka in 
branch '3.5':
[3.5] Backport bpo-30876 (GH-2639), bpo-18018 and bpo-26367. (#2677)
https://github.com/python/cpython/commit/c824cc8426a16dd9f3949a3ed135523d37787bae


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-21 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for spotting those! And just to clarify on terminology, the typos were 
in the NEWS file, not "What's New" which is a different thing 
(https://hg.python.org/cpython/file/default/Doc/whatsnew).

--

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-21 Thread Manuel Jacob

Manuel Jacob added the comment:

I think the "What's New" entry has two typos.  It should be 
`importlib.__import__()` instead of `importlib.__init__()` and SystemError 
instead of RuntimeError.

--

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-20 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the patch, Manuel!

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e523efd47418 by Brett Cannon in branch '3.5':
Issue #26367: Have importlib.__init__() raise RuntimeError when
https://hg.python.org/cpython/rev/e523efd47418

New changeset 8f72bf88f471 by Brett Cannon in branch 'default':
Merge for issue #26367
https://hg.python.org/cpython/rev/8f72bf88f471

--
nosy: +python-dev

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Manuel, welcome to the tracker and thank you for submitting patches.  I agree 
that 5 lines is past the threshhold.  Your profile has been CLA-updated, so we 
are good to go.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-18 Thread Brett Cannon

Brett Cannon added the comment:

If a contribution is insignificant enough then technically a CLA isn't 
necessary, but I just make it a habit to ask for one regardless.

And your profile will probably get updated fairly quickly, so I wouldn't worry 
about it holding anything up (I'm hoping to commit the code tomorrow; I already 
did a review and it LGTM).

--

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-18 Thread Manuel Jacob

Manuel Jacob added the comment:

Done.  I'm a bit surprised this wasn't necessary for my previous two patches, 
but they were even more trival than this one. ;)

Do we have to wait until my tracker profile is updated?

--

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-18 Thread Brett Cannon

Brett Cannon added the comment:

The corresponding code in C that actually does the check: 
https://hg.python.org/cpython/file/default/Python/import.c#l1498

Manuel, can you sign the CLA at 
https://www.python.org/psf/contrib/contrib-form/ ? Once you sign it I can 
officially review your patch, otherwise I technically can't touch your code.

--
stage:  -> patch review

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-18 Thread Manuel Jacob

Manuel Jacob added the comment:

(For some reason, I forgot to submit the previous comment).

The attached patches fix the issue (one for the 3.5 branch, one for the default 
branch) by bringing importlib.__import__ closer to the builtin __import__.

The extra code in the default / 3.6 branch is because of the changes from 
issue18018.

--

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-17 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-16 Thread Manuel Jacob

Changes by Manuel Jacob :


Added file: http://bugs.python.org/file41938/relimport-3.6.patch

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-16 Thread Manuel Jacob

Changes by Manuel Jacob :


--
keywords: +patch
Added file: http://bugs.python.org/file41937/relimport-3.5.patch

___
Python tracker 

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



[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-15 Thread Manuel Jacob

New submission from Manuel Jacob:

Python 3.6.0a0 (default:6c6f7dff597b, Feb 16 2016, 01:24:51) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib
>>> importlib.__import__('array', globals(), locals(), level=1)

>>> __import__('array', globals(), locals(), level=1)
Traceback (most recent call last):
  File "", line 1, in 
ImportError: attempted relative import with no known parent package

Instead of failing, importlib.__import__ returns a module with a wrong name.  
This happens with both built-in modules and pure python modules.  However it 
fails when replacing 'array' with 'time' (this seems to be related to whether 
the module is in Modules/Setup.dist).

--
messages: 260338
nosy: brett.cannon, eric.snow, mjacob, ncoghlan
priority: normal
severity: normal
status: open
title: importlib.__import__ does not fail for invalid relative import
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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