[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2015-11-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: test needed -> resolved
status: pending -> closed

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2015-11-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Can this issue be closed?

--
nosy: +serhiy.storchaka
status: open -> pending

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-17 Thread Eli Bendersky

Eli Bendersky  added the comment:

Committed fixes to raise ImportError in both Python 3.2 and 3.3

At the moment no test added because I'm having trouble using 
import_fresh_module to avoid re-importing of pyexpat in the etree tests (it 
gets imported anyway).

--

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-17 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset d896fd0a8ba7 by Eli Bendersky in branch '3.2':
ISsue #14988: restore Python 2's behavior of raising ImportError when unable to 
load pyexpat, instead of a SystemError/RuntimeError
http://hg.python.org/cpython/rev/d896fd0a8ba7

New changeset c8774ff45733 by Eli Bendersky in branch 'default':
Merge for #14988
http://hg.python.org/cpython/rev/c8774ff45733

--
nosy: +python-dev

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-16 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

> Did it happen to raise ImportError historically and only recent
> changes made it RuntimeError? I'm not sure  this is the case.

ImportError was raised in Python 2.

--

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-16 Thread Eli Bendersky

Eli Bendersky  added the comment:

Benjamin, what "old behavior"? Did it happen to raise ImportError historically 
and only recent changes made it RuntimeError? I'm not sure  this is the case.

--

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-16 Thread Eli Bendersky

Eli Bendersky  added the comment:

I tried blocking the import of 'pyexpat' in a test by using 
test.support.import_fresh_module, placing 'pyexpat' into the blocked list, but 
it doesn't work (i.e. pyexpat, if it exists, is still imported)

--

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-15 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

IMHO, it can be fixed as people were relying on the old behavior.

--

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-15 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

IMHO wrong exception could be treated as a bug, which could be fixed in 3.2 and 
3.3.
Benjamin Peterson and Georg Brandl: What do you think?

> P.S. is there any way to create a test for it?

You can set sys.modules["pyexpat"]=None and test exception type when trying to 
import _elementtree.

--
nosy: +benjamin.peterson, georg.brandl

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-14 Thread Eli Bendersky

Eli Bendersky  added the comment:

I agree, but this will now be delayed to 3.4, since it's not a bug-fixing 
change in functionality.

P.S. is there any way to create a test for it?

--
assignee:  -> eli.bendersky
priority: normal -> low
type:  -> behavior
versions:  -Python 3.3

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-07 Thread Stephen Thorne

Stephen Thorne  added the comment:

With the attached patch, with python3.3(trunk) I instead get: 

./python.exe  -c 'import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1294, in _find_and_load
  File "", line 1261, in _find_and_load_unlocked
  File "", line 432, in _check_name_wrapper
  File "", line 347, in set_package_wrapper
  File "", line 360, in set_loader_wrapper
  File "", line 872, in load_module
ImportError: PyCapsule_Import could not import module "pyexpat"

(I have deleted pyexpat.so out of the build for the purposes of testing)

RuntimeError will continue to be raised in the case the version is wrong.

--
keywords: +patch
nosy: +jerub
Added file: http://bugs.python.org/file26310/elementtree_importerror.patch

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-07-05 Thread Eli Bendersky

Changes by Eli Bendersky :


--
components: +Library (Lib)
stage:  -> test needed
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-06-03 Thread Zac Medico

Changes by Zac Medico :


--
nosy: +zmedico

___
Python tracker 

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



[issue14988] _elementtree: Raise ImportError when importing of pyexpat fails

2012-06-03 Thread Arfrever Frehtes Taifersar Arahesis

New submission from Arfrever Frehtes Taifersar Arahesis 
:

If, after building of Python, libexpat.so (library used by pyexpat module) has 
been broken/removed or pyexpat module has been broken/removed, then attempt of 
import of _elementtree module, which requires pyexpat module, will raise 
strange exceptions in Python 3.

These exceptions can be simulated by setting sys.modules["pyexpat"] = None.

$ python2.6 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named pyexpat
$ python2.7 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
ImportError: PyCapsule_Import could not import module "pyexpat"
$ python3.1 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
SystemError: initialization of _elementtree raised unreported exception
$ python3.2 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
SystemError: initialization of _elementtree raised unreported exception
$ python3.3 -c 'import sys; sys.modules["pyexpat"] = None; import _elementtree'
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1286, in _find_and_load
  File "", line 1253, in _find_and_load_unlocked
  File "", line 432, in _check_name_wrapper
  File "", line 347, in set_package_wrapper
  File "", line 360, in set_loader_wrapper
  File "", line 870, in load_module
RuntimeError: cannot load dispatch table from pyexpat

I suggest to raise ImportError instead of SystemError or RuntimeError.
Third-party modules would rather use only 'except ImportError: pass' instead of 
'except (ImportError, SystemError, RuntimeError): pass' when trying to 
optionally use e.g. xml.etree.cElementTree.
xml.etree.ElementTree in Python 3.3 also ignores only ImportError when trying 
to import _elementtree.

--
messages: 162198
nosy: Arfrever, eli.bendersky, flox
priority: normal
severity: normal
status: open
title: _elementtree: Raise ImportError when importing of pyexpat fails
versions: Python 3.2, Python 3.3

___
Python tracker 

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