Marc-Andre Lemburg <m...@egenix.com> added the comment:
On 23.09.2020 16:49, STINNER Victor wrote: > > STINNER Victor <vstin...@python.org> added the comment: > >> Just found an internal API which already takes care of >> unregistering a search function: _PyCodec_Forget(). >> >> All that needs to be done is to expose this as codecs.unregister() >> and add the clearing of the lookup cache. > > Yeah, I saw this function, but it's related to the cache, not to the list of > search functions. Ah, right. I just looked at the first occurance of codec_search_path :-) >> BTW: While you're at it, having a way to access the search function >> list from Python would be nice as well, since this would then open >> up the possibility to reorder search functions. > > I didn't hear anyone (ok, apart you) who requested to order search functions. This has come up in the past from people who wanted to override builtin codecs with their own versions. > I dislike the idea of exposing it, since it introduces the risk that someone > "unregisters" a search function simply by removing it from the list, without > invalidating the cache. > > I prefer to hide the internals to ensure that the cache remains consistent. Sure, a function would merely return a tuple with the entries, not the list itself, e.g. in pseudo code: def get_search_path(): return tuple(interp->codec_search_path) For replacing the vanilla setup, this is not needed, since only one search function gets registered (the builtin one), so rather low priority, I guess. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Sep 23 2020) >>> Python Projects, Coaching and Support ... https://www.egenix.com/ >>> Python Product Development ... https://consulting.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/ ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41842> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com