The "once" filter should suppress repeated warnings with the same message and category, regardless of module or line number (documentation). However, CPython emits the warning again when it originates in another module:
Reproduced on CPython 3.16.0a1+dev, commit 7756fc0.
In Python/_warnings.c, the "once" branch uses the supplied per-module registry, falling back to the global once registry only when no registry is supplied. The pure-Python implementation uses the global onceregistry and correctly emits only one warning.
This is a longstanding behavior (since 2008) and changing it might be disruptive. On the other hand, currently it seems once is not meaningfully different from module.
Activity