[issue15576] importlib: ExtensionFileLoader not used to load packages from __init__.so files

2012-08-10 Thread Stefan Behnel
Stefan Behnel added the comment: I understand that this is not trivial to test as part of the regression test suite. However, when I try it now I get this: Traceback (most recent call last): File "", line 1, in File "__init__.py", line 8, in init my_test_package (my_t

[issue15576] importlib: ExtensionFileLoader not used to load packages from __init__.so files

2012-08-11 Thread Stefan Behnel
Stefan Behnel added the comment: Hmm, yes, sounds more like a separate issue than something to add to this ticket. It worked before (starting with Py2.5, which was the first Python version to support relative imports) and only stopped working in 3.3 now. The .srctree test file basically just

[issue15623] Init time relative imports no longer work from __init__.so modules

2012-08-11 Thread Stefan Behnel
New submission from Stefan Behnel: Since CPython 2.5, relative imports could be used from __init__.so package modules. This stopped working in CPython 3.3. This is a follow-up ticket to issue15576. This feature is exercised by Cython's initial_file_path test, which now gives this r

[issue15576] importlib: ExtensionFileLoader not used to load packages from __init__.so files

2012-08-11 Thread Stefan Behnel
Stefan Behnel added the comment: I've created issue15623, so that we can keep this one as fixed. -- resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.

[issue15623] Init time relative imports no longer work from __init__.so modules

2012-08-11 Thread Stefan Behnel
Stefan Behnel added the comment: We are continuously testing Cython against all CPython versions starting from 2.4, so I can assure you that it's still working for all other versions. Here's our CI server: https://sage.math.washington.edu:8091/hudson/job/cython-devel-tests/618/ I

[issue15623] Init time relative imports no longer work from __init__.so modules

2012-08-12 Thread Stefan Behnel
Stefan Behnel added the comment: That's the module init code, yes, including the setting of __file__ and __path__ that I mentioned (due to issue13429). Setting at least one of the two is required in previous CPython versions to make relative imports

[issue15623] Init time relative imports no longer work from __init__.so modules

2012-08-13 Thread Stefan Behnel
Stefan Behnel added the comment: Interesting. I didn't know that. The .py file is always installed automatically next to the .so file by distutils. Here's what strace gives me: Python 2.7: stat("my_test_package", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0 stat("

[issue15623] Init time relative imports no longer work from __init__.so modules

2012-08-14 Thread Stefan Behnel
Stefan Behnel added the comment: I tried it and it works to just insert the package module into sys.modules after creation if it's not there yet: #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("my_test_package"), __pyx_methods, 0, 0, PYTHON_API_VERSION);

[issue15814] memoryview: equality-hash invariant

2012-08-30 Thread Stefan Behnel
Stefan Behnel added the comment: To add on Dag's comments, this essentially means that any caching of the hash value is dangerous, unless it can be assured that the underlying buffer definitely has not changed in the meantime. There is no way for users to explicitly tell a memoryvi

[issue15827] Use "ll" for PY_FORMAT_SIZE_T on Win64

2012-08-30 Thread Stefan Behnel
New submission from Stefan Behnel: Formatting support for "lld"/"llu" was added (I think) in issue 7228, but the definition of PY_FORMAT_SIZE_T wasn't adapted. We are getting test output failures in Cython on Win64 when formatting error messages using the "Id&qu

[issue15827] Use "ll" for PY_FORMAT_SIZE_T on Win64

2012-08-30 Thread Stefan Behnel
Stefan Behnel added the comment: I just saw that we were misusing PY_FORMAT_SIZE_T according to the documentation (reading that sometimes helps...). It is not supposed to be used with the Python formatting functions, only with low-level functions. Closing, sorry for the noise

[issue15814] memoryview: equality-hash invariant

2012-09-03 Thread Stefan Behnel
Changes by Stefan Behnel : -- nosy: -scoder ___ Python tracker <http://bugs.python.org/issue15814> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue20928] xml.etree.ElementInclude does not include nested xincludes

2014-03-15 Thread Stefan Behnel
Stefan Behnel added the comment: Agreed that this should be done. The XInclude spec suggests that the processing is transitive. Also, lxml does it that way, in both the libxml2 based implementation and the ElementInclude compatibility module. https://github.com/lxml/lxml/blob/master/src/lxml

[issue21028] ElementTree objects should support all the same methods as Element objects

2014-03-23 Thread Stefan Behnel
Stefan Behnel added the comment: catalog = xml.etree.ElementTree.parse('books.xml') # This succeeds for book in catalog.findall('book'): print(book.tag) This is a bit of a convenience break in the API. The "normal" way to do it would be either c

[issue20375] ElementTree: Document handling processing instructions

2014-03-25 Thread Stefan Behnel
Stefan Behnel added the comment: I think you attached the wrong file. -- ___ Python tracker <http://bugs.python.org/issue20375> ___ ___ Python-bugs-list mailin

[issue21028] ElementTree objects should support all the same methods as Element objects

2014-04-01 Thread Stefan Behnel
Stefan Behnel added the comment: > Add all the element methods to the elementtree object. Ok, but why? An ElementTree object *is not* an Element. It's a representation of a document that *has* a root Element. It makes sense for a document to allow searches over its content, and the Ele

[issue21028] ElementTree objects should support all the same methods as Element objects

2014-04-02 Thread Stefan Behnel
Stefan Behnel added the comment: > I don't see any benefit from having this code fail: > > from xml.etree.ElementTree import parse > > catalog = parse('books.xml') > for book in catalog: > print book.get('id') Why would you

[issue21028] ElementTree objects should support all the same methods as Element objects

2014-04-02 Thread Stefan Behnel
Stefan Behnel added the comment: > How about just making a sensibly-behaving __iter__ for ElementTree? Well, the problem is to determine what "sensibly-behaving" is. I can see three options. 1) tree.iter() == tree.getroot().iter() 2) iter(tree.getroot()) 3) iter([tree.get

[issue17088] ElementTree incorrectly refuses to write attributes without namespaces when default_namespace is used

2014-04-13 Thread Stefan Behnel
Stefan Behnel added the comment: @gene_wood: that's unrelated. This ticket is about attributes being rejected incorrectly. Fixing the example of the OP: >>> from xml.etree.ElementTree import * >>> svg = ElementTree(XML(""" ... htt

[issue18304] ElementTree -- provide a way to ignore namespace in tags and seaches

2014-04-17 Thread Stefan Behnel
Stefan Behnel added the comment: You can already use iterparse for this. it = ET.iterparse('somefile.xml') for _, el in it: el.tag = el.tag.split('}', 1)[1] # strip all namespaces root = it.root As I said, this would be a little friendlier with suppor

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-04-30 Thread Stefan Behnel
Stefan Behnel added the comment: Works for me in 3.2 and 3.4, fails in 2.7, as reported. I'll leave it to Eli to decide if this should get fixed in 2.7. In Py2, ET and cET were different modules, so this could also be considered a missing feature in cET. Given that it leads to a serialis

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-04-30 Thread Stefan Behnel
Stefan Behnel added the comment: Ah, sorry, actually, it does not work in Py3.2: >>> import xml.etree.cElementTree as cET >>> root = cET.Element('root', attrib={'Name':'Root'}) >>> child = cET.SubElement(root, 'child', attrib={

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-04-30 Thread Stefan Behnel
Stefan Behnel added the comment: According to issue 1572710, this is not a bug. The "attrib" argument is supposed to be a positional argument, not a keyword argument. This makes sense, given that arbitrary keyword arguments are accepted for additional XML

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-05-01 Thread Stefan Behnel
Stefan Behnel added the comment: Note that this has been fixed in Py3 already (Py3.3, I guess). The only question is whether the behaviour will be changed in Py2.7. -- components: -XML ___ Python tracker <http://bugs.python.org/issue21

[issue21420] Optimize 2 ** n: implement it as 1 << n

2014-05-03 Thread Stefan Behnel
Stefan Behnel added the comment: LGTM, can't see a case where this might go wrong (errors and type checks are handled before the added code). It also seems a sufficiently common case to optimise it internally. The 2**n spelling is easier to read and to get right than the shifting, so

[issue19655] Replace the ASDL parser carried with CPython

2014-05-10 Thread Stefan Behnel
Stefan Behnel added the comment: The "avoid rebuilding" part doesn't seem to work for me. Source build currently fails as follows: """ /bin/mkdir -p Include python ./Parser/asdl_c.py -h Include ./Parser/Python.asdl # Substitution happens here, as the compl

[issue19655] Replace the ASDL parser carried with CPython

2014-05-10 Thread Stefan Behnel
Stefan Behnel added the comment: That fixes it. Thanks! -- ___ Python tracker <http://bugs.python.org/issue19655> ___ ___ Python-bugs-list mailing list Unsub

[issue21592] Make statistics.median run in linear time

2014-06-01 Thread Stefan Behnel
Stefan Behnel added the comment: I tried the same with a Cython compiled version of select.py in the latest CPython 3.5 build. It pretty clearly shows that select2 is pretty much always faster than sorting, by a factor of 2-5x or so. I'll also attach the annotated source file that C

[issue21592] Make statistics.median run in linear time

2014-06-01 Thread Stefan Behnel
Changes by Stefan Behnel : Added file: http://bugs.python.org/file35427/select.html ___ Python tracker <http://bugs.python.org/issue21592> ___ ___ Python-bugs-list mailin

[issue21592] Make statistics.median run in linear time

2014-06-01 Thread Stefan Behnel
Stefan Behnel added the comment: Here's also the pathological "average of three calls" case. As Steven suggests, it shows that select() suffers quite heavily (algorithmically), but select2() also suffers enough to jump up to about 2/3 of the runtime of sorting (so it's s

[issue21592] Make statistics.median run in linear time

2014-06-01 Thread Stefan Behnel
Stefan Behnel added the comment: Updating the type declaration file to remove the dependency on the list builtin and allow arbitrary containers. The test code has this dependency (calls a.sort()), but the current statistics module in the stdlib does not (calls sorted()). Timings do not change

[issue21592] Make statistics.median run in linear time

2014-06-01 Thread Stefan Behnel
Changes by Stefan Behnel : Added file: http://bugs.python.org/file35430/select.html ___ Python tracker <http://bugs.python.org/issue21592> ___ ___ Python-bugs-list mailin

[issue16392] frozen importlib crashes on circular imports in ext modules

2012-11-03 Thread Stefan Behnel
New submission from Stefan Behnel: After compiling the stdlib with Cython with the attached script, modules that use circular imports fail to initialise. That includes os and posixpath, as well as shutil and tarfile. Example: $ ./python -c 'import shutil' Traceback (most recent

[issue16393] typo in pkgutil.py

2012-11-03 Thread Stefan Behnel
New submission from Stefan Behnel: My guess is that line 454 in pkgutil.py should pass "pkg_name" into the import_module() function, not "pkg". I get the following error when compiling it with Cython: Error c

[issue16392] frozen importlib crashes on circular imports in ext modules

2012-11-03 Thread Stefan Behnel
Stefan Behnel added the comment: Well, it's not like the setup was all that difficult. 1) Install the latest github master of Cython (they provide one-click archives that pip can install for you), 2) change into the CPython stdlib directory and run the script I attached, 3) execute "

[issue16392] frozen importlib crashes on circular imports in ext modules

2012-11-03 Thread Stefan Behnel
Changes by Stefan Behnel : Added file: http://bugs.python.org/file27865/cystdlibbug.py ___ Python tracker <http://bugs.python.org/issue16392> ___ ___ Python-bugs-list m

[issue16392] import crashes on circular imports in ext modules

2012-11-03 Thread Stefan Behnel
Stefan Behnel added the comment: Since it's quite possible that this has nothing to do with the frozen part of the importlib specifically, I'm removing that bit from the ticket title. -- title: frozen importlib crashes on circular imports in ext modules -> import crashe

[issue16392] import crashes on circular imports in ext modules

2012-11-03 Thread Stefan Behnel
Stefan Behnel added the comment: Hmm, we already do that for packages (i.e. when compiling __init__.py). Looks like this just needs to be done for all modules in Py3. And unless there is a compelling reason for Py_InitModule4() not to do it, I think it should be reverted to its Py2 behaviour

[issue16392] import crashes on circular imports in ext modules

2012-11-03 Thread Stefan Behnel
Stefan Behnel added the comment: Now that you mention it - wouldn't that suffer from not actually knowing the FQMN? There's that hack in the dynlib loader that stores the package context in a global variable so that the module creation function can figure it out. That might be a rea

[issue16392] import crashes on circular imports in ext modules

2012-11-04 Thread Stefan Behnel
Stefan Behnel added the comment: The problem is a) that the module does not necessarily know to which place it eventually gets installed (Cython relies on the distutils Extension not lying to it, for example, which people do from time to time), and b) that the call to Py_InitModule() only

[issue16392] import crashes on circular imports in ext modules

2012-11-07 Thread Stefan Behnel
Stefan Behnel added the comment: Agreed. Since it doesn't really fit into any specific function documentation, I would place it right at the top. Something like this: """ The following functions can be used by C code to call into Python's import machinery. No

[issue13429] provide __file__ to extension init function

2012-11-07 Thread Stefan Behnel
Stefan Behnel added the comment: I'm increasing the target version as this didn't change anything for 3.3. However, for 3.4, it might be possible to work around this by splitting the module init function into two parts, one that gets executed in order to create the module object (a

[issue13429] provide __file__ to extension init function

2012-11-08 Thread Stefan Behnel
Stefan Behnel added the comment: Triggered discussion on python-dev: http://thread.gmane.org/gmane.comp.python.devel/135764 -- ___ Python tracker <http://bugs.python.org/issue13

[issue14373] C implementation of functools.lru_cache

2012-12-23 Thread Stefan Behnel
Stefan Behnel added the comment: Just for the record, I've compiled Raymond's roadmap version in Cython (with only slight changes to make 'self.maxsize' a Py_ssize_t and using an external .pxd for typing) and ran Serhiy's benchmark over it (Ubuntu 12.10, 64bit). Thi

[issue11379] Remove "lightweight" from minidom description

2012-12-23 Thread Stefan Behnel
Stefan Behnel added the comment: Any news on this? -- ___ Python tracker <http://bugs.python.org/issue11379> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14373] C implementation of functools.lru_cache

2012-12-23 Thread Stefan Behnel
Stefan Behnel added the comment: Yep, I basically didn't do any optimisation, it's the plain Python code compiled, just with the class being converted into an extension type. -- ___ Python tracker <http://bugs.python.o

[issue16824] typo in test

2012-12-31 Thread Stefan Behnel
New submission from Stefan Behnel: Line 522 in test file Lib/test/test_pep380.py says: trace.append("Should not have yielded:", y) However, 'trace' is a list and list.append() only takes one parameter, so this should read: trace.append(&quo

[issue15075] XincludeTest failure in test_xml_etree

2012-12-31 Thread Stefan Behnel
Stefan Behnel added the comment: If runtime checks are needed to prevent mixing arbitrary objects into the tree, then I don't think they should be considered too costly. I agree with Florent that this is worth reopening. It doesn't look like a "Tests" bug to me rath

[issue16659] Pure Python implementation of random

2012-12-31 Thread Stefan Behnel
Stefan Behnel added the comment: FWIW, PyPy has an (R)Python implementation already: https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/rrandom.py -- nosy: +scoder ___ Python tracker <http://bugs.python.org/issue16

[issue17011] ElementPath ignores different namespace mappings for the same path expression

2013-01-21 Thread Stefan Behnel
New submission from Stefan Behnel: There's a bug originally report for lxml that also applies to ElementTree: https://github.com/lxml/lxml/issues/95 Passing different namespace mappings into the Element.find*() methods will always reuse the first one due to incorrect caching based only o

[issue17011] ElementPath ignores different namespace mappings for the same path expression

2013-01-21 Thread Stefan Behnel
Changes by Stefan Behnel : -- components: +Library (Lib) -XML ___ Python tracker <http://bugs.python.org/issue17011> ___ ___ Python-bugs-list mailing list Unsub

[issue17011] ElementPath ignores different namespace mappings for the same path expression

2013-01-21 Thread Stefan Behnel
Changes by Stefan Behnel : -- components: +XML ___ Python tracker <http://bugs.python.org/issue17011> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue17011] ElementPath ignores different namespace mappings for the same path expression

2013-01-21 Thread Stefan Behnel
Stefan Behnel added the comment: Here is a test case (for lxml): https://github.com/lxml/lxml/commit/76f2ee991afd15d4f8c98cee3e095967bbf9937f -- ___ Python tracker <http://bugs.python.org/issue17

[issue11379] Remove "lightweight" from minidom description

2013-01-21 Thread Stefan Behnel
Stefan Behnel added the comment: I'm not sure if it's a good idea to keep bikeshedding about this for another two years. Personally, I would prefer having someone with commit rights fix this and be done with it. Eric's last patch looks ok and parts of it went in already, so i

[issue17024] cElementTree calls end() on parser taget even if start() fails

2013-01-24 Thread Stefan Behnel
New submission from Stefan Behnel: The following compatibility unit test fails for me in lxml since Py3.3. etree = xml.etree.ElementTree def test_parser_target_error_in_start(self): assertEqual = self.assertEqual events = [] class Target(object

[issue12323] ElementPath 1.3 expressions

2013-01-24 Thread Stefan Behnel
Stefan Behnel added the comment: I agree that [0] should be treated as a visible error as it's easy to get wrong. It's certainly too late to change this to 0-based indexing and I think it's ok to keep it 1-based for XPath compatibility (or at least similarity) as that

[issue12323] ElementPath 1.3 expressions

2013-01-24 Thread Stefan Behnel
Stefan Behnel added the comment: Yes, I think it makes sense to be rigid now and *maybe* add a new feature later. -- ___ Python tracker <http://bugs.python.org/issue12

[issue7576] Avoid warnings in PyModuleDef_HEAD_INIT

2013-01-26 Thread Stefan Behnel
Stefan Behnel added the comment: This is a duplicate of issue 9518 (or the other way round) and should be closed as fixed in 3.2. -- components: +Extension Modules nosy: +scoder ___ Python tracker <http://bugs.python.org/issue7

[issue17159] Remove explicit type check from inspect.Signature.from_function()

2013-02-08 Thread Stefan Behnel
New submission from Stefan Behnel: I can't see a reason why Signature.from_function() should explicitly check the type of the object being passed in. As long as the object has all required attributes, it should be accepted. This is specifically an issue with Cython compiled functions,

[issue17159] Remove explicit type check from inspect.Signature.from_function()

2013-02-08 Thread Stefan Behnel
Stefan Behnel added the comment: This patch removes the type check from Signature.from_function() and cleans up the type tests in signature() to use whatever the inspect module defines as isfunction() and isbuiltin(), so that it becomes properly monkey-patchable. It also adds a test that

[issue17159] Remove explicit type check from inspect.Signature.from_function()

2013-02-08 Thread Stefan Behnel
Stefan Behnel added the comment: The method doesn't seem to be documented, and I'm not sure if the docstring really benefits from this lengthy addition. Anyway, here's a patch that includes the docstring update. The exception could be kept the same if we catch an Att

[issue17159] Remove explicit type check from inspect.Signature.from_function()

2013-02-08 Thread Stefan Behnel
Stefan Behnel added the comment: Fine with me. Updated patch attached. -- Added file: http://bugs.python.org/file29007/inspect_sig_2.patch ___ Python tracker <http://bugs.python.org/issue17

[issue17159] Remove explicit type check from inspect.Signature.from_function()

2013-02-10 Thread Stefan Behnel
Stefan Behnel added the comment: Any more comments? Any objections to applying the last patch? Anyone ready to do it? -- ___ Python tracker <http://bugs.python.org/issue17

[issue17159] Remove explicit type check from inspect.Signature.from_function()

2013-02-10 Thread Stefan Behnel
Stefan Behnel added the comment: 1) that's a regex test, so it just looks for the text. I only extended it to include the object it's supposed to test for. It's not actually related to my changes, but I considered it the right thing to do. I used "42.*is not" in order

[issue18990] Remove unnecessary API inconsistency from ElementTree.XMLPullParser.close()

2013-09-12 Thread Stefan Behnel
Stefan Behnel added the comment: ping - I would like to see this fixed for alpha3, which is due in two weeks. -- ___ Python tracker <http://bugs.python.org/issue18

[issue18902] Make ElementTree event handling more modular to allow custom targets for the non-blocking parser

2013-09-12 Thread Stefan Behnel
Stefan Behnel added the comment: The way the XMLPullParser is implemented in lxml.etree now is that it simply inherits from XMLParser. This would also make sense for ElementTree, even before supporting arbitrary targets. The patch in ticket #18990 makes this simple to do. For reference, here

[issue17741] event-driven XML parser

2013-09-12 Thread Stefan Behnel
Stefan Behnel added the comment: The way the XMLPullParser is implemented in lxml.etree now is that it simply inherits from XMLParser. This would also make sense for ElementTree, even before supporting arbitrary targets. The patch in ticket #18990 makes this simple to do. For reference, here

[issue18902] Make ElementTree event handling more modular to allow custom targets for the non-blocking parser

2013-09-13 Thread Stefan Behnel
Stefan Behnel added the comment: > Also, +1 for allowing start-ns and end-ns event callbacks on parser targets, > although that's a different feature entirely. Actually, I take that back. I can't see a use case for this feature, and it doesn't really fit with the notion o

[issue18902] Make ElementTree event handling more modular to allow custom targets for the non-blocking parser

2013-09-13 Thread Stefan Behnel
Stefan Behnel added the comment: I created a separate ticket #19010 for the inheritance issue. -- ___ Python tracker <http://bugs.python.org/issue18902> ___ ___

[issue19010] Make XMLPullParser in ElementTree inherit from XMLParser

2013-09-13 Thread Stefan Behnel
New submission from Stefan Behnel: As mentioned in tickets #18902 and #17741, the XMLPullParser in the external lxml.etree package inherits from the existing XMLParser class. This makes the interface simpler, both simpler to explain and to implement. The implementation in ElementTree should

[issue18990] Remove unnecessary API inconsistency from ElementTree.XMLPullParser.close()

2013-09-13 Thread Stefan Behnel
Stefan Behnel added the comment: I've updated the lxml documentation to reflect the new implementation. It also has a couple of examples that show how the API works now. https://github.com/lxml/lxml/blob/74ab4b10176750e7797eb0eff3c7c91901ab6adb/doc/parsing.txt

[issue18059] Add multibyte encoding support to pyexpat

2013-09-13 Thread Stefan Behnel
Stefan Behnel added the comment: I don't think I have my head deep enough in the encodings implementation to say that this is the correct/best way to do it, but the patch looks mostly reasonable to me and would be a helpful addition. I have two comments on the pyexpat_encoding_co

[issue18990] Remove unnecessary API inconsistency from ElementTree.XMLPullParser.close()

2013-09-19 Thread Stefan Behnel
Stefan Behnel added the comment: Inviting some more people to get this patch reviewed in a timely fashion. Given that it's a cleanup of a newly introduced API, it must go in before the first beta release of 3.4. The even wider cleanup would be to make XMLPullParser inherit from XMLParser

[issue18990] Return root element from ElementTree.XMLPullParser.close() to match ElementTree.XMLParser

2013-09-19 Thread Stefan Behnel
Stefan Behnel added the comment: I'm not entirely happy about the docs anyway. Most people just want to loop over iterparse() and be done (use case being to save memory). The new parser class is a rather special and more complex thing that we shouldn't let innocent users run into t

[issue18990] Return root element from ElementTree.XMLPullParser.close() to match ElementTree.XMLParser

2013-09-20 Thread Stefan Behnel
Stefan Behnel added the comment: Ah, right - I forgot that it currently only implements a part of the parser API in ElementTree. Adding "Returns the toplevel document element." behind the current sentence would do, I guess. That will need updating once the XMLPullParser implements s

[issue18990] Return root element from ElementTree.XMLPullParser.close() to match ElementTree.XMLParser

2013-09-20 Thread Stefan Behnel
Stefan Behnel added the comment: > Just as an example: consider that in a lot of use cases the programmer will > want to discard parts of the tree that's parsed iteratively (similarly to the > main use case of iterparse()), because the XML itself is too huge. It's a > co

[issue18990] Return root element from ElementTree.XMLPullParser.close() to match ElementTree.XMLParser

2013-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: Eli, seeing our discussion so far, ISTM that the parser-target interface is at the very heart of our disagreement. For me, it's a good design that provides a clean separation of concerns between the parser that generates events, and the target (usually

[issue18990] Return root element from ElementTree.XMLPullParser.close() to match ElementTree.XMLParser

2013-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: > That means the patch could be simplified to just removing the root > attribute without changing the result of calling close(). Absolutely. Returning the parse result from close() would still make it both more consistent and easier to use (also from

[issue18990] Return root element from ElementTree.XMLPullParser.close() to match ElementTree.XMLParser

2013-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: > Unfortunately I don't have time to review refactoring patches now. In light > of a larger refactoring planned in this part of the module in the future, I > don't think it's very important to tweak things right now. You misunderst

[issue18990] Return root element from ElementTree.XMLPullParser.close() to match ElementTree.XMLParser

2013-09-21 Thread Stefan Behnel
Stefan Behnel added the comment: > I still consider this refactoring gratuitious at this point. The API is > well defined by the documentation. All the rest is implementation details. Famous last words. -- ___ Python tracker <http://bugs.p

[issue18990] Return root element from ElementTree.XMLPullParser.close() to match ElementTree.XMLParser

2013-09-26 Thread Stefan Behnel
Stefan Behnel added the comment: Here's the obvious minimal patch that removes the non-public 'root' attribute. Please apply it for Py3.4 and then set the version tag of this ticket to Py3.5 (instead of closing it, because it's not resolved yet). As I said, the expected t

[issue19107] CSV output of benchmark runner tries to write to binary file

2013-09-27 Thread Stefan Behnel
New submission from Stefan Behnel: The perf.py script opens the file for CSV output in binary mode, which no longer works in Py3: Index: perf.py === --- perf.py (Revision 80409) +++ perf.py (Arbeitskopie) @@ -2443,7

[issue19107] CSV output of benchmark runner tries to write to binary file

2013-09-27 Thread Stefan Behnel
Changes by Stefan Behnel : -- nosy: +brett.cannon, pitrou ___ Python tracker <http://bugs.python.org/issue19107> ___ ___ Python-bugs-list mailing list Unsub

[issue19108] Benchmark runner tries to execute external Python command and fails on error reporting

2013-09-27 Thread Stefan Behnel
New submission from Stefan Behnel: In changeset 88b6ef9aa9e9, a new function ported_lib() was added that crashes on error reporting in Py3 because it tries to do this: raise RuntimeError("Benchmark died: " + err) "err" is a bytes object that comes straight from the s

[issue18990] Return root element from ElementTree.XMLPullParser.close() to match ElementTree.XMLParser

2013-09-28 Thread Stefan Behnel
Stefan Behnel added the comment: Eli didn't explicitly comment on the patch so far, but let me quote some of his earlier comments: > if the reader discards parts of the tree (by deleting subtrees), then > returning the root from close() becomes even more meaningless, because it

[issue18990] Remove root attribute from XMLPullParser

2013-09-28 Thread Stefan Behnel
Stefan Behnel added the comment: Thanks, Nick. Your changes look good to me. -- ___ Python tracker <http://bugs.python.org/issue18990> ___ ___ Python-bugs-list m

[issue19010] Make XMLPullParser in ElementTree inherit from XMLParser

2013-09-28 Thread Stefan Behnel
Stefan Behnel added the comment: Any comment and/or reason? -- ___ Python tracker <http://bugs.python.org/issue19010> ___ ___ Python-bugs-list mailing list Unsub

[issue18902] Make ElementTree event handling more modular to allow custom targets for the non-blocking parser

2013-09-28 Thread Stefan Behnel
Stefan Behnel added the comment: Closing #18990 defines the API of the new XMLPullParser that 3.4 will ship with, so this ticket becomes an enhancement for future versions. -- type: behavior -> enhancement versions: -Python 3.4 ___ Python trac

[issue19108] Benchmark runner tries to execute external Python command and fails on error reporting

2013-09-28 Thread Stefan Behnel
Stefan Behnel added the comment: Well, it worked before, so the current state is clearly a regression. -- ___ Python tracker <http://bugs.python.org/issue19

[issue18902] Make ElementTree event handling more modular to allow custom targets for the non-blocking parser

2013-09-28 Thread Stefan Behnel
Stefan Behnel added the comment: Copying a relevant comment by Eli from http://bugs.python.org/issue18990#msg198145 and replying inline. """ The way the APIs are currently defined, XMLParser and XMLPullParser are different animals. XMLParser can be considered to only have one

[issue19010] Make XMLPullParser in ElementTree inherit from XMLParser

2013-09-29 Thread Stefan Behnel
Stefan Behnel added the comment: Given that the inheritance chain has no real user impact, I can live with this difference. -- ___ Python tracker <http://bugs.python.org/issue19

[issue18594] C accelerator for collections.Counter is slow

2013-09-30 Thread Stefan Behnel
Stefan Behnel added the comment: Patch LGTM and seems to work well, according to your numbers. Only minor nitpick would be that the method references could be decref-ed earlier, but that would complicate the code a bit. -- ___ Python tracker <h

[issue19108] Benchmark runner tries to execute external Python command and fails on error reporting

2013-10-01 Thread Stefan Behnel
Stefan Behnel added the comment: Antoine, I really don't like this attitude of adding code and then saying "well, it's there, I won't change it" when others complain about breakage. Please undo your change that broke the ability of using (non-trivial) wrapper script

[issue18594] C accelerator for collections.Counter is slow

2013-10-01 Thread Stefan Behnel
Stefan Behnel added the comment: Can you update the benchmark numbers to show what the difference is compared to pure Python (and to the fastpath) now? One more thing: the fastpath depends on .__getitem__() and friends, whereas the fallback path depends on .get(). What if someone overrides

[issue19108] Benchmark runner tries to execute external Python command and fails on error reporting

2013-10-01 Thread Stefan Behnel
Stefan Behnel added the comment: > I'm leaving you with this, if you're wanting to do anything about it Sorry, but weren't you just asking *me* to be constructive? I'm aware that getting this change right isn't trivial. But that doesn't mean we should happ

[issue19108] Benchmark runner tries to execute external Python command and fails on error reporting

2013-10-02 Thread Stefan Behnel
Stefan Behnel added the comment: What about this: by default, we assume all runtimes to have the same major version as the Python runtime that executes the benchmark runner. If that's not the case, users must override it explicitly with a command line option, say, "--pyversions

[issue19108] Benchmark runner tries to execute external Python command and fails on error reporting

2013-10-03 Thread Stefan Behnel
Stefan Behnel added the comment: I'm having trouble understanding your last comment. Are you saing that you want the exact value to be a two digits version and therefore use separate arguments for both Pythons (e.g. "--basever 2.7 --cmpver 3.3"), or that you want it to a

[issue16195] Difficult or impossible to figure out how garbage collector and weak references should interact for user-defined extension types

2013-10-05 Thread Stefan Behnel
Stefan Behnel added the comment: Just as a quick update here: Cython has since then switched to only using PyObject_ClearWeakRefs() and otherwise leaves the handling of the weakref slot to CPython. -- ___ Python tracker <http://bugs.python.

[issue19108] Benchmark runner tries to execute external Python command and fails on error reporting

2013-10-12 Thread Stefan Behnel
Stefan Behnel added the comment: Here's a patch that replaces the current simplistic Python executable command config with a dedicated PythonRuntime config class. That makes it easy to properly pass around the program specific configuration. Part of that is the Python executable path

[issue19236] Add Tornado HTTP benchmark

2013-10-12 Thread Stefan Behnel
Changes by Stefan Behnel : -- components: +Benchmarks nosy: +scoder ___ Python tracker <http://bugs.python.org/issue19236> ___ ___ Python-bugs-list mailin

<    4   5   6   7   8   9   10   11   12   13   >