Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4984 closed defect (fixed)

Usage of deprecated md5 and sha (vs. hashlib)

Reported by: Justin R. Cutler Owned by: Matt Good
Priority: normal Component: AccountManagerPlugin
Severity: minor Keywords: md5, sha, hashlib
Cc: Trac Release: 0.11

Description

The following warnings occur when using the AccountManagerPlugin under Python 2.6.

/usr/local/lib/python2.6/dist-packages/TracAccountManager-0.2.1dev_r5479-py2.6.egg/acct_mgr/pwhash.py:13: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5, sha
/usr/local/lib/python2.6/dist-packages/TracAccountManager-0.2.1dev_r5479-py2.6.egg/acct_mgr/md5crypt.py:14: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5

Attachments (1)

accountmanagerplugin.patch (2.5 KB) - added by Justin R. Cutler 8 years ago.
Trivial patch to fix Python 2.6 warnings

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by jeberger@…

Looks like there is an infinite recursion in the sha_new function when hashlib is unavailable: it calls itself instead of calling sha.new.

Moreover, arguments are not handled properly. It should be:

def sha_new (*args): 
    return sha.new (*args)

And something similar for md5_new.

Changed 8 years ago by Justin R. Cutler

Attachment: accountmanagerplugin.patch added

Trivial patch to fix Python 2.6 warnings

comment:2 Changed 8 years ago by Justin R. Cutler

Keywords: hashlib added; shashlib removed

The patch has been updated to fix both issues.

comment:3 Changed 8 years ago by Alex Knol

Priority: normallow
Severity: normalminor

I just applied the patch and now get a similar message on notification.py

/usr/local/lib/python2.6/dist-packages/TracWikiNotification-0.2.1-py2.6.egg/WikiNotification /notification.py:17: DeprecationWarning: the md5 module is deprecated; use hashlib instead

as before all works, just a warning.

comment:4 in reply to:  3 Changed 8 years ago by Justin R. Cutler

Priority: lownormal

Replying to alexknol@gmail.com:

I just applied the patch and now get a similar message on notification.py

/usr/local/lib/python2.6/dist-packages/TracWikiNotification-0.2.1-py2.6.egg/WikiNotification /notification.py:17: DeprecationWarning: the md5 module is deprecated; use hashlib instead

as before all works, just a warning.

I would recommend filing a ticket with the WikiNotificationPlugin (http://wikinotification.ufsoft.org/), as your warning is the same issue, but for a different plugin.

comment:5 Changed 8 years ago by anonymous

please consider applying this patch and get rid of the deprecation warnings. it's a good way to get ready for 3.0 thanks

comment:6 Changed 8 years ago by Matt Good

Resolution: fixed
Status: newclosed

(In [5836]) Use hashlib when available (fixes #4984)

comment:7 Changed 8 years ago by Matt Good

(In [5837]) Use hashlib when available (fixes #4984)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Matt Good.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.