bpo-44676: Serialize the union type using only public API (GH-27323) (GH-27340)

Remove also the _from_args() constructor.
(cherry picked from commit 435a0334d341e5f8faed594d9f015746bb7845db)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Lib/copyreg.py b/Lib/copyreg.py
index 7ab8c12..356db6f 100644
--- a/Lib/copyreg.py
+++ b/Lib/copyreg.py
@@ -36,6 +36,12 @@ def pickle_complex(c):
 
     pickle(complex, pickle_complex, complex)
 
+def pickle_union(obj):
+    import functools, operator
+    return functools.reduce, (operator.or_, obj.__args__)
+
+pickle(type(int | str), pickle_union)
+
 # Support for pickling new-style objects
 
 def _reconstructor(cls, base, state):