the md5 module is deprecated; use hashlib instead import md5

Bug #640062 reported by Victor Martinez
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyrex (Debian)
Fix Released
Unknown
pyrex (Ubuntu)
Triaged
Low
Unassigned

Bug Description

lsb_release -rd
Description: Ubuntu 10.04.1 LTS
Release: 10.04
python-pyrex:
  Installed: 0.9.8.5-1ubuntu2
  Candidate: 0.9.8.5-1ubuntu2
  Version table:
 *** 0.9.8.5-1ubuntu2 0
        500 http://mx.archive.ubuntu.com/ubuntu/ lucid/main Packages
        100 /var/lib/dpkg/status

When using python-pyrex with python2.6 it gives this warning:
/usr/lib/python2.6/dist-packages/Pyrex/Compiler/Scanning.py:39: DeprecationWarning: the md5 module is deprecated; use hashlib instead import md5

Reading the Scanning.py and about the hashlib superseding md5 I found that this can be fixed changing only two lines (also I think is solved in upstream Pyrex 0.9.9)vicm3@mini:/usr/lib/python2.6/dist-packages/Pyrex/Compiler$ diff -u Scanning.py Scanning.py.new

--- Scanning.py 2008-05-10 04:12:45.000000000 -0500
+++ Scanning.py.new 2010-09-15 18:51:44.000000000 -0500
@@ -36,7 +36,7 @@
     # Try to calculate a hash code for the given source file.
     # Returns an empty string if the file cannot be accessed.
     #print "Hashing", path ###
- import md5
+ import hashlib
     try:
         try:
             f = open(path, "rU")
@@ -52,7 +52,7 @@
     # tabs by a single space.
     import re
     text = re.sub("[ \t]+", " ", text)
- hash = md5.new(text).hexdigest()
+ hash = hashlib.md5(text).hexdigest()
     return hash

 def open_pickled_lexicon(expected_hash):

Closes the warning.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: python-pyrex 0.9.8.5-1ubuntu2 [modified: usr/share/pyshared/Pyrex/Compiler/Scanning.py]
ProcVersionSignature: Ubuntu 2.6.32-23.37-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-23-generic i686
NonfreeKernelModules: wl
Architecture: i386
Date: Wed Sep 15 18:48:34 2010
InstallationMedia: Xubuntu 10.04 "Lucid Lynx" - Release i386 (20100429)
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: pyrex

Revision history for this message
Victor Martinez (vicm3) wrote :
tags: added: patch
Changed in pyrex (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Changed in pyrex (Debian):
status: Unknown → New
Changed in pyrex (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Remote bug watches

Bug watches keep track of this bug in other bug trackers.