[issue14078] Add 'sourceline' property to xml.etree Elements

2012-06-08 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


--
resolution:  - wont fix
stage: patch review - committed/rejected
status: open - closed

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



[issue14078] Add 'sourceline' property to xml.etree Elements

2012-05-28 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Hi Leon,
Do you have an interest in pursuing this issue?

--

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



[issue14078] Add 'sourceline' property to xml.etree Elements

2012-03-22 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
keywords: +needs review
stage:  - patch review
type:  - enhancement

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



[issue14078] Add 'sourceline' property to xml.etree Elements

2012-03-22 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Hi Leon,
Thanks for the patch.

I suggest to start by raising this to the python-ideas mailing list, to see if 
anyone has objections / different idea about doing this.

Next, keep in mind that starting with 3.3, the default ElementTree 
implementation comes from the C accelerator Modules/_elementtree.c, and 
compatibility between the Python and C implementations becomes important. 
Therefore, each such change has to be added to both implementations. Is your 
patch done in a common section, or just the Python implementation?

--

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



[issue14078] Add 'sourceline' property to xml.etree Elements

2012-03-21 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +eli.bendersky

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



[issue14078] Add 'sourceline' property to xml.etree Elements

2012-02-21 Thread Leon Matthews

New submission from Leon Matthews l...@lost.co.nz:

The lxml implementation of the ElementTree API puts a `sourceline` property 
onto every Element object, which I recently found useful when producing 
diagnostic messages.  I think it would be a useful improvement to make the 
standard library's ElementTree implementation.

The attached patch works by copying the current line number from the Expat 
parser into the Element object after the Element object is created (so as to 
minimise its intrusiveness for now).

The patch is just a proof of concept, and although all tests pass, the patch 
currently smells a little hacky and fragile to me.  Hopefully though, it will 
start a discussion with somebody more experienced.

PS. So as not to create a hard dependency on lxml.etree, in my project I worked 
around the issue as follows.  While this works in my case, the standard library 
seems a more logical place for this change::

class XMLParserWithLines(XMLParser):

Add a `sourceline` attribute to element, like lxml.etree

def _start_list(self, *args, **kwargs):
element = super(self.__class__, self)._start_list(*args, **kwargs)
element.sourceline = self._parser.CurrentLineNumber
return element


 tree = ElementTree()
 tree.parse(path, parser=XMLParserWithLines())
 ...

--
components: Library (Lib)
files: elementtree-sourceline.diff
keywords: patch
messages: 153907
nosy: leonov
priority: normal
severity: normal
status: open
title: Add 'sourceline' property to xml.etree Elements
versions: Python 3.3
Added file: http://bugs.python.org/file24594/elementtree-sourceline.diff

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