Appease new flake8 B028 error: (#4513)

```
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

pybind11/setup_helpers.py:177:13: B028 No explicit stacklevel keyword argument found. The warn method from the warnings module uses a stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user.
            warnings.warn("You cannot safely change the cxx_level after setting it!")
            ^
```
This commit is contained in:
Ralf W. Grosse-Kunstleve 2023-02-17 12:31:08 -08:00 committed by GitHub
parent 08a4a47a6c
commit d1956eabb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,7 +174,9 @@ class Pybind11Extension(_Extension): # type: ignore[misc]
@cxx_std.setter @cxx_std.setter
def cxx_std(self, level: int) -> None: def cxx_std(self, level: int) -> None:
if self._cxx_level: if self._cxx_level:
warnings.warn("You cannot safely change the cxx_level after setting it!") warnings.warn(
"You cannot safely change the cxx_level after setting it!", stacklevel=1
)
# 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
# force a valid flag here. # force a valid flag here.