Mac OSX 10.6 (Snow Leopard) Deprecation Warnings

John Arbash Meinel john at arbash-meinel.com
Wed Sep 30 03:42:47 BST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


...

> This is, unfortunately, from the Pycrypto code.
> 
> https://bugs.launchpad.net/pycrypto/+bug/269429
> 
> They haven't released their fix yet.
> 
> What surprises me, though, is at the beginning of bzrlib.commands.main()
> we do:
> 
> # Is this a final release version? If so, we should suppress warnings
> if bzrlib.version_info[3] == 'final':
>    suppress_deprecation_warnings(override=False)
> 
> which does:
> warnings.filterwarnings('ignore', category=DeprecationWarning)
> 
> Which (afaict) should suppress all deprecation warnings. So I'm
> wondering how we are encountering these.
> 
> Can you tell me what 'bzr --version' gives you?
> 
>> Bazaar (bzr) 2.0.0
>>   Python interpreter: /usr/bin/python2.6 2.6.1
>>   Python standard library:
>> /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
>>   Platform: Darwin-10.0.0-i386-64bit
>>   bzrlib: /Library/Python/2.6/site-packages/bzrlib
>>   Bazaar configuration: /Users/kirwin/.bazaar
>>   Bazaar log file: /Users/kirwin/.bzr.log
> 
> 
> Does this only happen when accessing bzr+ssh/sftp locations? Or does it
> give the warning always?
> 
>> Only when using SFTP.
> 
>> For instance, bzr diff and bzr status doesn't cause probs.
> 
>> Keith

If you want a 'quick-and-dirty' fix, you should be able to edit the
'bzr' script and change the first line from something like:

#!/usr/bin...../python

to something like:

#!/usr/bin....../python -Wignore::DeprecationWarning

There are more and less specific ways of doing it, but the above should
be reasonable. It tells python to 'ignore' all DeprecationWarning instances.



I found out why our warning suppression isn't working. Specifically, we
have this flag:

suppress_deprecation_warnings(override=False)

When override=False, it checks to see if there is any filter already
present which affects DeprecationWarning and if so, it doesn't add a new
deprecation warning filter.

And when I check, I see this one:
  sys.exc_clear

For whatever reason something is explicitly disabling a deprecation
warning about sys.exc_clear(). I don't know what it is, but it isn't
bzrlib. I do see:

warnings.filterwarnings('ignore',
        'integer argument expected, got float',
        category=DeprecationWarning,
        module='paramiko.message')

But that is going to be triggering a lot later than everything else.


So a different patch that will also avoid getting these warnings is:

=== modified file 'bzrlib/commands.py'
- --- bzrlib/commands.py  2009-06-19 09:06:56 +0000
+++ bzrlib/commands.py  2009-09-30 02:41:48 +0000
@@ -1090,7 +1090,7 @@

     # Is this a final release version? If so, we should suppress warnings
     if bzrlib.version_info[3] == 'final':
- -        suppress_deprecation_warnings(override=False)
+        suppress_deprecation_warnings(override=True)
     if argv is None:
         argv = osutils.get_unicode_argv()
     else:


I think either patch would probably be reasonable to include in the Mac
OS X installer, and we should consider having the latter one integrated
for bzr 2.0.1.


John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrCxacACgkQJdeBCYSNAAMODQCg1hKDXCV/48kLffN0eg8Ud1b2
wXkAn36dx80TJUfXCu5TF6rga4JEGJsp
=kgpw
-----END PGP SIGNATURE-----



More information about the bazaar mailing list