[issue18997] Crash when using pickle and ElementTree
New submission from Germán M. Bravo: On the tip of 3.3, I've found `Element.__getstate__` doesn't work and neither as `pickle.dumps(Element)` under certain circumstances. This crashes: e1 = ElementTree().parse('houses.xml') e1.__getstate__() This doesn't crash: e2 = ElementTree().parse('houses.xml') e2.text = 'some' e2.__getstate__() But still, both of these crash: pickle.dumps(e1) pickle.dumps(e2) -- components: Extension Modules files: houses.xml messages: 197440 nosy: Kronuz, eli.bendersky, scoder priority: normal severity: normal status: open title: Crash when using pickle and ElementTree versions: Python 3.3 Added file: http://bugs.python.org/file31719/houses.xml ___ Python tracker <http://bugs.python.org/issue18997> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18998] iter() not working in ElementTree
New submission from Germán M. Bravo: The added iter/itertext methods in Element are not working under certain circumstances (crashes): This crashes: e = ElementTree().parse('/Users/kronuz/Desktop/tests/houses.xml') e.iter() But the problem is not there if I use bootstrapped iterators instead (from the previous commit to the one introducing Element iterator) -- components: Extension Modules files: houses.xml messages: 197441 nosy: Kronuz, eli.bendersky, scoder priority: normal severity: normal status: open title: iter() not working in ElementTree type: crash versions: Python 3.3 Added file: http://bugs.python.org/file31720/houses.xml ___ Python tracker <http://bugs.python.org/issue18998> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18997] Crash when using pickle and ElementTree
Germán M. Bravo added the comment: The attached patch fixes the problem (there were some missing JOIN_OBJ()) -- keywords: +patch Added file: http://bugs.python.org/file31723/join_obj.diff ___ Python tracker <http://bugs.python.org/issue18997> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18998] iter() not working in ElementTree
Germán M. Bravo added the comment: It crashes when I run that code snippet I posted (using the attached xml file) The problem was introduced by the commit that added iterator support. -- ___ Python tracker <http://bugs.python.org/issue18998> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18997] Crash when using pickle and ElementTree
Changes by Germán M. Bravo : Removed file: http://bugs.python.org/file31723/join_obj.diff ___ Python tracker <http://bugs.python.org/issue18997> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18997] Crash when using pickle and ElementTree
Changes by Germán M. Bravo : Added file: http://bugs.python.org/file31725/join_obj.diff ___ Python tracker <http://bugs.python.org/issue18997> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17155] Logging throwing UnicodeEncodeError exception
New submission from Germán M. Bravo: I've seen *a lot* of people using `logging.exception(exc)` to log exceptions. It all seems okay, until the exc object contains unicode strings, at which point logging throes a UnicodeEncodeError exception. Example: `exc = Exception(u'operaci\xf3n'); logger.error(exc)` throws an exception, while `exc = Exception(u'operaci\xf3n'); logger.error(u"%s", exc)` does not and works as expected. The problem for this is in the `_fmt` string in logging being `"%(message)s"`, not `u"%(message)s"`, which ends up getting the string (non-unicode) version of the exception object (returned by `getMessage()`) and failing to apply the formatting since the exception contains unicode. A solution would be to make the default formatting string a unicode string so the object returned by `getMessage()` (the exception) is converted to unicode by making all formatting strings for logging unicode strings: (could be done for example by changing to `unicode(self._fmt) % record.__dict__` the line logging/__init__.py:467). Other solution could be to encourage users not to use objects as the first argument to the logging methods, and perhaps even log a warning against it if it's done. -- assignee: docs@python components: Documentation, Unicode messages: 181640 nosy: Kronuz, docs@python, ezio.melotti priority: normal severity: normal status: open title: Logging throwing UnicodeEncodeError exception versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue17155> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com