Stefan Behnel added the comment:
Changing subject to make it clear what this ticket is really about.
--
title: Pure-Python ElementTree classes no longer available since 3.3 -> Allow
more low-level parser configuration in ElementTree
versions: +Python 3.10 -Python 3.3, Python
Change by Stefan Behnel :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue20198>
___
___
Stefan Behnel added the comment:
Big +1 from me, too, for the same reasons Yury gave.
--
nosy: +scoder
___
Python tracker
<https://bugs.python.org/issue41
Stefan Behnel added the comment:
Copying some of the design discussion from the PR here
(https://github.com/python/cpython/pull/22196/files#r486730457), because it
belongs into the ticket.
Yury Selivanov proposed to add a new C-API function for this (naming changes by
me):
typedef
Stefan Behnel added the comment:
I'm happy to see this moving forward.
Not convinved of the "PyIter_Send()" name, though. I don't consider this part
of the iterator protocol. It's specific to generators and coroutines. Cython
would probably guard its usage b
Stefan Behnel added the comment:
I would also have preferred a more type specific function, but yeah, as long as
the types for which the function would normally be used are special cased early
enough in the implementation, it makes no big difference.
Fine with me, too
Stefan Behnel added the comment:
BTW, just to give this a house number, I remember having measured a performance
improvement of up to 70% at some point when switching from "generators always
raise a StopIteration at the end" to "generators just return NULL" in Cython
Stefan Behnel added the comment:
Closing again since GH-21528 has been merged in issue 41295.
--
status: open -> closed
___
Python tracker
<https://bugs.python.org/issu
Stefan Behnel added the comment:
FYI, https://github.com/cython/cython/pull/3427 has been merged into Cython. In
Cython 3.0, compiled coroutines will disguise as non-compiled coroutines, from
the PoV of asyncio.
Restricting this ticket to Py3.10 since we're rather discussing a new fe
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
> That example is especially problematic.
No, it's not. It uses .findall(), which returns a list. It's like when you make
a copy of a list to iterate over, when you want to modify the original list in
the loop.
That could be made explicit in
Change by Stefan Behnel :
--
keywords: +patch
pull_requests: +21489
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22464
___
Python tracker
<https://bugs.python.org/issu
Change by Stefan Behnel :
--
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue41892>
___
___
Python-bugs-list mailing list
Unsubscrib
Stefan Behnel added the comment:
@WoodyWoo, you can (and should) do something like this:
for ELEMchild in list(etroot):
Modifying a container while iterating over it is usually not a good idea. The
same applies to Python lists and dicts, for example.
--
stage: patch review
Stefan Behnel added the comment:
Closing as duplicate of issue 41892. Let's keep the discussion there.
--
___
Python tracker
<https://bugs.python.org/is
Change by Stefan Behnel :
--
Removed message: https://bugs.python.org/msg377740
___
Python tracker
<https://bugs.python.org/issue41899>
___
___
Python-bugs-list m
Stefan Behnel added the comment:
Closing as duplicate of issue 41891. Let's keep the discussion there.
--
nosy: +scoder
resolution: -> duplicate
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.pyth
Stefan Behnel added the comment:
Yes, it fixed already. Thanks!
--
nosy: +scoder
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
New submission from Stefan Behnel :
import xml.etree.ElementTree as ET
xml="""
http://soap.sforce.com/2006/04/metadata";>
"""
print(ET.canonicalize(xml))
Fails with:
ValueError: Namespace "" is not declared in scope
when trying to build t
Change by Stefan Behnel :
--
keywords: +patch
pull_requests: +21493
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22474
___
Python tracker
<https://bugs.python.org/issu
Change by Stefan Behnel :
--
versions: +Python 3.10, Python 3.9
___
Python tracker
<https://bugs.python.org/issue41892>
___
___
Python-bugs-list mailin
Stefan Behnel added the comment:
New changeset 6a412c94b6b68e7e3632562dc7358a12ffd1447f by scoder in branch
'master':
bpo-41900: C14N 2.0 serialisation failed for unprefixed attributes when a
default namespace was defined. (GH-22474)
https://github.com/python/cpyt
Stefan Behnel added the comment:
New changeset a0f2b664335eb689abdecc677e09a193f503af59 by Miss Skeleton (bot)
in branch '3.9':
bpo-41900: C14N 2.0 serialisation failed for unprefixed attributes when a
default namespace was defined. (GH-22474) (GH-22507)
https://github.com/pyth
Stefan Behnel added the comment:
New changeset cfed5343331350c5737b464970a31f7588319e8b by Miss Skeleton (bot)
in branch '3.8':
bpo-41900: C14N 2.0 serialisation failed for unprefixed attributes when a
default namespace was defined. (GH-22474) (GH-22508)
https://github.com/pyth
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Stefan Behnel :
--
nosy: +scoder
nosy_count: 29.0 -> 30.0
pull_requests: +21519
pull_request: https://github.com/python/cpython/pull/22474
___
Python tracker
<https://bugs.python.org/iss
Change by Stefan Behnel :
--
nosy: +scoder
nosy_count: 9.0 -> 10.0
pull_requests: +21521
pull_request: https://github.com/python/cpython/pull/22474
___
Python tracker
<https://bugs.python.org/issu
Change by Stefan Behnel :
--
nosy: +scoder
nosy_count: 9.0 -> 10.0
pull_requests: +21520
pull_request: https://github.com/python/cpython/pull/22474
___
Python tracker
<https://bugs.python.org/issu
Change by Stefan Behnel :
--
pull_requests: -21520
___
Python tracker
<https://bugs.python.org/issue36533>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Stefan Behnel :
--
pull_requests: -21519
___
Python tracker
<https://bugs.python.org/issue6721>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Stefan Behnel :
--
nosy: -scoder
___
Python tracker
<https://bugs.python.org/issue36533>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Stefan Behnel :
--
pull_requests: -21521
___
Python tracker
<https://bugs.python.org/issue33802>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Stefan Behnel :
--
nosy: -scoder
___
Python tracker
<https://bugs.python.org/issue6721>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Stefan Behnel :
--
nosy: -scoder
___
Python tracker
<https://bugs.python.org/issue33802>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Stefan Behnel :
--
pull_requests: +21547
pull_request: https://github.com/python/cpython/pull/22546
___
Python tracker
<https://bugs.python.org/issue41
Stefan Behnel added the comment:
Closing since this works as designed.
Users are responsible for avoiding concurrent tree modifications during
iteration.
--
resolution: -> not a bug
stage: patch review -> resolved
status: open -&g
Stefan Behnel added the comment:
> Don't forget to remove PyGen_Send()
That's the function that allows sending data into a generator. It's also used
internally by "PyIter_Send()". Are you really suggesting to remove it, or to
make it underscore-priv
Stefan Behnel added the comment:
The patch looks right. I'm not sure if this can still be changed in Py3.8,
though, since that has been around for quite a while now.
Admittedly, few people will disable the C accelerator module and thus whitness
this issue, but for them, this is a bre
Stefan Behnel added the comment:
In general, since the C accelerator is enabled by default, and few people would
consider disabling it explicitly, I generally consider the behaviour of the C
implementation to be "right", if both implementations differ.
As a single data point, the
Stefan Behnel added the comment:
New changeset 97e8b1eaeaf3aa325c84ff2e13417c30414d0269 by Ammar Askar in branch
'master':
bpo-40624: Add support for the XPath != operator in xml.etree (GH-22147)
https://github.com/python/cpython/commit/97e8b1eaeaf3aa325c84ff2e13417c
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
Eli Bendersky, 10.02.2012 15:52:
> * The current contents of xml/etree/ElementTree.py will move to
> xml/etree/pyElementTree.py
IIRC, there is a well specified way how accelerator modules should be used
by Python modules. I recall a lengthy discuss
Stefan Behnel added the comment:
Eli Bendersky, 10.02.2012 16:43:
>>> I don't see a compelling enough reason to break imports in existing code by
>>> removing the cElementTree module, so we should not do that.
>
> Agreed. Perhaps it should just be deprecated?
Giv
Stefan Behnel added the comment:
Eli Bendersky, 11.02.2012 09:08:
> The more I think about it, the more the bootstrap code in _elementtree.c
> annoys me. It's the only instance of calling PyRun_String in Modules/ !
>
> It's hackish and causes ugly import problems. If t
Stefan Behnel added the comment:
Both lxml and ElementTree have tutorials:
http://effbot.org/zone/element.htm
http://lxml.de/tutorial.html
Here is another tutorial that may server as a source for an intro:
http://infohost.nmt.edu/tcc/help/pubs/pylxml/web/index.html
And the general ET
Stefan Behnel added the comment:
Oh, and here are the ReST sources of the lxml docs:
https://github.com/lxml/lxml/tree/master/doc/
Specifically the tutorial:
https://raw.github.com/lxml/lxml/master/doc/tutorial.txt
and the parsing part:
https://raw.github.com/lxml/lxml/master/doc
New submission from Stefan Behnel :
Following up on recent mailing list threads on pypy-dev and python-dev, this is
a request for adding a public C-API to read and write the sys.exc_info()
fields, currently stored in tstate->exc_*.
While not of major interest for CPython itself, this C-
Stefan Behnel added the comment:
I wonder if these functions should have an error return value, i.e. return -1
on failure. They'd "never" fail in CPython, but other implementations may want
to report failures, in case their internal implementation is more involved.
OTOH, d
Stefan Behnel added the comment:
Writing up a test case, I noticed that it makes sense to let PyErr_SetExcInfo()
steal the references. This matches the main use case of saving and restoring
the fields. For the getter, it's still best to return new references in order
to support the use
Changes by Stefan Behnel :
--
keywords: +patch
Added file: http://bugs.python.org/file24613/exc_info_capi.patch
___
Python tracker
<http://bugs.python.org/issue14
New submission from Stefan Behnel :
In the context of better interfacing of PyPy with Cython, it appears that
simple looking things like PyTuple_GET_ITEM() are often rather involved in
PyPy's C-API implementation. However, since functions/macros like these are
used very frequently, thi
Stefan Behnel added the comment:
Note that Element is also a factory function in lxml.etree, and people have
been living with this quite happily. I don't see a reason to change either
side. There is a dedicated function iselement(obj) for exactly the purpose
of testing if something
Stefan Behnel added the comment:
For the record, the relevant mailing list discussion can be found here:
http://thread.gmane.org/gmane.comp.python.devel/129429/focus=129794
--
___
Python tracker
<http://bugs.python.org/issue14
New submission from Stefan Behnel :
Line 428 in Python/marshal.c calls pb->bf_releasebuffer() without dec-refing
the view.obj field afterwards. I don't think this is really so truly
performance critical that it can't accept the couple of nanoseconds that it
takes
Stefan Behnel added the comment:
Thanks Eli.
What about the "Lightweight DOM implementation", though? Following Martin's
comment that performance characteristics (like "fast", "memory friendly" or
"lightweight") should normally not be documente
Stefan Behnel added the comment:
Yes, I think that's better.
--
___
Python tracker
<http://bugs.python.org/issue11379>
___
___
Python-bugs-list mailing list
New submission from Stefan Behnel :
These are tests from lxml's ET compatibility test suite that now fail in
ElementTree:
def test_delslice_step(self):
Element = self.etree.Element
SubElement = self.etree.SubElement
a = Element('a')
b = S
Stefan Behnel added the comment:
FWIW, Cython lets user code implement the buffer interface for extension types
using the special methods "__getbuffer__()" and "__releasebuffer__()", so
providing the same methods (although with a different signature) also for
normal Pyt
Changes by Stefan Behnel :
Added file: http://bugs.python.org/file24734/pyerr_getexcinfo.patch
___
Python tracker
<http://bugs.python.org/issue14098>
___
___
Python-bug
Stefan Behnel added the comment:
Then I'm abusing this ticket to say: thanks for verifying this.
--
___
Python tracker
<http://bugs.python.org/is
Stefan Behnel added the comment:
Yes, I think this is much clearer.
--
___
Python tracker
<http://bugs.python.org/issue14181>
___
___
Python-bugs-list mailin
New submission from Stefan Behnel :
Based on the existing "test_attempted_yield_from_loop" in
Lib/test/test_pep380.py, I wrote this test and I wonder why it does not work:
"""
def test_attempted_reentry():
"""
>>> for line in test_
Stefan Behnel added the comment:
Oh, right, I missed that part. I also think that a visible note is better. And
+1 for "W3C DOM interface".
--
___
Python tracker
<http://bugs.python.o
Stefan Behnel added the comment:
Here is an analysis of this (less verbose) code:
def g1():
yield "y1"
yield from g2()
yield "y4"
def g2():
yield "y2"
try:
yield from gi
except ValueError:
Stefan Behnel added the comment:
Ah, yes, that should work in both implementations. I'll give it a try. Thanks!
--
resolution: fixed ->
status: closed -> open
___
Python tracker
<http://bugs.python.
Stefan Behnel added the comment:
FWIW, lxml also has support for parsing Unicode strings. It doesn't encode the
input, however, but parses straight from the underlying buffer (after detecting
the buffer layout etc. at module init time - and yes, I still haven't fixed
this up
Stefan Behnel added the comment:
Ok, just for the record: a single __buffer__() special method with
delegation-only semantics would also work for Cython. Taking this path would
provide a cleaner separation of the (then delegation-only) Python level
protocol and the (all purpose) C level
Stefan Behnel added the comment:
This is now implemented in PyPy:
https://bitbucket.org/pypy/pypy/changeset/623bcea85df3
Are there any objections to applying the equivalent patch to CPython?
--
___
Python tracker
<http://bugs.python.
Stefan Behnel added the comment:
FWIW, Cython keeps the exception state in the generator struct and that works
nicely.
Note that Amaury is right in that extensions use tstate->exc_value and friends.
Cython does so quite extensively, for example. I don't see any use in changing
t
Stefan Behnel added the comment:
I can't speak for much outside of Cython, and Cython generated modules would
best be regenerated with a newer Cython version anyway in order to work with
Py3.3. I'm not sure that's currently required, though.
As long as there is a way to acce
Stefan Behnel added the comment:
Done.
--
___
Python tracker
<http://bugs.python.org/issue14098>
___
___
Python-bugs-list mailing list
Unsubscribe:
Stefan Behnel added the comment:
>> As long as there is a way to access these fields directly from the
>> struct (with the usual preprocessor conditional), I don't think Cython
>> will actually start to use the PyErr_[GS]etExcInfo() functions in
>> CPython - s
New submission from Stefan Behnel :
Up to the early Py3.3 developer versions, calling __import__() with a level of
-1 worked as in Python 2, i.e. it tried a relative import first and then a
global import.
This no longer seems to be available after the importlib rewrite (e.g. as of
rev
New submission from Stefan Behnel :
The imp.load_dynamic() function is used by third party code (e.g. Cython's
pyximport) but is not currently documented.
http://docs.python.org/dev/library/imp.html
The latest changes to the import mechanism suggest that it should better be
document
Stefan Behnel added the comment:
It turns out that it wasn't all that hard to work around. Calling __import__
twice seems to do the trick. It's more overhead, but if people want speed, they
can just be explicit about what kind of import they actually mean.
So I wouldn't mind c
Stefan Behnel added the comment:
> Yeah, the fix is dead-simple, import with level=1 and if that fails import
> with level=0.
With one caveat: relative imports don't work outside of packages, so the
importing code has to know when it's in a package or not. Otherwise, the
relat
Stefan Behnel added the comment:
Hmm, interesting - it stripped the command from my e-mail. I was doing this:
>>> __import__("sys", level=1)
Traceback (most recent call last):
File "", line 1, in
SystemError: error
Stefan Behnel added the comment:
Asking users unconditionally to use the "xmlcharrefreplace" replacement method
seems wrong for UTF-8. It should not be necessary.
We should, however, document explicitly that the file will receive text and not
bytes, i.e. that users are
Stefan Behnel added the comment:
New changeset 5ac0b988fd5f1428efe35329c531c7b5c74d37f6 by Stefan Behnel
(Windson yang) in branch 'master':
bpo-18911: clarify that the minidom XML writer receives texts but not bytes
(GH-13352)
https://github.com/python/cpyt
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8 -Python 2.7, Python 3.5, Python 3.6
___
Python tracker
<https://bugs.python.or
Change by Stefan Behnel :
--
resolution: fixed ->
stage: resolved -> backport needed
status: closed -> open
versions: +Python 3.7
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
New changeset 18e23f227be59241cbb1eeb6d6669771dd7275fb by Stefan Behnel (Miss
Islington (bot)) in branch '3.7':
bpo-18911: clarify that the minidom XML writer receives texts but not bytes
(GH-13718)
https://github.com/python/cpyt
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
Note that PyCode_New() is not the only change in 3.8 beta1 that breaks Cython
generated code. The renaming of "tp_print" to "tp_vectorcall" is equally
disruptive, because Cython has (or had) a work-around for CPython
(mis-)behaviour
Stefan Behnel added the comment:
> they can equally easily zero out the entire structure and ignore it without
> changing behavior on any Python 3.x.
Any solution that we apply in Cython will require users to regenerate their .c
sources with a new Cython version in order to make it c
Stefan Behnel added the comment:
(I forgot to state the obvious third option, which is: don't do anything and
leave everything as it is now in beta-1.)
--
___
Python tracker
<https://bugs.python.org/is
Stefan Behnel added the comment:
I agree with Steve that broadly redefining a global name in a widely used
header file is not a good idea. You never know what names users have in their
code. Yes, you can work around it by undef-ing it again, but honestly, in that
case, both sides are hacks
Stefan Behnel added the comment:
Thank you, Petr, for bringing this discussion back on a solid basis, actually
twice already.
And sorry for causing this problem in the first place. The "tp_print = 0" was
necessary to fix misbehaviour in Py2, and we should have restricted it to
Stefan Behnel added the comment:
I'm really only waiting for bpo-37250 to be resolved, then I can prepare a new
point release of Cython, preferably this week.
--
___
Python tracker
<https://bugs.python.org/is
Stefan Behnel added the comment:
I think it might be this call that strikes here:
https://github.com/python/cpython/commit/43851a202c#diff-f3b827d6e1d5c270ab42bc2c0523c1d2R2842
treebuilder_flush_data() is not made for concatenating text, it simply replaces
it. If both text parts come
Stefan Behnel added the comment:
I'm working on a patch. It's not entirely trivial, so it might take a couple of
days.
--
assignee: -> scoder
___
Python tracker
<https://bugs.pytho
Stefan Behnel added the comment:
> Is it part of Cython 0.29.11 released yesterday?
Yes.
--
___
Python tracker
<https://bugs.python.org/issue37221>
___
_
Stefan Behnel added the comment:
> it should not be rely upon
IMHO, the correct behaviour under coverage analysis is to keep the code and not
discard it. After all, it is code that exists, and that is not being executed,
so it should count as uncovered code. The fact that some Pyt
Stefan Behnel added the comment:
No need to keep this bug open on CPython side. The backwards compatibility has
been restored (and I'll release Cython 0.29.12 today to resolve the issue on
that side.)
--
resolution: -> fixed
status: open -
Change by Stefan Behnel :
--
keywords: +patch
pull_requests: +14646
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/14856
___
Python tracker
<https://bugs.python.org/issu
Change by Stefan Behnel :
--
pull_requests: +14654
pull_request: https://github.com/python/cpython/pull/14867
___
Python tracker
<https://bugs.python.org/issue34
Stefan Behnel added the comment:
I created a PR that adds a couple of paragraphs to the documentation. Comments
welcome.
--
versions: +Python 3.9
___
Python tracker
<https://bugs.python.org/issue34
Stefan Behnel added the comment:
> Changing the major version number itself is a breaking change
So is the proposed change, in a way. At some point, there will be a 4.0
release, which may or may not break the code in question. So, testing for
"version_info[0] == 3" is already w
Stefan Behnel added the comment:
New changeset c6cb4cdd21c0c3a09b0617dbfaa7053d3bfa6def by Stefan Behnel in
branch 'master':
bpo-37399: Correctly attach tail text to the last element/comment/pi (GH-14856)
https://github.com/python/cpython/commit/c6cb4cdd21c0c3a09b0617dbfaa705
301 - 400 of 1287 matches
Mail list logo