cpython/Lib/test/test_warnings/data/stacklevel.py
Daehee Kim 0ef84b0e2b
gh-126209: Fix inconsistency of skip_file_prefixes in warnings.warn's C and Python implementations (GH-126329)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-11-12 13:01:56 +01:00

17 lines
590 B
Python

# Helper module for testing stacklevel and skip_file_prefixes arguments
# of warnings.warn()
import warnings
from test.test_warnings.data import package_helper
def outer(message, stacklevel=1, skip_file_prefixes=()):
inner(message, stacklevel, skip_file_prefixes)
def inner(message, stacklevel=1, skip_file_prefixes=()):
warnings.warn(message, stacklevel=stacklevel,
skip_file_prefixes=skip_file_prefixes)
def package(message, *, stacklevel):
package_helper.inner_api(message, stacklevel=stacklevel,
warnings_module=warnings)