scarletcafe / jishaku

A debugging and testing cog for discord.py rewrite bots.
https://jishaku.readthedocs.io/en/latest/
MIT License
543 stars 182 forks source link

`jishaku timeit` raises an AttributeError upon use. #211

Closed AbstractUmbra closed 1 year ago

AbstractUmbra commented 1 year ago

Summary

Much like the title, calling jishaku timeit with any type of code block, upon successful(?) completion of that codeblock it will raise an AttributeError.

Reproduction steps

Calling the falling command will fail:-

Codeblock ``` ?jsk timeit await asyncio!.sleep(3) ```

Expected results

The command to finish processing with the result being shown.

Actual results

The command raises the following AttributeError:-

Traceback (most recent call last):
  File "/app/.venv/lib/python3.11/site-packages/jishaku/features/python.py", line 323, in jsk_timeit
    line_timings[timing.lineno].append(timing.total_time * profile.timer_unit)  # type: ignore
                 ^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'lineno'

Checklist

System information

Jishaku v2.5.1, discord.py 2.4.0a4889+ge5da7f23, Python 3.11.4 (main, Jul 28 2023, 05:12:06) [GCC 12.2.0] on linux
Module was loaded 2 days ago, cog was loaded 2 days ago.

Using 374.04 MiB physical memory and 1.26 GiB virtual memory, 373.08 MiB of which unique to this process.
Running on PID 7 (python) with 17 thread(s).

This bot is not sharded and can see 7 guild(s) and 42672 user(s).
Message cache capped at 1000, presences intent is enabled, members intent is enabled, and message content intent is enabled.
Average websocket latency: 106.14ms
scarletcafe commented 1 year ago

This was caused by an unexpected (and I believe totally undocumented) breaking change in line_profiler (thanks) and was fixed 2 months ago in 71cd546afbac8228300fd5cc247f12fec23febd2