fix: nicer stack level for warning (#4516)

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner 2023-02-17 14:13:29 -08:00 committed by Henry Schreiner
parent 9a1eeed03a
commit f5cff4f25e

View File

@ -175,7 +175,7 @@ class Pybind11Extension(_Extension): # type: ignore[misc]
def cxx_std(self, level: int) -> None:
if self._cxx_level:
warnings.warn(
"You cannot safely change the cxx_level after setting it!", stacklevel=1
"You cannot safely change the cxx_level after setting it!", stacklevel=2
)
# MSVC 2015 Update 3 and later only have 14 (and later 17) modes, so