### cleanup to avoid redundant coercions to/from Python types
- def visit_PyTypeTestNode(self, node):
+ def _visit_PyTypeTestNode(self, node):
+ # disabled - appears to break assignments in some cases, and
+ # also drops a None check, which might still be required
"""Flatten redundant type checks after tree changes.
"""
old_arg = node.arg
# of the extension type and call that instead of the generic slot
func_type = PyrexTypes.CFuncType(
return_type, [
- PyrexTypes.CFuncTypeArg("type", PyrexTypes.py_object_type, None)
+ PyrexTypes.CFuncTypeArg("type", Builtin.type_type, None)
])
if not type_arg.type_entry:
m = MyType.__new__(MyType)
return m
+@cython.test_assert_path_exists('//PythonCapiCallNode')
+@cython.test_fail_if_path_exists('//SimpleCallNode/AttributeNode')
+def make_new_typed_target():
+ """
+ >>> isinstance(make_new_typed_target(), MyType)
+ True
+ """
+ cdef MyType m
+ m = MyType.__new__(MyType)
+ return m
+
@cython.test_assert_path_exists('//PythonCapiCallNode')
@cython.test_fail_if_path_exists('//SimpleCallNode/AttributeNode')
def make_new_builtin():