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 GitHub
parent 6a5e6007cd
commit 68211d41c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,7 +175,7 @@ class Pybind11Extension(_Extension): # type: ignore[misc]
def cxx_std(self, level: int) -> None: def cxx_std(self, level: int) -> None:
if self._cxx_level: if self._cxx_level:
warnings.warn( 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 # MSVC 2015 Update 3 and later only have 14 (and later 17) modes, so