You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I thought I add 3.14-dev to our CI on github actions and after fixing some obvious issues, this one was left (the code is tested successfully on 3.10 .. 3.13):
@contextmanager
def _stats_updater(self, key, msg):
"""update call counters and overall times, also emulate latency and bandwidth"""
# do not use this in generators!
volume_before = self._stats_get_volume(key)
start = time.perf_counter_ns()
> yield
E TypeError: _pystart_callback expected 2 arguments, got 3
That could definitely be it. If they're using internal profiling APIs that changed in 3.14, that would explain it. Does it pass without pytest-benchmark?
I just found that the 2 failing tests test our --debug-profile option, which enables the cProfile.Profile profiler from stdlib. .enable, .disable, .snapshot_stats is all we use from that.
with open(args.debug_profile, "wb") as fd:
profiler = cProfile.Profile()
variables = dict(locals())
profiler.enable()
try:
return get_ec(func(args))
finally:
profiler.disable()
profiler.snapshot_stats()
if args.debug_profile.endswith(".pyprof"):
marshal.dump(profiler.stats, fd)
else:
# We use msgpack here instead of the marshal module used by cProfile itself,
# because the latter is insecure. Since these files may be shared over the
# internet we don't want a format that is impossible to interpret outside
# an insecure implementation.
# See scripts/msgpack2marshal.py for a small script that turns a msgpack file
# into a marshal file that can be read by e.g. pyprof2calltree.
# For local use it's unnecessary hassle, though, that's why .pyprof makes
# it compatible (see above).
msgpack.pack(profiler.stats, fd, use_bin_type=True)
I know what happened. It was due to the clinical refactoring for _pystart_callback. I will investigate why we did not find it in our test suite. Anyway I'll take care of this, thanks for reporting.
Okay so the reason why our test suite did not catch this is because in #111069 we optimized how generator works and the throw event is not there anymore.
Activity
ThomasWaldmann commentedon Jun 12, 2025
Another one, this time just a bare
yield:ZeroIntensity commentedon Jun 12, 2025
Hi! There is very little we can do without a repro. Would you mind trying to shrink this down to something using only the stdlib?
That said,
_pystart_callbackis a function used for profiling. Are you tests using some sort of low-level profiler?ThomasWaldmann commentedon Jun 12, 2025
Most unit tests are just normal pytest tests, a few are using unittest. There are some using pytest-benchmark though, could that be it?
ZeroIntensity commentedon Jun 12, 2025
That could definitely be it. If they're using internal profiling APIs that changed in 3.14, that would explain it. Does it pass without
pytest-benchmark?ThomasWaldmann commentedon Jun 12, 2025
I just found that the 2 failing tests test our
--debug-profileoption, which enables thecProfile.Profileprofiler from stdlib..enable,.disable,.snapshot_statsis all we use from that.gaogaotiantian commentedon Jun 12, 2025
I know what happened. It was due to the clinical refactoring for
_pystart_callback. I will investigate why we did not find it in our test suite. Anyway I'll take care of this, thanks for reporting.gaogaotiantian commentedon Jun 12, 2025
Okay so the reason why our test suite did not catch this is because in #111069 we optimized how generator works and the throw event is not there anymore.
gh-135429: Fix the argument mismatch in lsprof throw event (#135442)
pythongh-135429: Fix the argument mismatch in lsprof throw event (pyt…
[3.14] gh-135429: Fix the argument mismatch in lsprof throw event (GH…
gaogaotiantian commentedon Jun 12, 2025
Fixed and backported.
ThomasWaldmann commentedon Jun 13, 2025
Thanks for fixing this quickly!
pythongh-135429: Fix the argument mismatch in lsprof throw event (pyt…
pythongh-135429: Fix the argument mismatch in lsprof throw event (pyt…
pythongh-135429: Fix the argument mismatch in lsprof throw event (pyt…
pythongh-135429: Fix the argument mismatch in lsprof throw event (pyt…