#1117986 wsdd: Warning about a truthiness test, line 649

Package:
wsdd
Source:
wsdd
Submitter:
Athanasius
Date:
2026-05-24 20:37:02 UTC
Severity:
normal
Tags:
#1117986#5
Date:
2025-10-13 10:17:01 UTC
From:
To:
Dear Maintainer,

I'm on Debian trixie, but had other reason to allow testing packages
(pinned to not auto-install/upgrade).  Due to wsdd having been removed
for trixie release the system then picked up the testing version.

In this version I see this logged:

2025-10-13T10:17:11.990915+01:00 emilia gvfsd[398794]: /usr/bin/wsdd:649: DeprecationWarning: Testing an element's truth value will always return True in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.

which is from this section of code:

 646             elif dialect == WSDP_URI + '/Relationship':
 647                 host_xpath = 'wsdp:Relationship[@Type="{}/host"]/wsdp:Host'     .format(WSDP_URI)
 648                 host_sec = section.find(host_xpath, namespaces)
 649                 if (host_sec):
 650                     self.extract_host_props(host_sec)
 651             else:
 652                 logger.debug('unknown metadata dialect ({})'.format(dialect     ))

So, presumably `if (host_sec):` needs changing to `if host_sec is not
None:` or similar.  Actually, I'm wondering why there are () on the
current version, perhaps those just need stripping ?
  Obviously it currently works well enough, but will need correcting for
whatever future Python version changes the behaviour.

#1117986#10
Date:
2025-10-13 10:45:18 UTC
From:
To:
  I've now checked upstream, and it looks like the adjustment has
already been made.  So, whenever the Debian maintainer updates to wsdd
0.9 this should be moot.

#1117986#15
Date:
2026-05-24 20:34:00 UTC
From:
To:
Hi,

I've improved the error message for this issue as described in the bug
report.

When parsed_format is List[X] but source_format is Y (not List[Y]),
the error message now clearly shows the type mismatch and explains
that source_format must also use List[].

This makes it much easier for plugin developers to understand and fix
the issue when they accidentally forget to wrap source_format in List[].

The patch is attached.

Thanks,
Abhinay Thorat