From 1d1b8357fe4984200fb9aa71014ac8f69e588a01 Mon Sep 17 00:00:00 2001 From: d-w-moore Date: Wed, 28 Jan 2026 12:34:04 -0500 Subject: [PATCH 1/2] [_708] new __slots__ members to prevent configuration misfires --- irods/client_configuration/__init__.py | 8 +++++ irods/test/client_configuration_test.py | 40 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 irods/test/client_configuration_test.py diff --git a/irods/client_configuration/__init__.py b/irods/client_configuration/__init__.py index 505b48b0d..9e836a8d2 100644 --- a/irods/client_configuration/__init__.py +++ b/irods/client_configuration/__init__.py @@ -45,6 +45,9 @@ def __new__(meta, name, bases, attrs): class ConnectionsProperties(iRODSConfiguration, metaclass=iRODSConfigAliasMetaclass): + + __slots__=() + @property def xml_parser_default(self): from irods.message import get_default_XML_by_name @@ -59,11 +62,15 @@ def xml_parser_default(self, str_value): connections = ConnectionsProperties() + class ConfigurationError(BaseException): pass class ConfigurationValueError(ValueError,ConfigurationError): pass + class Genquery1_Properties(iRODSConfiguration, metaclass=iRODSConfigAliasMetaclass): + __slots__ = () + @property def irods_query_limit(self): import irods.query @@ -89,6 +96,7 @@ def irods_query_limit(self, target_value): class DataObjects(iRODSConfiguration): + __slots__ = ( "auto_close", "allow_redirect", diff --git a/irods/test/client_configuration_test.py b/irods/test/client_configuration_test.py new file mode 100644 index 000000000..7f1707414 --- /dev/null +++ b/irods/test/client_configuration_test.py @@ -0,0 +1,40 @@ +import unittest +import irods +import irods.client_configuration as cfg + +cfg.connections.xml_parser_default = 'QUASI_XML' +# Test assignments on the negative and positive space of the +# client configuration. + +class TestClientConfigurationAttributes(unittest.TestCase): + + def test_hits_and_misses__issue_708(self): + # For caching configuration objects + configuration_level = {} + + #count=0; success=0 + for dotted_name, value, is_conf in cfg._var_items_as_generator(): + with self.subTest(dotted_name=dotted_name): + name_parts=dotted_name.split('.') + namespace='.'.join(name_parts[:-1]) + attribute_name=name_parts[-1] + if isinstance(value, cfg.iRODSConfiguration): + configuration_level[dotted_name]=value + else: + if is_conf: + #count += 1 + try: + # Test the positive space, i.e. the 'hit' + setattr(configuration_level[namespace],attribute_name,value) + + #print(namespace, attribute_name, value) + + # Test the negative space, i.e. the 'miss' + with self.assertRaises(AttributeError): + setattr(configuration_level[namespace],attribute_name+'_1',value) + except Exception as exc: + self.fail(f"shouldn't fail but raised {exc = }") + else: + pass + #success += 1 + #print(f'{count = }/{success = }') From cfb7978d81eb810565d2e2a93c0536ae6c3d03b4 Mon Sep 17 00:00:00 2001 From: d-w-moore Date: Thu, 29 Jan 2026 23:21:00 -0500 Subject: [PATCH 2/2] delete test line --- irods/test/client_configuration_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/irods/test/client_configuration_test.py b/irods/test/client_configuration_test.py index 7f1707414..892deab5a 100644 --- a/irods/test/client_configuration_test.py +++ b/irods/test/client_configuration_test.py @@ -2,7 +2,6 @@ import irods import irods.client_configuration as cfg -cfg.connections.xml_parser_default = 'QUASI_XML' # Test assignments on the negative and positive space of the # client configuration.