mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 07:02:11 +00:00
Resolve new flake8 error (#4462)
* Resolve flake8 error by replacing `pytest.raises(Exception)` with `SystemError` * Also remove the obsolete comment. * Tweak comment instead of removing it.
This commit is contained in:
parent
da780a00ae
commit
5ece09ad30
@ -107,11 +107,10 @@ def test_def_submodule_failures():
|
|||||||
sm_name_orig = sm.__name__
|
sm_name_orig = sm.__name__
|
||||||
sm.__name__ = malformed_utf8
|
sm.__name__ = malformed_utf8
|
||||||
try:
|
try:
|
||||||
with pytest.raises(Exception):
|
# We want to assert that a bad __name__ causes some kind of failure, although we do not want to exercise
|
||||||
# Seen with Python 3.9: SystemError: nameless module
|
# the internals of PyModule_GetName(). Currently all supported Python versions raise SystemError. If that
|
||||||
# But we do not want to exercise the internals of PyModule_GetName(), which could
|
# changes in future Python versions, simply add the new expected exception types here.
|
||||||
# change in future versions of Python, but a bad __name__ is very likely to cause
|
with pytest.raises(SystemError):
|
||||||
# some kind of failure indefinitely.
|
|
||||||
m.def_submodule(sm, b"SubSubModuleName")
|
m.def_submodule(sm, b"SubSubModuleName")
|
||||||
finally:
|
finally:
|
||||||
# Clean up to ensure nothing gets upset by a module with an invalid __name__.
|
# Clean up to ensure nothing gets upset by a module with an invalid __name__.
|
||||||
|
Loading…
Reference in New Issue
Block a user