Issue #19398: Extra slash no longer added to sys.path components in case of
empty compile-time PYTHONPATH components.  This fixes some tests in -S or -I
modes.
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 18b161c..c42ce31 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -597,7 +597,10 @@
 
             if (defpath[0] != SEP) {
                 strcat(buf, prefix);
-                strcat(buf, separator);
+                if (prefixsz >= 2 && prefix[prefixsz - 2] != SEP &&
+                    defpath[0] != (delim ? DELIM : L'\0')) {  /* not empty */
+                    strcat(buf, separator);
+                }
             }
 
             if (delim) {