Commit 7d9bf36f authored by Mark Florisson's avatar Mark Florisson

Make NotConstant a singleton & fix 2 fused py3k tests

parent 3f76e08f
...@@ -42,8 +42,14 @@ except ImportError: ...@@ -42,8 +42,14 @@ except ImportError:
basestring = str # Python 3 basestring = str # Python 3
class NotConstant(object): class NotConstant(object):
def __deepcopy__(self, memo): _obj = None
return self
def __new__(cls):
if NotConstant._obj is None:
NotConstant._obj = super(NotConstant, cls).__new__(cls)
return NotConstant._obj
def __repr__(self): def __repr__(self):
return "<NOT CONSTANT>" return "<NOT CONSTANT>"
......
...@@ -2499,8 +2499,6 @@ def __pyx_fused_cpdef(signatures, args, kwargs): ...@@ -2499,8 +2499,6 @@ def __pyx_fused_cpdef(signatures, args, kwargs):
return signatures[candidates[0]] return signatures[candidates[0]]
""" % fmt_dict """ % fmt_dict
# print fragment_code
fragment = TreeFragment.TreeFragment(fragment_code, level='module') fragment = TreeFragment.TreeFragment(fragment_code, level='module')
# analyse the declarations of our fragment ... # analyse the declarations of our fragment ...
......
...@@ -94,7 +94,7 @@ def opt_func(fused_t obj, cython.floating myf = 1.2, cython.integral myi = 7): ...@@ -94,7 +94,7 @@ def opt_func(fused_t obj, cython.floating myf = 1.2, cython.integral myi = 7):
Traceback (most recent call last): Traceback (most recent call last):
... ...
TypeError: Function call with ambiguous argument types TypeError: Function call with ambiguous argument types
>>> opt_func[ExtClassA, cy.float, long](object(), f) >>> opt_func[ExtClassA, cy.float, cy.long](object(), f)
Traceback (most recent call last): Traceback (most recent call last):
... ...
TypeError: Argument 'obj' has incorrect type (expected fused_def.ExtClassA, got object) TypeError: Argument 'obj' has incorrect type (expected fused_def.ExtClassA, got object)
...@@ -109,8 +109,7 @@ def test_opt_func(): ...@@ -109,8 +109,7 @@ def test_opt_func():
str object double long str object double long
ham 5.60 4 5.60 9 ham 5.60 4 5.60 9
""" """
cdef char *s = "ham" opt_func("ham", f, entry4)
opt_func(s, f, entry4)
def args_kwargs(fused_t obj, cython.floating myf = 1.2, *args, **kwargs): def args_kwargs(fused_t obj, cython.floating myf = 1.2, *args, **kwargs):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment