Carl Friedrich Bolz-Tereick added the comment:
Somebody pointed me to V8's implementation of str(bigint) today:
https://github.com/v8/v8/blob/main/src/bigint/tostring.cc
They say that they can compute str(factorial(1_000_000)) (which is 5.5 million
decimal digits) in 1.5s:
Carl Friedrich Bolz-Tereick added the comment:
Ok, I can definitely agree with Serhiy pov: "True" is a keyword that always
evaluates to the object that you get when you call bool(1). There is usually no
name "True" and directly assigning to it is forbidden. But there are
Carl Friedrich Bolz-Tereick added the comment:
hah, this is "great":
>>> 𝕋𝕣𝕦𝕖 = 1
>>> globals()
{'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__':
, '__spec__': None,
Carl Friedrich Bolz-Tereick added the comment:
Or, in other words, in my opinion this is the root cause of the bug:
class Base:
def __init_subclass__(cls):
global broken_class
broken_class = cls
assert 0
try:
class Broken(Base): pass
except: pass
assert
Carl Friedrich Bolz-Tereick added the comment:
hm, I think I figured it out. The root cause is that even though the creation
of the class Triffid fails, it can still be found via Animal.__subclasses__(),
which the special subclass logic for ABCs is looking at. Triffid fills its
_abc_impl
Carl Friedrich Bolz-Tereick added the comment:
Oh, don't worry, it's all good! It got fixed and I learned something.
--
___
Python tracker
<https://bugs.python.o
Carl Friedrich Bolz-Tereick added the comment:
ah, confused, seems you fixed them both too. will take a closer look!
--
___
Python tracker
<https://bugs.python.org/issue46
Carl Friedrich Bolz-Tereick added the comment:
Oh no, I was about to open mine ;-)
https://github.com/python/cpython/compare/main...cfbolz:bpo-46042-syntax-error-range-duplicate-argument?expand=1
Basically equivalent, but I fixed the second bug too (would be very easy to add
to yours
Carl Friedrich Bolz-Tereick added the comment:
let's see whether I promised too much, I don't know CPython's symtable.c too
well yet ;-). Will shout for help when I get stuck.
Anyway, here is a related bug, coming from the same symtable function
symtable_add_def_helpe
New submission from Carl Friedrich Bolz-Tereick :
The error range for the "duplicate argument in function definition" SyntaxError
is too large:
$ cat x.py
def f(a, b, c, d, e, f, g, a): pass
$ python x.py
File "/home/cfbolz/projects/cpython/x.py", line 1
def f(a,
Change by Carl Friedrich Bolz-Tereick :
--
pull_requests: +28252
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/30027
___
Python tracker
<https://bugs.python.org/issu
Carl Friedrich Bolz-Tereick added the comment:
I ran into this problem in PyPy today, preparing a patch for CPython too
(without looking at the old one).
--
nosy: +Carl.Friedrich.Bolz
___
Python tracker
<https://bugs.python.org/issue37
Change by Carl Friedrich Bolz-Tereick :
--
keywords: +patch
pull_requests: +27929
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/29691
___
Python tracker
<https://bugs.python.org/issu
New submission from Carl Friedrich Bolz-Tereick :
test_field_descriptor in test_collections tries to pickle the descriptors of a
namedtuple's fields, which is _collections._itemgetter on CPython. However, on
PyPy that class doesn't exist. The code in collections deals fine with
Carl Friedrich Bolz-Tereick added the comment:
ouch, apologies for not checking that!
--
___
Python tracker
<https://bugs.python.org/issue45781>
___
___
Pytho
New submission from Carl Friedrich Bolz-Tereick :
Right now, deleting __debug__ is not prevented:
>>> def f():
... del __debug__
...
Of course actually executing it doesn't work:
>>> del __debug__
Traceback (most recent call last):
File "", line 1, i
Change by Carl Friedrich Bolz-Tereick :
--
keywords: +patch
pull_requests: +27735
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/29484
___
Python tracker
<https://bugs.python.org/issu
New submission from Carl Friedrich Bolz-Tereick :
Something I see beginners make occasionally when defining functions without
arguments is this:
def f:
...
Right now it just gives an "invalid syntax", would be nice to get an "expected
'('".
I will try
New submission from Carl Friedrich Bolz-Tereick :
I found following inconsistency in the error message when there's a missing
comma (it behaves that way both on main and 3.10).
Here's what happens with numbers, as expected:
Python 3.11.0a1+ (heads/main:32f55d1a5d, Nov 5 2021, 13:1
New submission from Carl Friedrich Bolz-Tereick :
A bit of a nitpick, but the following SyntaxError message is a bit confusing:
>>> f(True=1)
File "", line 1
f(True=1)
^
SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
Change by Carl Friedrich Bolz-Tereick :
--
keywords: +patch
pull_requests: +27496
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/29233
___
Python tracker
<https://bugs.python.org/issu
Carl Friedrich Bolz-Tereick added the comment:
here's the traceback running on pypy3.9-alpha:
==
FAIL: test_simple_cases (test.test_graphlib.TestTopologica
New submission from Carl Friedrich Bolz-Tereick :
test_graphlib fails on PyPy because it depends on the iteration order of sets.
Will open a PR soon.
--
messages: 405084
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: test_graphlib.py depends on
Carl Friedrich Bolz-Tereick added the comment:
PyPy raises a RecursionError here, which sounds like an ok outcome. So simply
checking for the recursion would also be a way of fixing this...
--
nosy: +Carl.Friedrich.Bolz
___
Python tracker
<ht
Carl Friedrich Bolz-Tereick added the comment:
I fixed the reliance of set being insertion ordered in pypy and opened a pull
request.
--
___
Python tracker
<https://bugs.python.org/issue45
Change by Carl Friedrich Bolz-Tereick :
--
nosy: +Carl.Friedrich.Bolz
nosy_count: 6.0 -> 7.0
pull_requests: +27198
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28907
___
Python tracker
<https://bugs.p
Carl Friedrich Bolz-Tereick added the comment:
Thanks for your work Tim, just adapted the changes to PyPy's Timsort, using
bits of runstack.py!
--
nosy: +Carl.Friedrich.Bolz
___
Python tracker
<https://bugs.python.org/is
Change by Carl Friedrich Bolz-Tereick :
--
nosy: +Carl.Friedrich.Bolz
nosy_count: 6.0 -> 7.0
pull_requests: +26460
pull_request: https://github.com/python/cpython/pull/28002
___
Python tracker
<https://bugs.python.org/issu
Change by Carl Friedrich Bolz-Tereick :
--
keywords: +patch
pull_requests: +24221
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25501
___
Python tracker
<https://bugs.python.org/issu
New submission from Carl Friedrich Bolz-Tereick :
The new codepath for the BYTEARRAY8 bytecode is missing memoization:
>>> import pickletools, pickle
>>> b = (bytearray(b"abc"), ) * 2
>>> b1, b2 = pickle.loads(pickle.dumps(b, 5)) # C version
>>&g
Carl Friedrich Bolz-Tereick added the comment:
@shreyanavigyan This is a bit off-topic, but it's called "short-circuiting",
described here:
https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not
(or/and aren't really "operators", like +/-
Carl Friedrich Bolz-Tereick added the comment:
It's not just about keywords. Eg '1x' tokenizes too but then produces a syntax
error in the parser. Keywords are only special in that they can be used to
write syntactically meaningful things with these concatenated numbers.
Carl Friedrich Bolz-Tereick added the comment:
yes, that sounds fair. In PyPy we improve things occasionally if somebody feels
like working on it, but in general competing against GMP is a fools errand.
--
___
Python tracker
<ht
Carl Friedrich Bolz-Tereick added the comment:
FWIW, we have implemented a faster algorithm for divmod for big numbers using
Mark's fast_div.py in PyPy. In particular, this speeds up str(long) for large
numbers significantly (eg calling str on the result of math.factorial(2**17) is
no
Carl Friedrich Bolz-Tereick added the comment:
Just chiming in to say that for PyPy this API would be extremely useful,
because PyPy's "is" is not implementable with a pointer comparison on the C
level (due to unboxing we need to compare integers, floats, etc by value)
Carl Friedrich Bolz-Tereick added the comment:
> BTW, this initialization in the FASTSEARCH code appears to me to be a
> mistake:
>skip = mlast - 1;
Thanks for pointing that out Tim! Turns out PyPy had copied that mindlessly and
I just fixed it.
(I'm also generally f
New submission from Carl Friedrich Bolz-Tereick :
When using code.InteractiveConsole to implement a Python shell (like PyPy is
doing), having a broken sys.excepthook set can crash the console (see attached
terminal log). Instead, it should catch errors and report then ignore them
(using
Change by Carl Friedrich Bolz-Tereick :
--
nosy: +Carl.Friedrich.Bolz
___
Python tracker
<https://bugs.python.org/issue43148>
___
___
Python-bugs-list mailin
Carl Friedrich Bolz-Tereick added the comment:
It's still inconsistent between the two ways to get a traceback, and the
inconsistency is not documented.
--
___
Python tracker
<https://bugs.python.org/is
Carl Friedrich Bolz-Tereick added the comment:
Ok, that means it's intentional. I still think it's missing a documentation
change and consistent error messages.
--
___
Python tracker
<https://bugs.python.o
New submission from Carl Friedrich Bolz-Tereick :
The following behaviour of %-formatting changed between Python3.6 and
Python3.7, and is in my opinion a bug that was introduced.
So far, it has been possible to add conversion flags to a conversion specifier
in %-formatting, even if the
Change by Carl Friedrich Bolz-Tereick :
--
keywords: +patch
pull_requests: +17629
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/18252
___
Python tracker
<https://bugs.python.org/issu
New submission from Carl Friedrich Bolz-Tereick :
One of the new-in-3.8 tests for unittest.mock,
test_spec_has_descriptor_returning_function, is failing on PyPy. This exposes a
bug in unittest.mock. The bug is most noticeable on PyPy, where it can be
triggered by simply writing a slightly
Carl Friedrich Bolz-Tereick added the comment:
I don't have a particularly deep opinion on what should be done, just a bit of
weirdness I hit upon while implementing the PEP in PyPy. fwiw, we implement it
as an AST transformer that the compiler runs before running the optimizer to
make
New submission from Carl Friedrich Bolz-Tereick :
PEP 563 interacts in weird ways with constant folding. running the following
code:
```
from __future__ import annotations
def f(a: 5 + 7) -> a ** 39:
return 12
print(f.__annotations__)
```
I would expect this output:
```
{'a&
New submission from Carl Friedrich Bolz-Tereick :
The meaning of sys.tracebacklimit seems to be different than the meaning of the
various limit parameters in the traceback module. One shows the top n stack
frames, the other the bottom n.
Is this intentional, and if yes, is that difference
Change by Carl Friedrich Bolz-Tereick :
--
pull_requests: +14466
pull_request: https://github.com/python/cpython/pull/14659
___
Python tracker
<https://bugs.python.org/issue18
Change by Carl Friedrich Bolz-Tereick :
--
pull_requests: +14423
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/14607
___
Python tracker
<https://bugs.python.org/issu
Carl Friedrich Bolz-Tereick added the comment:
I think the attached patch fixes the problem. Will create a pull request soon.
--
versions: +Python 3.5 -Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48458/binop-offset.patch
Carl Friedrich Bolz added the comment:
OK, fair enough. That means right now there is no way to find the position of
the operator using the ast module at the moment, correct?
--
___
Python tracker
<https://bugs.python.org/issue18
Carl Friedrich Bolz added the comment:
FWIW, in my opinion the col_offsets of the two nodes should be 1 and 3,
respectively (the positions of the operators).
--
nosy: +Carl.Friedrich.Bolz
___
Python tracker
<https://bugs.python.org/issue18
New submission from Carl Friedrich Bolz :
The list.index method does not accept None as start and stop, which makes the
error message quite confusing:
>>> [1, 2, 3].index(2, None, None)
Traceback (most recent call last):
File "", line 1, in
TypeError: slice indices must
Changes by Carl Friedrich Bolz :
--
nosy: +Carl.Friedrich.Bolz
___
Python tracker
<http://bugs.python.org/issue12422>
___
___
Python-bugs-list mailing list
Unsub
Changes by Carl Friedrich Bolz :
--
nosy: +cfbolz
___
Python tracker
<http://bugs.python.org/issue11477>
___
___
Python-bugs-list mailing list
Unsubscribe:
Carl Friedrich Bolz added the comment:
[...]
> Would the bool/int distinction matter to PyPy?
No, it's really mostly about longs and ints, because RPython does not
have automatic overflowing of ints to longs (the goal is really to
translate ints them to C longs with normal C
Carl Friedrich Bolz added the comment:
PyPy is a bit of a special case, because it cares about the distinction
of int and long in the translation toolchain. Nevertheless, this
behavior has been annoying to us.
--
nosy: +cfbolz
___
Python tracker
Carl Friedrich Bolz added the comment:
[...]
> How did you encounter this in the first place?
I was working on PyPy's marshaler, broke it in such a way that it was
producing the bad input that I gave above. Then I fixed it, but didn't
kill my .pyc files. So a few days later I go
Carl Friedrich Bolz added the comment:
Yes, I know :-). I thought I'd report it anyway, as it does more than
"just" give you random behavior, but actually produces a broken object.
--
___
Python tracker
<http://bugs.py
Changes by Carl Friedrich Bolz :
--
nosy: +benjamin.peterson
___
Python tracker
<http://bugs.python.org/issue7019>
___
___
Python-bugs-list mailing list
Unsub
New submission from Carl Friedrich Bolz :
When unmarshalling a hand-written string it is possible to break the
invariants of longs:
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "l
New submission from Carl Friedrich Bolz :
There seems to be a problem with some unicode character's title information:
$ python2.6
Python 2.6.2c1 (release26-maint, Apr 14 2009, 08:02:48)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "licen
New submission from Carl Friedrich Bolz <[EMAIL PROTECTED]>:
When trying to remove a set from a set, the KeyError that is raised is
confusing:
Python 2.6 (r26:66714, Oct 7 2008, 13:23:57)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "
New submission from Carl Friedrich Bolz:
When trying to delete the .value member of ctypes simple types my python
interpreter segfaults:
$ python
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help",
New submission from Carl Friedrich Bolz:
Marshal does not round-trip unicode surrogate pairs for wide unicode-builds:
marshal.loads(marshal.dumps(u"\ud800\udc00")) == u'\U0001'
This is very annoying, because the size of unicode constants differs
between when you run a
64 matches
Mail list logo