[issue5853] mimetypes.guess_type() hits recursion limit

Antoine Pitrou report at bugs.python.org
Mon Apr 27 16:04:58 CEST 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

The plan is to replace init() with something like:

_db = None

def init():
    global _db
    db = ...   
    # initialize database
    # set it to global only when it's fully ready
    _db = db

and guess_type() with:

def guess_type():
    if _db is None:
       init()
    return _db.guess_type()

(same for other functions)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5853>
_______________________________________


More information about the Python-bugs-list mailing list