Stefan Behnel <[EMAIL PROTECTED]> added the comment:
While PyUnicode_AsStringAndSize() may be a better solution if the length
is required, PyUnicode_AsString is enough() when it is not required. So
I don't buy that argument. Since there are dedicated UTF-8 encoding
functions, both fu
Stefan Behnel <[EMAIL PROTECTED]> added the comment:
I would accept that if this had been done in all cases, but as I wrote
in my first comment, the previously existing slot "nb_divide", which
comes *before* the named ones, has already been removed, so there is no
way existing P
Stefan Behnel <[EMAIL PROTECTED]> added the comment:
As noted in issue2997, the nb_divide slot (4th field!) has already been
removed, so Py2 code has to be adapted anyway. I therefore recommend to
just remove all unused fields to get a clean struct for Py3.
--
nosy: +
Stefan Behnel <[EMAIL PROTECTED]> added the comment:
The change that removed the nb_divide and nb_inplace_divide members is here:
http://svn.python.org/view?rev=43285&view=rev
http://svn.python.org/view/python/branches/p3yk/Include/object.h?rev=43285&view=diff&r1=43285&r
New submission from Stefan Behnel <[EMAIL PROTECTED]>:
operator.delslice() and friends were removed in Python 3.0, as the
underlying object methods no longer exist. In the same way that the
slicing special methods were deprecated in favour of the item methods
should the functions in the op
New submission from Stefan Behnel <[EMAIL PROTECTED]>:
I get a reproducible crash under Linux when running the test cases of
lxml's trunk in Py3b2. As usual with these things, it's not reproducible
when running the crashing test by itself, only when it hits the test
during th
Stefan Behnel <[EMAIL PROTECTED]> added the comment:
Thanks a lot for the analysis. I was considering that this was a problem
with Cython, but since this was the first time I got a crash on this
(even Py3.0b1 didn't expose this), I wanted to ask here first.
Your explanation soun
Stefan Behnel <[EMAIL PROTECTED]> added the comment:
Also, the implementation does not follow the revised buffer PEP 3118. It
still calls get/releasebuffer(NULL) to acquire a lock, which is no
longer allowed by the buffer protocol.
I think this should become a release blocker for the las
Stefan Behnel added the comment:
Looks like this is one of those bugs that run away when you look too close...
I can get it to crash reliably for me with the latest py3k branch (and all
Python 3.x release versions) when I run the test suite completely, so here's a
new recipe. The inte
Stefan Behnel added the comment:
I'll add a couple of comments about the relevant parts of the code that appears
to trigger the crash.
The code runs through the parse tree and applies transformations to it.
1) For node matching, we use a dispatcher (in Visitor.py) that looks up methods
Stefan Behnel added the comment:
I tried several times to debug it myself, but I don't understand the exception
cleanup macros in ceval.c (UNWIND_EXCEPTION_HANDLER and friends, new in Py3).
If someone can get me set up to debug them, I can give it another shot. I
assume there are a coup
New submission from Stefan Behnel :
The xml.etree.ElementTree package in the Python 3.x standard library breaks
compatibility with existing ET 1.2 code. The serialiser returns a unicode
string when no encoding is passed. Previously, the serialiser was guaranteed to
return a byte string. By
Stefan Behnel added the comment:
I agree that the lxml API is somewhat clumsy here. I just mentioned it to show
that there are already ways to do it in a backwards compatible way, so this
change does two things: it breaks existing code, and it does so in a way that
is incompatible with other
Stefan Behnel added the comment:
It has been brought up several times that ET is special in the stdlib in that
it is an externally maintained package. Correct me if I'm wrong, but the rules
seem to be: features come outside, adaptation to Py3 can happen inside. What we
are talking about
Stefan Behnel added the comment:
Antoine, in the same comment, you say that it was not backported to Py2 in
order to prevent breaking existing code, and then you ask if it's difficult to
support in lxml. ;-)
Supporting the same behaviour in lxml would either mean that it breaks exi
Stefan Behnel added the comment:
Sorry, Antoine, but you can't possibly mean what you say here. The culprit in
question is clearly one of the best hidden features of the new Py3 ET API. The
only existing reference to it that I can find is the SVN commit comment when it
was applied. H
Stefan Behnel added the comment:
Then I would call that a clear sign that no-one actually stumbled over this
feature in Py3 before I did, well hidden as it was. Still time to fix it.
--
___
Python tracker
<http://bugs.python.org/issue8
Stefan Behnel added the comment:
Hi Guido, your comment was long overdue in this discussion.
Guido van Rossum, 12.03.2010 01:35:
> My thinking was that since an XML document looks like text, it should
> probably be considered text, at least by default. (There may have
> been some
Stefan Behnel added the comment:
One more thing: given that many web-frameworks are still not available for Py3
at this time, and that there are still tons of third-party libraries missing on
that platform, I would be surprised if there was any ElementTree based XML/HTML
processing code
Stefan Behnel added the comment:
"'None' has always been the documented default for the encoding parameter"
What I meant here was that "help(ET.tostring)" will show you that as the
default. Also, in the docs, the signature is "tostring(tree, encoding=None)&q
New submission from Stefan Behnel :
Python 3.2a0 (py3k:78205M, Feb 16 2010, 17:32:08)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> e = None
[50279 refs]
>>> e
[50279 refs]
>>>
Stefan Behnel added the comment:
I knew that the variable was supposed to go out of scope when leaving the
except block, but I wasn't aware that this was supposed to be done using (the
equivalent of) a 'del'. Were the side-effects of deleting variables defined
outside of
Stefan Behnel added the comment:
That's a funny idea. I like that. +1
--
___
Python tracker
<http://bugs.python.org/issue8047>
___
___
Python-bugs-list m
Stefan Behnel added the comment:
> Supporting unicode for lxml.etree compatibility is fine with me, but I
> think it might make sense to support the string "unicode" as well (as
> a pseudo-encoding -- it's pretty clear to me that nobody will ever
> define a real c
Stefan Behnel added the comment:
There is at least one valid use case: code that needs to deal with HTML and
XHTML currently has to normalise the tag names in some way, which usually means
that it will want to remove the namespaces from XHTML documents to make it look
like plain HTML. It
Stefan Behnel <[EMAIL PROTECTED]> added the comment:
This is an (extended) duplicate of issue4152.
--
nosy: +scoder
___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.pytho
Stefan Behnel added the comment:
I would definitely appreciate having a well-defined set of "required
tests" that Cython should pass for compliance.
However, something like sys.vm won't easily work for Cython: it runs
within the CPython VM but only after converting the P
Stefan Behnel added the comment:
@Antoine: Cython already compiles a major part of CPython's test suite
successfully (although we didn't actually try to compile the stdlib
itself but only the tests). It's an announced goal for Cython 1.0 to
compile 'all' Python code,
Stefan Behnel added the comment:
New changeset b5d3ceea48c181b3e2c6c67424317afed606bd39 by Stefan Behnel in
branch 'master':
bpo-14465: Add an indent() function to xml.etree.ElementTree to pretty-print
XML trees (GH-15200)
https://github.com/python/cpyt
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
Sounds like a good idea to add something like this.
Have a look here for some more ideas:
https://github.com/lxml/lxml/blob/master/tools/xpathgrep.py
ElementTree should be able to provide most of these features as well these days.
--
stage: -> ne
Stefan Behnel added the comment:
Already fixed in later versions of the documentation:
https://docs.python.org/3/library/xml.etree.elementtree.html#supported-xpath-syntax
Note that Py3.4 is no longer maintained.
--
resolution: -> out of date
stage: -> resolved
status
Stefan Behnel added the comment:
I agree that formatting is not a use case by itself. I like the idea of XPath
grepping, though, especially *without* pretty printing, i.e. one result per
line.
I admit that there is no strong reason for adding such a command line tool to
the stdlib, though
Stefan Behnel added the comment:
I don't see anything inherently wrong with having multiple text nodes.
In fact, input with very large text content can be considered a security threat
(c.f. compression bombs), so a tool like pulldom (which is designed for
incremental processing) shoul
Stefan Behnel added the comment:
Let's just deprecate it directly (in Py3.9, I guess), given that it was never
documented.
--
___
Python tracker
<https://bugs.python.org/is
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
New changeset 7d952ded6813c896ea3f4234bb8db5247dcb5484 by Stefan Behnel (Gordon
P. Hemsley) in branch 'master':
bpo-32424: Deprecate xml.etree.ElementTree.Element.copy() in favor of
copy.copy() (GH-12995)
https://github.com/python/cpyt
Stefan Behnel added the comment:
I agree that it's surprising to get a low-level parser error from a high-level
library like xmlrpc. I think this can be changed without deprecation, because
users must expect exceptions from the xmlrpc library in any case.
Targeting to Py3.9, needs
Stefan Behnel added the comment:
Arguably, writing out "b'x'" as attribute name instead of raising an exception
isn't ideal. However, OTOH, I think it's reasonable to accept anything that is
serialisable as a string, not just strings. That makes it difficult
Change by Stefan Behnel :
--
versions: +Python 3.9 -Python 3.4, Python 3.5, Python 3.6
___
Python tracker
<https://bugs.python.org/issue33187>
___
___
Python-bug
Change by Stefan Behnel :
--
versions: -Python 3.7
___
Python tracker
<https://bugs.python.org/issue33187>
___
___
Python-bugs-list mailing list
Unsubscribe:
Stefan Behnel added the comment:
New changeset 97b817eae34b77be1ced382e15098a112f547848 by Stefan Behnel (Anjali
Bansal) in branch 'master':
bpo-33187: Document ElementInclude (XInclude) support in ElementTree (GH-8861)
https://github.com/python/cpyt
Stefan Behnel added the comment:
New changeset 6cf0ba8a632b1c0bd3576ed33c971ca3778000de by Stefan Behnel (Miss
Islington (bot)) in branch '3.8':
bpo-33187: Document ElementInclude (XInclude) support in ElementTree (GH-8861)
(GH-15958)
https://github.com/python/cpyt
Change by Stefan Behnel :
--
versions: +Python 3.7
___
Python tracker
<https://bugs.python.org/issue33187>
___
___
Python-bugs-list mailing list
Unsubscribe:
Stefan Behnel added the comment:
New changeset 195dc142f84804ad9c8ce91414ab4a0bf9615f09 by Stefan Behnel (Miss
Islington (bot)) in branch '3.7':
bpo-33187: Document ElementInclude (XInclude) support in ElementTree (GH-8861)
(GH-15972)
https://github.com/python/cpyt
New submission from Stefan Behnel :
The current documentation of the PyType_Spec struct lists a "doc" member which
does not exist. It should be removed from the docs.
https://docs.python.org/3.8/c-api/type.html#c.PyType_Spec
--
assignee: docs@python
components: Documentatio
Change by Stefan Behnel :
--
stage: -> needs patch
___
Python tracker
<https://bugs.python.org/issue38158>
___
___
Python-bugs-list mailing list
Unsubscrib
Stefan Behnel added the comment:
Absolutely, Tahia. It just needs a PR with a doc update.
--
___
Python tracker
<https://bugs.python.org/issue38158>
___
___
Stefan Behnel added the comment:
I think access to the global module state is the most critical for an
extension, probably by far. A direct pointer to the interpreter state from
every type feels like an optimisation that may be premature at this point.
Modules should have that reference
Stefan Behnel added the comment:
New changeset b65be6cd3d9b6102227d27f4f35385f999a7dd7d by Stefan Behnel (Miss
Islington (bot)) in branch '3.8':
bpo-38158: Removing nonexistant member "doc" from PyType_Spec documentation
(GH-16142) (GH-16154)
https://github.com/p
Change by Stefan Behnel :
--
keywords: -patch
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
My usual first reaction is: "if you need to find out whether the return value
of a callable will be an Awaitable or not, without calling it, then you're
probably doing something wrong in your design".
However,
a) there is code that tries this
Stefan Behnel added the comment:
> along with the appropriate CO_COROUTINE flag set
No, it never did that, for safety reasons. It's difficult to say if enabling
these flags is the right thing to do, because it's unclear what assumptions
code that tests for them would make. In C
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
Almost certainly not a bug in CPython's stdlib.
Possibly something worth investigating in lxml, although, as stated in issue
43618, random.shuffle() simply does not work on lxml.etree Elements.
--
resolution: -> third party
stage: -&g
Stefan Behnel added the comment:
Yes, this is neither a bug in CPython (or its stdlib) nor in lxml. It's how
things work. Don't use these two together.
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Stefan Behnel added the comment:
These macros are a sort-of documented part of the C-API. At least, they were
mentioned in a What's New document:
https://docs.python.org/3/whatsnew/2.7.html?highlight=py_isspace#build-and-c-api-changes
They were added here, for the Py2.7 release:
Stefan Behnel added the comment:
> why /shouldn't/ we make the change?
It breaks doctests, and probably some other unit tests, too, e.g. for output
formatting.
What should we suggest users to do? Replace
>>> get_flag(…)
by
>>> get_flag(…) == app_enu
Stefan Behnel added the comment:
The macros were moved to "Includes/cpython/", not to "Includes/internal/". That
suggests to me that they should use "extern C", so that C++ code that wants to
make use of CPython internals can use them.
Basically, the way I
Stefan Behnel added the comment:
I support that there should be a simple way to do this from C. The way via
importing the "gc" module and then looking up an attribute (possibly building a
Unicode string) and calling a function in it involves several operations that
can take som
Stefan Behnel added the comment:
Coming back to this after a while. I would like to get rid of the work-around
(read: huge hack) that we have in Cython for this check and thus would ask for
the check to be removed in Py3.10.
According to the discussion, no-one seemed to remember why it was
New submission from Stefan Behnel :
The documentation of the PyContextVar C-API is unclear in a couple of places.
- It's not clear whether PyContextVar_Get() always returns an owned reference
also for default values or only if a value was found.
- It's not explicit that "opt
Change by Stefan Behnel :
--
keywords: +patch
pull_requests: +24362
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25671
___
Python tracker
<https://bugs.python.org/issu
Change by Stefan Behnel :
--
nosy: +scoder
nosy_count: 3.0 -> 4.0
pull_requests: +24377
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/25687
___
Python tracker
<https://bugs.python.org/i
Stefan Behnel added the comment:
I just remembered that it's usually helpful to return the previous state, so
that callers know whether they need to re-enable or disable the GC when they're
done. I'll add that.
Also, returning an "int" may allow us to add a &quo
Stefan Behnel added the comment:
New changeset fdb11897d7c8f9e6bdf96fcef802f784ef90f726 by Miss Islington (bot)
in branch '3.9':
bpo-43959: clarify the documentation of the PyContextVar C-API (GH-25671)
(GH-25689)
https://github.com/python/cpyt
Stefan Behnel added the comment:
New changeset ff7266efd0ef6b42dad30c9c0d210f843cc44f39 by Miss Islington (bot)
in branch '3.8':
bpo-43959: clarify the documentation of the PyContextVar C-API (GH-25671)
(GH-25690)
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
New submission from Stefan Behnel :
I'm not sure if I should consider this a bug, but I'd at least frown at the
behaviour, so I thought I'd bring this up here.
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
>>> 2**53 == float(2**53)
True
>>&
Change by Stefan Behnel :
--
nosy: +tim.peters
___
Python tracker
<https://bugs.python.org/issue44054>
___
___
Python-bugs-list mailing list
Unsubscribe:
Stefan Behnel added the comment:
> I really don't know why you would desire a different result.
I found it surprising that a comparison uses a different method of conversion
than the (obvious) user-side conversion, with a different outcome. This seems
to be implementation details
Stefan Behnel added the comment:
For the same reason that motivated this ticket, I think the functions should be
inline functions. They should also take the current thread-state as argument,
because that's probably known on the caller side already.
I guess a macro would be fine
Stefan Behnel added the comment:
Just a comment regarding the change to "PyCode_NewWithPosOnlyArgs()". As Pablo
mentioned, this has happened before. And that's OK! Exactly because this has
happened before, it's clearly not a part of the API that is meant to be stable.
Stefan Behnel added the comment:
I just noticed that new C-API functions are probably useless for Cython since I
think it will have to maintain the CFrame stack, so not to enable "use_tracing"
for the (Python) caller but the current (Cython) function. This then means that
we own T
Stefan Behnel added the comment:
Should we allow empty CFrame entries (with a NULL Frame pointer) that only use
their "use_tracing" flag? That would make it easy for code to append and remove
such an entry in order to temporarily disab
Change by Stefan Behnel :
--
Removed message: https://bugs.python.org/msg393667
___
Python tracker
<https://bugs.python.org/issue43760>
___
___
Python-bugs-list m
Stefan Behnel added the comment:
Just FYI, I applied the same changes to the quicktions [1] module, a Cython
compiled (and optimised) version of fractions.Fraction.
[1] https://github.com/scoder/quicktions/
The loss in performance for small values is much higher there, almost 2x for
the
Stefan Behnel added the comment:
After reading up a bit, version "X" should probably be rejected, whereas
"1.[0-9]+" is meant to be allowed also by a 1.0 parser, according to the spec:
https://www.w3.org/TR/REC-xml/#sec-prolog-dtd
"""
When an XML 1.0 p
Stefan Behnel added the comment:
Could you explain a bit why you want to subclass "PyModuleObject" in C? Why
isn't a Python subclass or an independent (non-module) C extension type enough?
--
___
Python tracker
<https://bugs.pyt
Change by Stefan Behnel :
--
components: +C API -Interpreter Core
type: -> enhancement
versions: +Python 3.11 -Python 3.5
___
Python tracker
<https://bugs.python.org/issu
Stefan Behnel added the comment:
I only just noticed that the original request is from 2015. My guess is that
this is a resolved problem, given the available options. I'll close this ticket
as outdated. Please comment if this is still an issue.
--
resolution: -> out of da
Stefan Behnel added the comment:
The obvious work-around is to not use a default namespace. The result is just a
visual difference, not a semantic one.
If someone wants to continue with the existing PR, I'll try to free some time
to review any improvements.
--
versions: +P
Change by Stefan Behnel :
--
pull_requests: +26868
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/28469
___
Python tracker
<https://bugs.python.org/issu
Stefan Behnel added the comment:
I created a PR from my last patch, inlining the unpacking of single digit
integers. Since most integers should fit into a single digit these days, this
is as fast a path as it gets.
https://github.com/python/cpython/pull/28469
--
versions: +Python
Stefan Behnel added the comment:
> The code in the examples given above are using `tstate->use_tracing` assuming
> that its meaning is to determine whether tracing is turned on or not.
No, actually not. It is using the field in the same way as CPython, simply
because most of this
Stefan Behnel added the comment:
> The patch looks fine, but it looks a bit like benchmark chasing. Is the speed
> of builtin sum() of a sequence of integers important enough to do this bit of
> inlining?
Given that we already accepted essentially separate loops for the int, f
Stefan Behnel added the comment:
New changeset debd80403721b00423680328d6adf160a28fbff4 by scoder in branch
'main':
bpo-24076: Inline single digit unpacking in the integer fastpath of sum()
(GH-28469)
https://github.com/python/cpython/commit/debd80403721b00423680328d6adf1
Stefan Behnel added the comment:
Original:
$ ./python -m timeit -s 'd = list(range(2**61, 2**61 + 1))' 'sum(d)'
500 loops, best of 5: 712 usec per loop
$ ./python -m timeit -s 'd = list(range(2**30, 2**30 + 1))' 'sum(d)'
2000 loops, best of 5: 1
Change by Stefan Behnel :
--
Removed message: https://bugs.python.org/msg402301
___
Python tracker
<https://bugs.python.org/issue24076>
___
___
Python-bugs-list m
Stefan Behnel added the comment:
Original:
$ ./python -m timeit -s 'd = list(range(2**61, 2**61 + 1))' 'sum(d)'
500 loops, best of 5: 712 usec per loop
$ ./python -m timeit -s 'd = list(range(2**30, 2**30 + 1))' 'sum(d)'
2000 loops, best of 5: 1
Stefan Behnel added the comment:
Hmm, thanks for insisting, Serhiy. I was accidentally using a debug build this
time. I'll make a PGO build and rerun the microbenchmarks.
--
___
Python tracker
<https://bugs.python.org/is
Stefan Behnel added the comment:
Old, with PGO:
$ ./python -m timeit -s 'd = list(range(2**61, 2**61 + 1))' 'sum(d)'
1000 loops, best of 5: 340 usec per loop
$ ./python -m timeit -s 'd = list(range(2**30, 2**30 + 1))' 'sum(d)'
2000 loops, be
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
Sorry for that, Pablo. I knew exactly where the problem was, the second I read
your notification. Thank you for resolving it so quickly.
--
___
Python tracker
<https://bugs.python.org/issue24
Stefan Behnel added the comment:
Duplicate of issue 9521 (and issue 24287).
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> xml.etree.ElementTree skips processing instructions when parsing
___
Py
Stefan Behnel added the comment:
New changeset c6a7bdb356835c9d7513b1ea6846683d446fe6c3 by Stefan Behnel in
branch 'master':
bpo-20928: support base-URL and recursive includes in etree.ElementInclude
(#5723)
https://github.com/python/cpython/commit/c6a7bdb356835c9d7513b1ea684668
Stefan Behnel added the comment:
I think setting "xml:base" from ElementInclude is worth another ticket.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9 -Python 3.8
___
Pyt
Change by Stefan Behnel :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
Agreed that both should behave the same.
And, we should finally decide whether this should really be changed or not. The
current behaviour is counter-intuitive, but it's been like that forever and
lots of code depends on it in one way or anothe
101 - 200 of 1287 matches
Mail list logo