Skip to content

Commit 9375fd2

Browse files
speleo3JarrettSJohnson
authored andcommitted
get_object_list('') -> []
Closes #478
1 parent c8e2a1b commit 9375fd2

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

layer4/Cmd.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4067,8 +4067,7 @@ static pymol::Result<PyObject*> _getObjectMoleculeNamePyList(
40674067
PyMOLGlobals* G, char const* sele)
40684068
{
40694069
if (!sele[0]) {
4070-
// preserve non-error legacy behavior: Empty selection returns None
4071-
return APIAutoNone(nullptr);
4070+
return PyList_New(0);
40724071
}
40734072
auto tmpsele1 = SelectorTmp::make(G, sele);
40744073
p_return_if_error(tmpsele1);

testing/tests/api/querying.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,8 @@ def testGetObjectList(self):
344344
self.assertEqual(cmd.get_object_list(' '), [])
345345
# empty string is a falsy value
346346
self.assertTrue(not cmd.get_object_list(''))
347-
# empty string is a silent None
348-
# https://github.com/schrodinger/pymol-open-source/issues/478
349-
self.assertTrue(cmd.get_object_list('') is None)
347+
# empty string is empty selection
348+
self.assertEqual(cmd.get_object_list(''), [])
350349

351350
def testGetObjectList__invalid_selection(self):
352351
self.assertRaises(CmdException, cmd.get_object_list, 'invalid_selection_name')

0 commit comments

Comments
 (0)