bpo-31292: Fixed distutils check --restructuredtext for include directives (GH-10605)


diff --git a/Lib/distutils/command/check.py b/Lib/distutils/command/check.py
index 7ebe707..04c2f96 100644
--- a/Lib/distutils/command/check.py
+++ b/Lib/distutils/command/check.py
@@ -120,7 +120,8 @@
 
     def _check_rst_data(self, data):
         """Returns warnings when the provided data doesn't compile."""
-        source_path = StringIO()
+        # the include and csv_table directives need this to be a path
+        source_path = self.distribution.script_name or 'setup.py'
         parser = Parser()
         settings = frontend.OptionParser(components=(Parser,)).get_default_values()
         settings.tab_width = 4