#1129 closed defect (fixed)

suppress DeprecationWarning in tahoe --version output

Reported by: davidsarah Owned by: davidsarah
Priority: minor Milestone: 1.8β
Component: code Version: 1.7.0
Keywords: usability error easy DeprecationWarning reviewed Cc:
Launchpad Bug:

Description (last modified by davidsarah)

From ticket:1122#comment:2 :

% bin/tahoe --version
/usr/lib/python2.6/dist-packages/Pyrex/Compiler/Errors.py:17: 
DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  self.message = message
allmydata-tahoe: 1.7.0-r4536, foolscap: 0.5.1, pycryptopp: 0.5.19, zfec: 1.4.7, 
Twisted: 8.2.0, Nevow: 0.9.33-r17222, zope.interface: 3.5.1, python: 2.6.2, 
platform: Linux-Ubuntu_9.04-i686-32bit_ELF, sqlite: 3.6.21, simplejson: 2.0.9, 
argparse: 1.1, pycrypto: 2.0.1, pyOpenSSL: 0.7, pyutil: 1.7.9, zbase32: 1.1.2, 
setuptools: 0.6c15dev, pyasn1: 0.0.11a, pysqlite: 2.4.1

The DeprecationWarning should have been suppressed.

Attachments (2)

silence-basexception-warning.dpatch (1.1 KB) - added by davidsarah at 2010-07-20T01:00:54Z.
init.py: silence DeprecationWarning? about BaseException?.message globally.
test-tahoe-version-no-warning.dpatch (1.9 KB) - added by davidsarah at 2010-07-20T01:28:52Z.
test_runner: test that 'tahoe --version' outputs no noise (e.g. DeprecationWarnings?).

Download all attachments as: .zip

Change History (13)

comment:1 Changed at 2010-07-20T00:51:13Z by davidsarah

  • Component changed from code to code-frontend-cli
  • Description modified (diff)
  • Keywords easy added
  • Milestone changed from 1.8.0 to 1.8β
  • Owner changed from somebody to davidsarah
  • Status changed from new to assigned

source:src/allmydata/__init__.py contains code that is intended to suppress this warning, but says to do so only when it comes from twisted:

# This warning is generated by twisted, but not when it is imported, only on an error.
warnings.filterwarnings("ignore", category=DeprecationWarning,
    message="BaseException.message has been deprecated as of Python 2.6",
    module=".*twisted.*", append=True)

I think this should just be changed to a global filter, i.e. delete 'module=".*twisted.*", '. This particular deprecation is not important and doesn't ever merit bothering any end-user.

Changed at 2010-07-20T01:00:54Z by davidsarah

init.py: silence DeprecationWarning? about BaseException?.message globally.

comment:2 Changed at 2010-07-20T01:02:43Z by davidsarah

  • Component changed from code-frontend-cli to code
  • Keywords DeprecationWarning review-needed added

(That attachment description should say __init__.py.)

Changed at 2010-07-20T01:28:52Z by davidsarah

test_runner: test that 'tahoe --version' outputs no noise (e.g. DeprecationWarnings?).

comment:3 Changed at 2010-07-20T01:29:25Z by zooko

  • Keywords reviewed added; review-needed removed

reviewed. +1. (I suggest that you darcs amend --edit the patch to append "fixes #1129" to it, and if you don't do so soon then I will.)

comment:4 Changed at 2010-07-20T01:35:27Z by david-sarah@…

  • Resolution set to fixed
  • Status changed from assigned to closed

In 94bec75ddaddaaf5:

init.py: silence DeprecationWarning? about BaseException?.message globally. fixes #1129

comment:5 Changed at 2010-07-20T01:43:01Z by davidsarah

Hmm, actually the output in the description shows that the version of twisted is 8.2.0, so the unit test will be skipped (this matches the existing test_client_no_noise in test_runner.py, but the latter is also skipped on platforms where we can't daemonize).

Is the test valid when Twisted < 8.2.0, or will it give false-alarms?

Version 0, edited at 2010-07-20T01:43:01Z by davidsarah (next)

comment:6 follow-up: Changed at 2010-07-20T04:13:03Z by zooko

Sorry, I don't understand the question(s) in comment:5.

comment:7 in reply to: ↑ 6 Changed at 2010-07-20T05:59:09Z by davidsarah

Replying to zooko:

Sorry, I don't understand the question(s) in comment:5.

The new test is skipped if the Twisted version < 9.0.0. That's copying the skip condition in test_client_no_noise. (The new test is not redundant with test_client_no_noise, because it can be run on Windows and the latter can't, and because it's testing a different command.)

I was wondering whether this skip is actually necessary. It might not be, since tahoe --version doesn't need to import very much of twisted.

comment:8 follow-up: Changed at 2010-07-21T17:11:20Z by zooko

I don't know, but I don't mind skipping the test when Twisted < 9.

comment:9 in reply to: ↑ 8 Changed at 2010-07-22T05:21:39Z by davidsarah

Replying to zooko:

I don't know, but I don't mind skipping the test when Twisted < 9.

OK, so the fix in 94bec75ddaddaaf5 is sufficient.

comment:10 follow-up: Changed at 2010-10-26T01:31:34Z by david-sarah@…

In 59e80b2ec92928bf:

test_mutable.py: add test for ResponseCache? memory leak. refs #1045, #1129

comment:11 in reply to: ↑ 10 Changed at 2010-10-26T01:41:56Z by davidsarah

Replying to david-sarah@…:

In 59e80b2ec92928bf:

test_mutable.py: add test for ResponseCache? memory leak. refs #1045, #1129

Typo in commit message; this should have referred to #1229.

Note: See TracTickets for help on using tickets.