This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IPython support for Cython functions
- Loading branch information
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.5.0 | ||
5.5.0.p0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
See https://github.com/ipython/ipython/pull/11139 | ||
|
||
commit 98e7ddd43bab127de68a3c66870b8e17a5b50eeb | ||
Author: Jeroen Demeyer <jdemeyer@cage.ugent.be> | ||
Date: Wed May 16 14:32:15 2018 +0200 | ||
|
||
Use inspect instead of type checks | ||
|
||
diff --git a/IPython/utils/_signatures.py b/IPython/utils/_signatures.py | ||
index 3b53e89..20f52b9 100644 | ||
--- a/IPython/utils/_signatures.py | ||
+++ b/IPython/utils/_signatures.py | ||
@@ -21,6 +21,7 @@ | ||
import functools | ||
import re | ||
import types | ||
+import inspect | ||
|
||
|
||
# patch for single-file | ||
@@ -71,7 +72,7 @@ def signature(obj): | ||
if not callable(obj): | ||
raise TypeError('{0!r} is not a callable object'.format(obj)) | ||
|
||
- if isinstance(obj, types.MethodType): | ||
+ if inspect.ismethod(obj): | ||
if obj.__self__ is None: | ||
# Unbound method - treat it as a function (no distinction in Py 3) | ||
obj = obj.__func__ | ||
@@ -96,7 +97,7 @@ def signature(obj): | ||
else: | ||
return signature(wrapped) | ||
|
||
- if isinstance(obj, types.FunctionType): | ||
+ if inspect.isfunction(obj): | ||
return Signature.from_function(obj) | ||
|
||
if isinstance(obj, functools.partial): | ||
@@ -511,7 +512,7 @@ def __init__(self, parameters=None, return_annotation=_empty, | ||
def from_function(cls, func): | ||
'''Constructs Signature for the given python function''' | ||
|
||
- if not isinstance(func, types.FunctionType): | ||
+ if not inspect.isfunction(func): | ||
raise TypeError('{0!r} is not a Python function'.format(func)) | ||
|
||
Parameter = cls._parameter_cls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# cython: binding=True | ||
r""" | ||
Mandelbrot and Julia sets (Cython helper) | ||
|