[pygobject] Don't import inspect at module level
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Don't import inspect at module level
- Date: Sun, 4 Oct 2015 08:13:19 +0000 (UTC)
commit 98726caff183491cde1e145861adfcff0c243d9b
Author: Christoph Reiter <creiter src gnome org>
Date: Sun Oct 4 09:53:27 2015 +0200
Don't import inspect at module level
Move it to the only user instead as importing inspect
takes 10msec here.
gi/_signalhelper.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gi/_signalhelper.py b/gi/_signalhelper.py
index 47e6e2f..30ff541 100644
--- a/gi/_signalhelper.py
+++ b/gi/_signalhelper.py
@@ -18,7 +18,6 @@
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
import sys
-import inspect
from ._gi import _gobject
@@ -220,6 +219,8 @@ def get_signal_annotations(func):
return_type = None
if hasattr(func, '__annotations__'):
+ # import inspect only when needed because it takes ~10 msec to load
+ import inspect
spec = inspect.getfullargspec(func)
arg_types = tuple(spec.annotations[arg] for arg in spec.args
if arg in spec.annotations)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]