Commit b536de62 authored by Robert Bradshaw's avatar Robert Bradshaw

Python 3 fix.

parent d4daf977
......@@ -9,7 +9,6 @@ cython.declare(os=object, re=object, operator=object,
Utils=object, SourceDescriptor=object, StringIOTree=object,
DebugFlags=object, basestring=object)
from md5 import md5
import os
import re
import sys
......@@ -17,6 +16,11 @@ from string import Template
import operator
import textwrap
try:
import hashlib
except ImportError:
import md5 as hashlib
import Naming
import Options
import StringEncoding
......@@ -1527,7 +1531,7 @@ class CCodeWriter(object):
def put_or_include(self, code, name):
if code:
if self.globalstate.common_utility_include_dir and len(code) > 1042:
include_file = "%s_%s.h" % (name, md5(code).hexdigest())
include_file = "%s_%s.h" % (name, hashlib.md5(code).hexdigest())
path = os.path.join(self.globalstate.common_utility_include_dir, include_file)
if not os.path.exists(path):
tmp_path = '%s.tmp%s' % (path, os.getpid())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment