summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-03-02 03:42:39 +0000
committerBenjamin Peterson <benjamin@python.org>2009-03-02 03:42:39 +0000
commite392b4ff112fed3abc06809ecf8f49fc1ca02813 (patch)
treec6023760e160f591154794424b82d9f5bc241271
parent4a9fda4280e67aea543d2879e8c2e62ef46b0993 (diff)
downloadcpython-git-e392b4ff112fed3abc06809ecf8f49fc1ca02813.tar.gz
Merged revisions 70086 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70086 | benjamin.peterson | 2009-03-01 21:35:12 -0600 (Sun, 01 Mar 2009) | 1 line fix a silly problem of caching gone wrong #5401 ........
-rw-r--r--Lib/mimetypes.py12
-rw-r--r--Misc/NEWS3
2 files changed, 11 insertions, 4 deletions
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index fc0108b1b1..6212e78419 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -237,7 +237,8 @@ def guess_type(url, strict=True):
Optional `strict' argument when false adds a bunch of commonly found, but
non-standard types.
"""
- init()
+ if not inited:
+ init()
return guess_type(url, strict)
@@ -254,7 +255,8 @@ def guess_all_extensions(type, strict=True):
Optional `strict' argument when false adds a bunch of commonly found,
but non-standard types.
"""
- init()
+ if not inited:
+ init()
return guess_all_extensions(type, strict)
def guess_extension(type, strict=True):
@@ -269,7 +271,8 @@ def guess_extension(type, strict=True):
Optional `strict' argument when false adds a bunch of commonly found,
but non-standard types.
"""
- init()
+ if not inited:
+ init()
return guess_extension(type, strict)
def add_type(type, ext, strict=True):
@@ -284,7 +287,8 @@ def add_type(type, ext, strict=True):
list of standard types, else to the list of non-standard
types.
"""
- init()
+ if not inited:
+ init()
return add_type(type, ext, strict)
diff --git a/Misc/NEWS b/Misc/NEWS
index f2bebd62b0..64e9dee0c8 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -89,6 +89,9 @@ Core and Builtins
Library
-------
+- Issue #5401: Fixed a performance problem in mimetypes when ``from mimetypes
+ import guess_extension`` was used.
+
- Issue #1733986: Fixed mmap crash in accessing elements of second map object
with same tagname but larger size than first map. (Windows)