Lunderberg commented on a change in pull request #8451:
URL: https://github.com/apache/tvm/pull/8451#discussion_r669598493
##########
File path: python/tvm/testing.py
##########
@@ -1160,6 +1162,43 @@ def wraps(func):
return wraps(func)
+class _DeepCopyAllowedClasses(dict):
+ def __init__(self, *allowed_class_list):
+ self.allowed_class_list = allowed_class_list
+ super().__init__()
+
+ def get(self, key, *args, **kwargs):
+ obj = ctypes.cast(key, ctypes.py_object).value
+ cls = type(obj)
+ if (
+ cls in copy._deepcopy_dispatch
+ or issubclass(cls, type)
+ or getattr(obj, "__deepcopy__", None)
+ or copyreg.dispatch_table.get(cls)
+ or cls.__reduce__ is not object.__reduce__
+ or cls.__reduce_ex__ is not object.__reduce_ex__
+ or cls in self.allowed_class_list
+ ):
+ return super().get(key, *args, **kwargs)
+
+ rfc_url = (
+
"https://github.com/apache/tvm-rfcs/blob/main/rfcs/0007-parametrized-unit-tests.md"
+ )
+ raise TypeError(
+ (
+ "Cannot copy fixture of type {}. TVM fixture caching "
Review comment:
Sure. Somehow I had it in my mind that f-strings were added in 3.7, not
3.6, and so I was avoiding them since TVM targets 3.6.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]