Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#4984 closed defect (fixed)

Usage of deprecated md5 and sha (vs. hashlib)

Reported by: jrcutler Owned by: mgood
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 jrcutler 5 years ago.
Trivial patch to fix Python 2.6 warnings

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 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 5 years ago by jrcutler

Trivial patch to fix Python 2.6 warnings

comment:2 Changed 5 years ago by jrcutler

  • Keywords hashlib added; shashlib removed

The patch has been updated to fix both issues.

comment:3 follow-up: Changed 5 years ago by alexknol@…

  • Priority changed from normal to low
  • Severity changed from normal to minor

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 5 years ago by jrcutler

  • Priority changed from low to normal

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 5 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 5 years ago by mgood

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

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

comment:7 Changed 5 years ago by mgood

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

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.