A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-April/034847.html below:

[Python-Dev] Hook Extension Module Import?

[Python-Dev] Hook Extension Module Import? [Python-Dev] Hook Extension Module Import?David Abrahams dave@boost-consulting.com
Mon, 21 Apr 2003 07:14:57 -0400
Guido van Rossum <guido@python.org> writes:

>> I think I need a way to temporarily (from 'C'), arrange to be notified
>> just before and just after a new extension module is loaded.  Is this
>> possible?  I didn't see anything obvious in the source.  BTW, I'd be
>> just as happy if it were possible to do the same thing for any module
>> (i.e., not discriminating between extension and pure python modules).
>
> I think Aahz is slowly leading you in the right direction: you can
> override __import__ with something that calls your pre-hook, then the
> original __import__, then your post_hook.  I see no problem with doing
> this from C except that it's a bit verbose.

So I take it a doc patch is in order.  That section which claims it's
impossible is certainly misleading...

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4