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/034819.html below:

[Python-Dev] Hook Extension Module Import?

[Python-Dev] Hook Extension Module Import? [Python-Dev] Hook Extension Module Import?Guido van Rossum guido@python.org
Sun, 20 Apr 2003 17:20:03 -0400
> 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.

--Guido van Rossum (home page: http://www.python.org/~guido/)



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