This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix for #1513611 and #1511497; xml.sax imports
Type: Stage:
Components: XML Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: fdrake Nosy List: fdrake, loewis, zseil
Priority: normal Keywords: patch

Created on 2006-07-10 07:32 by zseil, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sax_relative_imports.diff zseil, 2006-07-10 07:32 patch against trunk revision 50508
test_xml_importing.py zseil, 2006-07-10 07:32 unittests
sax_relative_imports_updated.diff zseil, 2006-07-10 07:59
test_xml_importing_updated.py zseil, 2006-07-10 08:00 updated unittests
sax-test-cases.diff fdrake, 2006-07-27 03:17 unit tests that exercise both issues
Messages (5)
msg50640 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-07-10 07:32
Package xmlcore.sax currently uses a mix of realtive
and absolute imports. This caused the following bugs:
http://python.org/sf/1513611
http://python.org/sf/1511497

This patch fixes it, by using relative imports.
I tried using absolute imports, but then some of
the tests in the attached test_xml_importing
module fail.

The tests are separate because I don't know how
to include setUp() and tearDown() methods into
non unittest based tests.
msg50641 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-07-10 07:59
Logged In: YES 
user_id=1326842

Attaching a new patch and updated tests, since I missed
that make_parser() uses __import__().
msg50642 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-07-10 21:03
Logged In: YES 
user_id=21627

Assigning to Fred Drake, who introduced xmlcore.
msg50643 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2006-07-27 03:17
Logged In: YES 
user_id=3066

These tests do not trigger any failures for me with the
current trunk, so I'm not sure what the patch is fixing.

I'm attaching a patch that includes tests cases for both of
the issues reportedly fixed by this patch.
msg50644 - (view) Author: Ziga Seilnacht (zseil) * (Python committer) Date: 2006-07-27 12:48
Logged In: YES 
user_id=1326842

The patch is extremely fragile and works only if you don't
mix objects from xml and xmlcore. As your test shows, it
breaks if you import 'make_parser' and 'SAXParseException'
from different packages.

As for the tests, the first four fail for me if I run them
as a script. They are not integrated into the test suite
since they are missing a test_main() function.

It seems that renaming xmlcore back to xml is the simplest
solution, so I'll just close this patch.
History
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43642
2006-07-10 07:32:09zseilcreate