@@ -888,55 +888,3 @@ def translate_ord(builder: IRBuilder, expr: CallExpr, callee: RefExpr) -> Value
888888 if isinstance (arg , (StrExpr , BytesExpr )) and len (arg .value ) == 1 :
889889 return Integer (ord (arg .value ))
890890 return None
891-
892-
893- '''
894- @specialize_function("weakref.ReferenceType")
895- def translate_weakref_ref(builder: IRBuilder, expr: CallExpr, callee: RefExpr) -> Value | None:
896- """
897- Special case for weakref.ref(...).
898-
899- If there's only one argument (the object), pass None for the callback.
900- If there are two arguments, use them as (object, callback).
901- Otherwise, fallback to a normal Python call by returning None.
902- """
903- obj_val = builder.accept(expr.args[0])
904- num_args = len(expr.args)
905- if num_args == 1:
906- callback_val = builder.none_object()
907- elif num_args == 2:
908- callback_val = builder.accept(expr.args[1])
909- else:
910- # If the user supplied something other than 1 or 2 args, just fail
911- # and let MyPyC do a generic Python call.
912- # NOTE: should we raise a compiler error here?
913- return None
914-
915- # Emit a direct C call to PyWeakref_NewProxy
916- return builder.call_c(new_ref_op, [obj_val, callback_val], expr.line)
917-
918-
919- @specialize_function("weakref.proxy")
920- def translate_weakref_proxy(builder: IRBuilder, expr: CallExpr, callee: RefExpr) -> Value | None:
921- """
922- Special case for weakref.proxy(...).
923-
924- If there's only one argument (the object), pass None for the callback.
925- If there are two arguments, use them as (object, callback).
926- Otherwise, fallback to a normal Python call by returning None.
927- """
928- obj_val = builder.accept(expr.args[0])
929- num_args = len(expr.args)
930- if num_args == 1:
931- callback_val = builder.none_object()
932- elif num_args == 2:
933- callback_val = builder.accept(expr.args[1])
934- else:
935- # If the user supplied something other than 1 or 2 args, just fail
936- # and let MyPyC do a generic Python call.
937- # NOTE: should we raise a compiler error here?
938- return None
939-
940- # Emit a direct C call to PyWeakref_NewProxy
941- return builder.call_c(new_proxy_op, [obj_val, callback_val], expr.line)
942- '''
0 commit comments