Carl Meyer added the comment:
Thanks for the extended example.
I think in order for this example to answer the question I asked, a few more
assumptions should be made explicit:
1) Either `spam_var` and/or `eggs_var` are frequently re-bound to new values in
a hot code path somewhere. (Given
Carl Meyer added the comment:
> There should not be much of a slowdown for this code when watching `CONST`:
How and when (and based on what data?) would the adaptive interpreter make the
decision that for this code sample the key `CONST`, but not the key `var`,
should be watched in
Carl Meyer added the comment:
I've updated the PR to split `PyDict_EVENT_MODIFIED` into separate
`PyDict_EVENT_ADDED`, `PyDict_EVENT_MODIFIED`, and `PyDict_EVENT_DELETED` event
types. This allows callbacks only interested in e.g. added keys (case #2) to
more easily and cheaply
Carl Meyer added the comment:
Thanks for outlining the use cases. They make sense.
The current PR provides a flexible generic API that fully supports all three of
those use cases (use cases 2 and 3 are strict subsets of use case 1.) Since the
callback is called before the dict is modified
Carl Meyer added the comment:
> have you considered watching dict keys rather than whole dicts?
Just realized that I misunderstood this suggestion; you don't mean per-key
watching necessarily, you just mean _not_ notifying on dict values changes. Now
I understand better how that con
Carl Meyer added the comment:
Hi Dennis, thanks for the questions!
> A curiosity: have you considered watching dict keys rather than whole dicts?
There's a bit of discussion of this above. A core requirement is to avoid any
memory overhead and minimize CPU overhead on unwatch
Carl Meyer added the comment:
Draft PR is up for consideration. Perf data in
https://gist.github.com/carljm/987a7032ed851a5fe145524128bdb67a
Overall it seems like the base implementation is perf neutral -- maybe a slight
impact on the pickle benchmarks? With all module global dicts
Change by Carl Meyer :
--
keywords: +patch
pull_requests: +29891
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/31787
___
Python tracker
<https://bugs.python.org/issu
Carl Meyer added the comment:
Thanks for the feedback!
> Why so coarse?
Simplicity of implementation is a strong advantage, all else equal :) And the
coarse version is a) at least somewhat proven as useful and usable already by
Cinder / Cinder JIT, and b) clearly doable without introduc
Carl Meyer added the comment:
> Could we (or others) end up with unguarded stale caches if some buggy
> extension forgets to chain the calls correctly?
Yes. I can really go either way on this. I initially opted for simplicity in
the core support at the cost of asking a bit more of c
Carl Meyer added the comment:
Thanks gps! Working on a PR and will collect pyperformance data as well.
We haven't observed any issues in Cinder with the callback just being called at
shutdown, too, but if there are problems with that it should be possible to
just have CPython clea
Change by Carl Meyer :
--
title: add support for watching writes to selecting dictionaries -> add support
for watching writes to selected dictionaries
___
Python tracker
<https://bugs.python.org/issu
New submission from Carl Meyer :
CPython extensions providing optimized execution of Python bytecode (e.g. the
Cinder JIT), or even CPython itself (e.g. the faster-cpython project) may wish
to inline-cache access to frequently-read and rarely-changed namespaces, e.g.
module globals. Rather
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,
New submission from Carl Drougge :
PEP 495 names one of the accessor macros PyDateTime_GET_FOLD but the code names
it PyDateTime_DATE_GET_FOLD.
The FOLD macros are also missing from
https://docs.python.org/3/c-api/datetime.html (and versions).
--
assignee: docs@python
components
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 Meyer added the comment:
Good idea to check with the PEP authors.
I don’t think allowing both ClassVar and Final in dataclasses requires general
intersection types. Neither ClassVar nor Final are real types; they aren’t part
of the type of the value. They are more like special
Carl Meyer added the comment:
> Are Final default_factory fields real fields or pseudo-fields? (i.e. are they
> returned by dataclasses.fields()?)
They are real fields, returned by `dataclasses.fields()`.
In my opinion, the behavior change proposed in this bug is a bad idea all
aroun
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 Schaefer :
--
nosy: +carlschaefer
___
Python tracker
<https://bugs.python.org/issue17088>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 Anderson added the comment:
>The proposal I like is for a unicode numeric normalization functions that
>return the ascii equivalent to exist.
@Gregory P. Smith
this makes sense to me. That does feel like the cleanest solution.
I'm currently doing s = s.replace("⁄"
Carl Anderson added the comment:
>Carl: can you say more about the problem that motivated this issue?
@mark.dickinson
I was parsing a large corpus of ingredients strings from web-scraped recipes.
My code to interpret strings such as "1/2 cup sugar" would fall over every so
Carl Meyer added the comment:
Created a PR that fixes this by being more consistent in how urllib wraps
network errors. If there are backward-compatibility concerns with this change,
another option could be some really ugly regex-matching code in
`test.support.transient_internet
Change by Carl Meyer :
--
keywords: +patch
pull_requests: +23699
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24938
___
Python tracker
<https://bugs.python.org/issu
New submission from Carl Meyer :
In general it seems the CPython test suite takes care to skip instead of
failing networked tests when the network is unavailable (c.f.
`support.transient_internet` test helper).
In this case of the 5 FTP tests in `test_urllib2net` (that is, `test_ftp
Change by Carl Meyer :
--
title: some tests in test_urllib2net fail instead of skipping on unreachable
network -> ftp tests in test_urllib2net fail instead of skipping on unreachable
network
___
Python tracker
<https://bugs.python.org/issu
Change by Carl Meyer :
--
keywords: +patch
pull_requests: +23697
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24937
___
Python tracker
<https://bugs.python.org/issu
New submission from Carl Meyer :
In general it seems the CPython test suite takes care to not fail if the
network is unreachable, but `test_timeout_connect_ex` fails because the result
code of the connection is checked without any exception being raised that would
reach
Carl Anderson added the comment:
I guess if we are doing slashes, then the division sign ÷ (U+00F7) should be
included too.
There are at least 2 minus signs too (U+002D, U+02D7).
--
___
Python tracker
<https://bugs.python.org/issue43
Carl Anderson added the comment:
from https://en.wikipedia.org/wiki/Slash_(punctuation) there is
U+002F / SOLIDUS
U+2044 ⁄ FRACTION SLASH
U+2215 ∕ DIVISION SLASH
U+29F8 ⧸ BIG SOLIDUS
U+FF0F / FULLWIDTH SOLIDUS (fullwidth version of solidus)
U+1F67C 🙼 VERY HEAVY SOLIDUS
In XML and HTML, the
New submission from Carl Anderson :
Fraction works with a regular slash:
>>> from fractions import Fraction
>>> Fraction("1/2")
Fraction(1, 2)
but there are other similar slashes such as (0x2044) in which it throws an
error:
>>> Fraction("0⁄2&q
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 Bordum Hansen added the comment:
I have submitted a proposed solution
Just found this similar issue https://bugs.python.org/issue35840
--
___
Python tracker
<https://bugs.python.org/issue25
Change by Carl Bordum Hansen :
--
keywords: +patch
nosy: +carlbordum
nosy_count: 5.0 -> 6.0
pull_requests: +21544
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22541
___
Python tracker
<https://bugs.p
Change by Carl Bordum Hansen :
--
keywords: +patch
nosy: +carlbordum
nosy_count: 4.0 -> 5.0
pull_requests: +21542
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/22539
___
Python tracker
Carl Bordum Hansen added the comment:
I think this can be closed as `sys.set_coroutine_wrapper` was removed in
https://bugs.python.org/issue36933
--
nosy: +carlbordum
___
Python tracker
<https://bugs.python.org/issue30
Carl Bordum Hansen added the comment:
I do not think this is the case any longer
--
nosy: +carlbordum
___
Python tracker
<https://bugs.python.org/issue29
Carl Bordum Hansen added the comment:
This was fixed in https://github.com/python/cpython/pull/12598
--
nosy: +carlbordum
___
Python tracker
<https://bugs.python.org/issue29
New submission from Carl Drougge :
If several threads try to start a multiprocessing.Pool at the same time when no
pool has been started before this often fails with an exception like this (the
exact import varies):
Exception in thread Thread-2:
Traceback (most recent call last):
File
Carl Meyer added the comment:
> Coul you please add a what's new entry for this change?
The committed change already included an entry in NEWS. Is a "What's New" entry
something different?
> I don't understand why there is a PendingDeprecationWarning and not a
Carl Meyer added the comment:
Right, although I think it still makes sense to link both LibCST and parso
since they provide different levels of abstraction that would be suitable for
different types of tools (e.g. I would rather write an auto-formatter on top of
parso, because LibCST
Carl Meyer added the comment:
@gregory.p.smith
What do you think about the question I raised above about how to make this
deprecation visible to users of the 2to3 CLI tool, assuming the plan is to
remove both?
--
___
Python tracker
<ht
Carl Meyer added the comment:
I opened a PR. It deprecates the lib2to3 library to discourage future use of it
for Python3, but not the 2to3 tool. This of course means that the lib2to3
module will in practice stick around in the stdlib as long as 2to3 is still
bundled with Python.
It seems
Change by Carl Meyer :
--
pull_requests: +18987
pull_request: https://github.com/python/cpython/pull/19663
___
Python tracker
<https://bugs.python.org/issue40
Carl Meyer added the comment:
I volunteered in the python-dev thread to write a patch to the docs clarifying
future status of lib2to3; happy to include the PendingDeprecationWarning as
well.
Re linking to alternatives, we want to make sure we link to alternatives that
are committed to
Carl Lewin added the comment:
Very first time engaging in such a forum. Apologies is advance if I am doing it
wrong!
Observation: ps -ef shows "Defunct" process until calling script terminates
Scenario: equivalent test scripts in BASH, Python 2.7 and 3.6 that:
1. Start a ping
Carl Meyer added the comment:
Makes sense. Yes, caution is required about what code runs before fork, but
forkserver’s solution for that would be a non-starter for us, since it would
ensure that we can share no basically no memory at all between worker processes
Carl Meyer added the comment:
> I would be interested to hear the answer to Antoine's question which is
> basically: why not using the multiprocessing fork server?
Concretely, because for a long time we have used the uWSGI application server
and it manages forking worker proce
Carl Meyer added the comment:
> Is it a common use case to load big data and then fork to use preloaded data?
A lot of the "big data" in question here is simply lots of Python
module/class/code objects resulting from importing lots of Python modules.
And yes, this "
Carl Meyer added the comment:
I think the concerns about "perfect" behavior in corner cases are in general
irrelevant here.
In the scenarios where this optimization matters, there is no quantitative
change that occurs at 100% coverage. Preventing 99% of CoW is 99% as good as
prev
Carl Meyer added the comment:
> This may break the garbage collector algorithm that relies on the balance
> between strong references between objects and its reference count to do the
> calculation of the isolated cycles.
I don't think it really breaks anything. What happe
Carl Meyer added the comment:
> An immortalized object will never start participating in reference counting
> again after it is immortalized.
Well, "passed to an extension compiled with no-immortal headers" is an
exception to this.
But for the "not GC tracked but lat
Carl Meyer added the comment:
> Anything that is touched by the immortal object will be leaked. This can also
> happen in obscure ways if reference cycles are created.
I think this is simply expected behavior if you choose to create immortal
objects, and not really an issue. How cou
Change by Carl Tyndall :
--
pull_requests: +17809
pull_request: https://github.com/python/cpython/pull/18435
___
Python tracker
<https://bugs.python.org/issue3
Change by Carl Harris :
--
nosy: +hitbox
___
Python tracker
<https://bugs.python.org/issue35799>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
New submission from Carl Meyer :
Currently the "symtable entry" extension type (PySTEntry_Type) defined in
`Python/symtable.c` defines no `tp_new` or `tp_init`, making it impossible to
create instances of this type from Python code.
I have a use case for pickling symbol tables (as
Change by Carl Harris :
--
nosy: +hitbox
___
Python tracker
<https://bugs.python.org/issue39318>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Carl Bordum Hansen :
--
keywords: +patch
pull_requests: +17331
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/17924
___
Python tracker
<https://bugs.python.org/issu
New submission from Carl Bordum Hansen :
The functions are documented, but not in doc strings which means you cannot
call help() on them.
>From this twitter thread:
>https://twitter.com/raymondh/status/1211414561468952577
--
assignee: docs@python
components: Documentation
me
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&
1 - 100 of 281 matches
Mail list logo