Idea for someone: Run with python warnings in --enable-developer mode

Douglas Bagnall douglas.bagnall at
Wed Mar 11 00:58:16 UTC 2020

On 11/03/20 10:21 am, Andrew Bartlett via samba-technical wrote:
> We got a wake-up-call with "samba fails to build with Python 3.9:
> invalid open() mode U"
> We need to find a way to run waf and selftest with python warnings
> turned on.

With Python 3.7 at least, you see a lot of warnings with:


which leads to crazy commits like  c247afbda00013bf4821e5a2d4f3166bf31814f0.

>From memory, most of the warnings are really false positives, warning
about unclosed files in situations where we know the GC will close the
file soon and we aren't opening them in a tight loop or in long running

Also from memory, there are more interesting warnings in waf and the
wscripts than samba itself.

> It might be as simple as setting an environment variable in autobuild
> or .gitlab-ci.yml, but my current gut feeling is to control it in waf
> so we can see it during routine pre-commit testing.
> I would like, just with our C warnings, for --disable-warnings-as-
> errors to work, so we can still build older versions of Samba with
> developer features on newer python (which might have deprecated things
> we use). 
> I think we want to set PYTHONWARNINGS=error into the environment and
> have waf set on itself
> import warnings
>     warnings.simplefilter("error")
> Is anyone interested in taking this on?  Of course what follows would
> be no doubt a pile of warning fixes, so it may not be a small task.  

I think it would be quite a small task once the file warnings are ignored,
so long as third_party/ is swept back under its rug.

(that is not me volunteering).


More information about the samba-technical mailing list