Appease new flake8 B028 error:

```
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-16 22:43:34 -08:00
parent bb68819cdf
commit 44c2d89c47

View File

@ -174,7 +174,9 @@ class Pybind11Extension(_Extension): # type: ignore[misc]
@cxx_std.setter
def cxx_std(self, level: int) -> None:
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
# force a valid flag here.