question on testing 4.12.1 on Ubuntu 20.04 Focal..

David Disseldorp ddiss at samba.org
Tue Apr 21 10:30:08 UTC 2020


Hi Louis,

On Tue, 21 Apr 2020 11:59:25 +0200, L.P.H. van Belle via samba-technical wrote:

> Hai guys, 
>  
> I noticed the following with the first packages on Ubuntu 20.04.. 
> So far i seen it installs nicely but i noticed the message below. 
> Can we ignore it, i suspect this is a python 3.8 thingy .. but as im not a coder ... 
> Well, anyone suggestions?  :-) 
>  
>  
> Setting up python3-samba (2:4.12.1+dfsg-0.1focal1) ...
> /usr/lib/python3/dist-packages/samba/emulate/traffic_packets.py:339: SyntaxWarning: "is" with a literal. Did you mean "=="?
>   if (filter is None or filter is '') and scope != SCOPE_BASE:

See https://bugs.python.org/issue34850
  the "is" and "is not" operator sometimes is used with string and
  numerical literals. This code "works" on CPython by accident, because
  of caching on different levels (small integers and strings caches,
  interned strings, deduplicating constants at compile time). But it
  shouldn't work on other implementations, and can not work even on
  early or future CPython versions.

It can be ignored, but we should probably fix all such cases in future.
This specific case can be fixed with:

--- a/python/samba/emulate/traffic_packets.py
+++ b/python/samba/emulate/traffic_packets.py
@@ -336,7 +336,7 @@ def packet_ldap_3(packet, conversation, context):
 
     # try to guess the search expression (don't bother for base searches, as
     # they're only looking up a single object)
-    if (filter is None or filter is '') and scope != SCOPE_BASE:
+    if (filter is None or filter == '') and scope != SCOPE_BASE:
         filter = context.guess_search_filter(attrs, dn_sig, dn)
 
Cheers, David



More information about the samba-technical mailing list