Stefan Behnel added the comment:
Well … yes.
The exception fields are performance critical, and we try hard to make them
visible to the C compiler so that swapping around exception state eats up as
little CPU time as possible.
You could argue that profiling and tracing are less critical
New submission from Stefan Pochmann:
The notes at
https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not
say that `or` "only evaluates the second argument if the first one is False"
and that `and` "only evaluates the second argument if the first one is
Stefan Krah added the comment:
For '%b', it looks like the PEP supports it. I didn't follow the PEP
discussions, I think Ethan will know more.
--
___
Python tracker
<http://bugs.pyt
Stefan Krah added the comment:
Not right now, but if anyone makes a PR I can click the merge button. :)
--
___
Python tracker
<http://bugs.python.org/issue24
Stefan Krah added the comment:
Thanks for the PR! -- Merged.
--
assignee: -> skrah
components: +Library (Lib)
resolution: -> fixed
stage: patch review -> resolved
versions: +Python 3.7
___
Python tracker
<http://bugs.python.or
Changes by Stefan Krah :
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue24622>
___
___
Python-bugs-list mailing list
Unsubscrib
Stefan Krah added the comment:
Does anyone know how to disable the spurious pull requests that keep coming in?
--
___
Python tracker
<http://bugs.python.org/issue29
Stefan Krah added the comment:
Merged, thank you.
--
assignee: -> skrah
nosy: +skrah
resolution: -> fixed
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python
Stefan Krah added the comment:
New changeset 2c0b5c664ba7d36dc09788d3778d5b33e3fa1bd0 by Stefan Krah (Marco
Buttu) in branch 'master':
bpo-30055: add testcleanup to leave a fresh context (#1094)
https://github.com/python/cpython/commit/2c0b5c664ba7d36dc09788d3778d5b
Stefan Krah added the comment:
Thanks, looks good. (I hope GitHub runs the doctests at Travis CI, locally
most of them failed so I didn't bother to run the tests for this one.)
--
assignee: docs@python -> skrah
resolution: -> fixed
stage: -> resolved
status:
Stefan Krah added the comment:
Ok great, maybe I'll take a look.
--
___
Python tracker
<http://bugs.python.org/issue30055>
___
___
Python-bugs-list m
Stefan Krah added the comment:
I thought splitting off abc was done for performance reasons (reduce the number
of imports at Python startup), not for more idiomatic code.
--
nosy: +skrah
___
Python tracker
<http://bugs.python.org/issue30
Changes by Stefan Krah :
--
nosy: -skrah
___
Python tracker
<http://bugs.python.org/issue28769>
___
___
Python-bugs-list mailing list
Unsubscribe:
Stefan Krah added the comment:
I'm with Nathaniel here: The fixed-bug is probably too obscure to warrant ABI
breakage.
--
nosy: +skrah
___
Python tracker
<http://bugs.python.org/is
Stefan Krah added the comment:
There are 100 results in Google books alone. Are the books wrong (honest
question, I did not check)?
They will be wrong if we remove it. ;)
I agree with Michael that assertNotAlmostEqual() doesn't hurt.
--
nosy: +
Stefan Krah added the comment:
> Do these books have any use cases for assertNotAlmostEqual() or just
> enumerate the list of TestCase methods?
I think this should be researched by the proponent of the change.
--
___
Python tracker
Changes by Stefan Krah :
--
nosy: -skrah
___
Python tracker
<http://bugs.python.org/issue30221>
___
___
Python-bugs-list mailing list
Unsubscribe:
Stefan Behnel added the comment:
Looks good to me (didn't test it).
Note that getchildren() is not deprecated in lxml because it's actually the
fastest way to build a list of the children. It's faster than list(element)
because it avoids the Python (C-level) iteration overhead
Stefan Behnel added the comment:
Thanks for bringing me in. The PoC implementation looks nice. Whether I'd like
to support this in Cython? Absolutely. Requires some work, though, since Cython
still doesn't implement PEP 489. But it shouldn't be hard, if I remember the
discus
Stefan Krah added the comment:
I guess since it's documented, it would be ok to change for 3.7. BTW, we also
allow "static inline" now in headers, so perhaps we could make it a function.
--
nosy: +skrah
___
Python tracker
<http
Stefan Behnel added the comment:
Agreed that this should be added. I think the key should be None, though, not
the empty string. I attached a quick patch for lxml's corresponding file. It's
mostly the same for ET.
--
keywords: +patch
Added file: http://bugs.python.org
Changes by Stefan Behnel :
Removed file: http://bugs.python.org/file46906/lxml_elpath_empty_prefix.patch
___
Python tracker
<http://bugs.python.org/issue30485>
___
___
Stefan Behnel added the comment:
Patch replaced by pull request.
https://github.com/python/cpython/pull/1823
--
___
Python tracker
<http://bugs.python.org/issue30
New submission from Stefan Seefeld:
The following code is supposed to catch and report errors encountered during
the execution of a (python) script:
```
import traceback
import sys
try:
env = {}
with open('script') as f:
exec(f.read(), env)
except:
type_,
Stefan Seefeld added the comment:
Some further experiements:
Replacing the `exec(f.read(), env)` line by
```
code = compile(f.read(), 'script', 'exec')
exec(code, env)
```
exhibits the same behaviour. If I remove the `try...except`, the correct
(full) traceback is printed o
Stefan Seefeld added the comment:
Answering my own question:
It appears I can get the location of a syntax error by inspecting the
raised `SyntaxError`, which solves my specific use-case.
The bug remains, though: The traceback is incomplete if it stems from a syntax
error
Stefan Seefeld added the comment:
OK, fair enough, that makes sense. As I said, in my last message, I was mainly
simply trying to figure out the exact location of the error in the executed
script, which I got from inspecting the SyntaxError.
So if all of this is expected behaviour, I think we
Stefan Krah added the comment:
"Py_buffer view" is stack allocated. One can use memoryviews based on such
buffers *inside* a function, but not return them.
--
nosy: +skrah
___
Python tracker
<http://bugs.python.o
Stefan Krah added the comment:
"Py_buffer view" needs to go into the exporting object. That object needs a
getbufferproc(). That getbufferproc() can use PyBuffer_FillInfo() to fill in
the view that is now kept alive because it's in the object.
The object then supports the
Stefan Krah added the comment:
Sorry, actually I wasn't totally clear: The exporting object just needs a
getbufferproc() that can respond to buffer requests and keeps track of how many
views are exported.
"View in the object" is misleading and not necessary; it can be used for
New submission from Stefan Behnel:
I'm seeing doctest failures in Cython's test suite with Py3.7 due to the change
of an error message:
Failed example:
func1(arg=None)
Expected:
Traceback (most recent call last):
...
TypeError: func1() takes no keyword arg
Stefan Behnel added the comment:
I looked up this change again and was surprised that it still wasn't applied.
It feels to me that it makes sense already for reasons of consistency. Any time
frame for changing it? I'd like to use METH_FASTCALL in Cython in a
future
Stefan Krah added the comment:
> I'd like to use METH_FASTCALL in Cython in a future-proof way.
Also +1. Can we consider the API frozen after this issue or do we have to wait
for #29465 (or others)?
--
___
Python tracker
<http://bugs
Stefan Krah added the comment:
For third party projects who want to use FASTCALL the functions are not
generated by AC. I didn't understand the reasoning why the consistency
argument is weak.
--
___
Python tracker
<http://bugs.py
Stefan Behnel added the comment:
I do not see this as a matter of performance but as a matter of usability.
Basically, CPython could do just fine with just a single catch-all calling
convention that packs all pos/kw arguments into C arguments and passes them
over, leaving it entirely to the
Stefan Krah added the comment:
To expand on what Mark said: If the proposed format code implicitly
gives these results ...
>>> format(12 % 2**8, '08b')
'1100'
>>> format(-12 % 2**8, '08b')
'0100'
..., would students
Stefan Krah added the comment:
I just noticed that there are other differences, for example the "removal of
trailing zeros" passage does not apply to Decimal:
>>> format(Decimal("1.00e-6"), "g")
'0.0100'
Perhaps it would be e
Stefan Krah added the comment:
On the other hand, the docs say "insignificant trailing zeros are removed from
the significand", so technically it *is* correct, because trailing zeros are
significant in decimal.
--
___
Python track
New submission from Andrei Stefan :
I'm creating a shared dict for multiprocessing purposes:
from multiprocessing import Manager
manager = Manager()
shared_dict = manager.dict()
If I add a set or a list as a value in the dict:
shared_dict['test'] = set() or shared_dict[
Stefan Behnel added the comment:
> We already have a syntax for dict merging: {**d1, **d2}.
Which doesn't mean that "d1 + d2" isn't much more intuitive than this
special-character heavy version. It takes me a while to see the dict merge
under that heap of stars.
Stefan Behnel added the comment:
> should we also implement +/+= for sets?
The question is: what would that do? The same as '|=' ? That would be rather
confusing, I think. "|" (meaning: "or") seems a very natural operation for
sets, in the same way that
Stefan Behnel added the comment:
The feature seems reasonable to me and the patch looks good.
--
___
Python tracker
<https://bugs.python.org/issue36227>
___
___
Stefan Behnel added the comment:
lxml does not support the "default_namespace" option specifically (because its
tree model preserves namespace prefixes), but it generally makes all
(justifiable) serialisation options available to both tostring() and ET.write().
I think the same sh
Stefan Behnel added the comment:
While I do understand the interest in a bit more visual consistency (and,
lacking further input, I assume that this is the OP's "problem"), it really is
at best a purely visual improvement with the potential to break code and/or
tests out th
Change by Stefan Seefeld :
--
resolution: -> works for me
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
FWIW, I second Raymond's opposition against a new option. It's really not
something that users should care about. Instead of us providing a new "sort or
not" option, and people adding it (conditionally!) to their code to "fix"
p
Stefan Behnel added the comment:
Ned, would it solve your problem to write a helper function that walks the tree
and sorts the attrib dicts? That would also work in all existing CPython
versions (because they already sort attributes anyway), for both ElementTree
and lxml, and you wouldn
Stefan Behnel added the comment:
Something like this:
def sort_attributes(root):
for el in root.iter():
attrib = el.attrib
if len(attrib) > 1:
attribs = sorted(attrib.items())
attrib.clear()
attrib.update(attr
Stefan Behnel added the comment:
:) The coolest thing about it is: it's not a hack at all. It's simply making
use of the new feature in a suitable way.
--
___
Python tracker
<https://bugs.python.o
Stefan Behnel added the comment:
Victor, as much as I appreciate backwards compatibility, I really don't think
it's a big deal in this case. In fact, it might not even apply.
My (somewhat educated) gut feeling is that most users simply won't care or
won't even notic
Change by Stefan Behnel :
--
nosy: +scoder
___
Python tracker
<https://bugs.python.org/issue36346>
___
___
Python-bugs-list mailing list
Unsubscribe:
Stefan Behnel added the comment:
Thanks for implementing this, Serhiy.
Since these C macros are public, should they be named PY_* ?
--
___
Python tracker
<https://bugs.python.org/issue36
Stefan Behnel added the comment:
I think this is a good preparation that makes it clear what code will
eventually be removed, and allows testing without it.
No idea how happy Windows users will be about all of this, but I consider it
quite an overall improvement for the Unicode
Stefan Behnel added the comment:
I had also looked through the unrelated changes, and while, yes, they are
unrelated, they seemed to be correct and reasonable modernisations of the code
base while touching it. They could be moved to a separate PR, but there is a
relatively high risk of
Stefan Krah added the comment:
Thanks, but it is still not going to happen. Look at the increased code size
in e.g. blake2s_impl.c.h.
I want to know what is going on in the code. Also, the performance
improvements are in argument parsing, but not when you have numerical
code like a * b
Stefan Krah added the comment:
This occurs when handling a recursion error uses more than 50 extra nested
function calls:
if (tstate->overflowed) {
if (tstate->recursion_depth > recursion_limit + 50) {
/* Overflowing while handling an overflow
Stefan Krah added the comment:
It can still be an issue in CPython, like in #14537.
--
___
Python tracker
<https://bugs.python.org/issue36370>
___
___
Python-bug
Stefan Krah added the comment:
The tests pass here on Linux with 3.8 (cc60cdd9c4) and a very low
sys.setrecursionlimit(150).
The fail properly with RecursionError at sys.setrecursionlimit(125).
So I guess we'd need a gdb stack trace from OS X in case there's a CPython
issue th
Stefan Krah added the comment:
Whoops, I tested the wrong branch, getting a proper abort() now. :)
--
___
Python tracker
<https://bugs.python.org/issue36
Stefan Krah added the comment:
The issue is that PyImport_GetModule() can legitimately NULL (not found)
but also NULL after an error occurred in PyDict_GetItemWithError().
So one (quick and dirty) approach that fixes this abort() is:
diff --git a/Python/import.c b/Python/import.c
index
Change by Stefan Krah :
--
stage: -> needs patch
___
Python tracker
<https://bugs.python.org/issue36370>
___
___
Python-bugs-list mailing list
Unsubscrib
Stefan Krah added the comment:
Actually I just see that this behavior of PyImport_GetModule() is documented:
"Return the already imported module with the given name. If the module has not
been imported yet then returns NULL but does not set an error. Returns NULL and
sets an error i
Stefan Krah added the comment:
Like Josh I don't quite understand the problem description. This
for example works:
>>> class C(int):
... def __ipow__(self, other, mod=None):
... return pow(self, other, mod)
...
>>>
>>> x = C(10)
>>> x
1
Stefan Krah added the comment:
Ok, got it. I think __ipow__ should be a ternaryfunc, like so:
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 403f3caaee..914d076b5c 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -7032,7 +7032,7 @@ static slotdef slotdefs
Change by Stefan Krah :
--
stage: -> needs patch
___
Python tracker
<https://bugs.python.org/issue36379>
___
___
Python-bugs-list mailing list
Unsubscrib
Stefan Behnel added the comment:
I concur with Serhiy that the bug is in OpenCV (or its parser project), and
that it is best solved there. Otherwise, we would create a dependency on a
future/recent Python version for exporting XML to it
Stefan Behnel added the comment:
As a work-around, you can provide your own XML declaration (or not) and pass
"xml_declaration=False" into ElementTree.write() to prevent it from adding one.
UTF-8 encoded XML is ok without such a d
Stefan Krah added the comment:
I think the problem is still whether to use 'u' == UCS2 and 'w' == UCS4 like in
PEP-3118.
For the project I'm currently working on I'd need these for buffer exports:
>>> from xnd import *
>>> x = xnd(["a
Stefan Krah added the comment:
Just to demonstrate what the format would look like, this is working
for an array of fixed bytes:
>>> x = xnd([b"123", b"23456"], dtype="fixed_bytes(size=10)")
>>> memoryview(x).format
'10s'
So t
Stefan Krah added the comment:
array() uses struct module characters except for 'u'. PEP-3118 was
supposed to be implemented in the struct module.
If array() continues to use 'u', the only sensible thing would be
to remove (or rename) 'a
Stefan Krah added the comment:
The funny thing is that array() already knows this:
>>> import array
>>> a = array.array("u", "123")
>>> memoryview(a).format
'w'
--
__
Change by Stefan Krah :
--
keywords: +patch
pull_requests: +12454
stage: needs patch -> patch review
___
Python tracker
<https://bugs.python.org/issu
Stefan Behnel added the comment:
Yes, this case is incorrect. Pretty printing should not change character
content inside of a simple tag.
The PR looks good to me.
--
versions: +Python 3.8
___
Python tracker
<https://bugs.python.org/issue36
Stefan Krah added the comment:
New changeset 027b09c5a13aac9e14a3b43bb385298d549c3833 by Stefan Krah in branch
'master':
bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)
https://github.com/python/cpython/commit/027b09c5a13aac9e14a3b43bb38529
Stefan Krah added the comment:
New changeset cdd8d4d6dd57f4c9429566706009d4613277d391 by Stefan Krah (Miss
Islington (bot)) in branch '3.7':
bpo-36370: Check for PyErr_Occurred() after PyImport_GetModule() (GH-12504)
https://github.com/python/cpyt
Stefan Krah added the comment:
It looks like 3.6 is in security-fix only mode, so it cannot be backported
there.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7 -Python 3.6
___
Pytho
Stefan Behnel added the comment:
I don't think this should be backported. Pretty-printing is not a production
relevant feature, more of a "debugging, diffing and help users see what they
get" kind of feature. It's good to have it fixed for the future, but we
shouldn
Stefan Behnel added the comment:
It's currently implemented as a positional argument, not a keyword argument.
Thus the "/" at the end of the signature in the help text. That also suggests
that it was a conscious decision, not an oversight. Personally, I'd also prefer
it
Stefan Behnel added the comment:
Yes, duplicate of issue34637.
--
___
Python tracker
<https://bugs.python.org/issue36491>
___
___
Python-bugs-list mailin
Stefan Behnel added the comment:
Thanks to the discussion that rhettinger triggered on python-dev, it seems that
there is a majority accordance for considering the previous ordering "undefined
but deterministic" rather than "sorted", and for making the change from
&qu
New submission from Stefan Behnel :
I recently read a paper¹ about the difficulty of calculating the most exact
midpoint between two floating point values, facing overflow, underflow and
rounding errors. The intention is to assure that the midpoint(a,b) is
- actually within the interval [a,b
Stefan Behnel added the comment:
I buy the YAGNI argument and won't fight for this. Thanks for your input.
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.pyth
New submission from Stefan Hölzl :
adding a future_factory argument to Thread/ProcessPoolExecutor to control which
type of Future should be created by Executor.submit
--
components: Library (Lib)
messages: 339364
nosy: stefanhoelzl
priority: normal
severity: normal
status: open
title
Change by Stefan Hölzl :
--
keywords: +patch
pull_requests: +12596
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36512>
___
___
Py
Stefan Behnel added the comment:
Seems like a reasonable request to me, even if it hasn't been touched or
re-requested for years.
Funny enough, DocumentFragment is currently documented as "not implemented" (as
for Entity, Notation, CDATASection, CharacterData, DO
Change by Stefan Behnel :
--
keywords: +patch
pull_requests: +12604
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue9883>
___
___
Py
Change by Stefan Behnel :
--
nosy: +scoder
___
Python tracker
<https://bugs.python.org/issue34396>
___
___
Python-bugs-list mailing list
Unsubscribe:
Stefan Behnel added the comment:
This is done now. Thanks everyone who helped in discussing and implementing
this change.
I will leave Serhiy's last PR (adding the "sort_attrs" flag option) open for a
while until I'm sure we have a better solution for comparing XML in 3.
Stefan Krah added the comment:
gcc warns with -pedantic:
ptr.c: In function ‘main’:
ptr.c:5:13: warning: format ‘%p’ expects argument of type ‘void *’, but
argument 2 has type ‘int *’ [-Wformat=]
printf ("%p", &i);
It is pedantic indeed, I wonder if machines with dif
Stefan Krah added the comment:
Yes, I'd think the decisions are deliberate.
Floats follow printf(), this is from the manual for 'e':
"The exponent always contains at least two digits; if the value is zero, the
exponent is 00."
And decimal follows t
Stefan Behnel added the comment:
New changeset ffca16e25a70fd44a87b13b379b5ec0c7a11e926 by Stefan Behnel (Bernt
Røskar Brenna) in branch 'master':
bpo-36227: ElementTree.tostring() default_namespace and xml_declaration
arguments (GH-12225)
https://github.com/python/cpyt
Stefan Behnel added the comment:
New changeset e9927e1820caea01e576141d9a623ea394d43dad by Stefan Behnel in
branch 'master':
bpo-30485: support a default prefix mapping in ElementPath by passing None as
prefix (#1823)
https://github.com/python/cpyt
Stefan Behnel added the comment:
I've merged the PR. It matches the implementation that has been released in
lxml almost two years ago.
--
resolution: -> fixed
stage: -> resolved
status: open -> closed
versions: +Python 3
Stefan Behnel added the comment:
Thank you for you contribution.
--
components: +XML
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
PR looks good to me. Doesn't look critical enough for a backport, though.
--
nosy: +scoder
versions: -Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/is
Stefan Behnel added the comment:
New changeset 929b70473829f04dedb8e802abcbd506926886e1 by Stefan Behnel
(Mickaël Schoentgen) in branch 'master':
bpo-31658: Make xml.sax.parse accepting Path objects (GH-8564)
https://github.com/python/cpython/commit/929b70473829f04dedb8e802abcbd5
Change by Stefan Behnel :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Stefan Behnel added the comment:
Thanks for your contribution.
--
___
Python tracker
<https://bugs.python.org/issue31658>
___
___
Python-bugs-list mailin
Stefan Behnel added the comment:
The intended interface seems to be to change .name rather than .localName, so
yes, that should be documented somewhere.
The implementation seems a bit funny in that a "self._localName", if set, takes
precedence, but there doesn't seem to be
Change by Stefan Behnel :
--
pull_requests: +12755
___
Python tracker
<https://bugs.python.org/issue30485>
___
___
Python-bugs-list mailing list
Unsubscribe:
1801 - 1900 of 4951 matches
Mail list logo