diff --git a/src/snl/python/snl_wrapping/PyInterface.h b/src/snl/python/snl_wrapping/PyInterface.h index 2470e11a5..aa34783fd 100644 --- a/src/snl/python/snl_wrapping/PyInterface.h +++ b/src/snl/python/snl_wrapping/PyInterface.h @@ -277,7 +277,7 @@ PyObject* richCompare(T left, T right, int op) { 0, /* tp_setattro */ \ 0, /* tp_as_buffer */ \ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ \ - "#SELF_TYPE objects", /* tp_doc */ \ + #SELF_TYPE" objects", /* tp_doc */ \ 0, /* tp_traverse */ \ 0, /* tp_clear */ \ 0, /* tp_richcompare */ \ diff --git a/test/snl/python/pyloader/SNLPrimitivesTest0.cpp b/test/snl/python/pyloader/SNLPrimitivesTest0.cpp index 6b6dad1a9..9dc8bcdad 100644 --- a/test/snl/python/pyloader/SNLPrimitivesTest0.cpp +++ b/test/snl/python/pyloader/SNLPrimitivesTest0.cpp @@ -113,4 +113,14 @@ TEST_F(SNLPrimitivesTest0, testFaultyPythonScript) { primitives0Path /= "scripts"; primitives0Path /= "faulty_script.py"; EXPECT_THROW(SNLPyLoader::loadPrimitives(library, primitives0Path), SNLException); +} + +TEST_F(SNLPrimitivesTest0, testEmptyPythonScript) { + //faulty python script + auto db = SNLDB::create(SNLUniverse::get()); + auto library = SNLLibrary::create(db, SNLLibrary::Type::Primitives, SNLName("PRIMS")); + auto primitives0Path = std::filesystem::path(SNL_PRIMITIVES_TEST_PATH); + primitives0Path /= "scripts"; + primitives0Path /= "empty_script.py"; + EXPECT_THROW(SNLPyLoader::loadPrimitives(library, primitives0Path), SNLException); } \ No newline at end of file diff --git a/test/snl/python/pyloader/scripts/empty_script.py b/test/snl/python/pyloader/scripts/empty_script.py new file mode 100644 index 000000000..7f50c6f5f --- /dev/null +++ b/test/snl/python/pyloader/scripts/empty_script.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2023 The Naja authors +# +# SPDX-License-Identifier: Apache-2.0 \ No newline at end of file