Issue #22915: SAX parser now supports files opened with file descriptor or
bytes path.
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py
index 74de9b0..1d3d0ec 100644
--- a/Lib/xml/sax/saxutils.py
+++ b/Lib/xml/sax/saxutils.py
@@ -346,7 +346,7 @@
         f = source
         source = xmlreader.InputSource()
         source.setByteStream(f)
-        if hasattr(f, "name"):
+        if hasattr(f, "name") and isinstance(f.name, str):
             source.setSystemId(f.name)
 
     if source.getByteStream() is None: