@@ -684,7 +684,6 @@ def test_zippath_from_non_installed_posix(self):
684684        shutil .copy2 (sys .executable , bindir )
685685        libdir  =  os .path .join (non_installed_dir , platlibdir , self .lib [1 ])
686686        os .makedirs (libdir )
687-         landmark  =  os .path .join (libdir , "os.py" )
688687        abi_thread  =  "t"  if  sysconfig .get_config_var ("Py_GIL_DISABLED" ) else  "" 
689688        stdlib_zip  =  f"python{ sys .version_info .major } { sys .version_info .minor } { abi_thread }  
690689        zip_landmark  =  os .path .join (non_installed_dir ,
@@ -748,9 +747,9 @@ def test_zippath_from_non_installed_posix(self):
748747        subprocess .check_call (cmd , env = child_env )
749748        # Now check the venv created from the non-installed python has 
750749        # correct zip path in pythonpath. 
751-         cmd  =  [self .envpy (), '-S' , '-c' , ' import sys; print(sys.path)' 
750+         cmd  =  [self .envpy (), '-S' , '-c' , " import sys; print(' \\ n'.join( sys.path))" 
752751        out , err  =  check_output (cmd )
753-         self .assertTrue (zip_landmark . encode ()  in   out )
752+         self .assertIn (zip_landmark ,  out . decode () )
754753
755754    @unittest .skipIf (os .name  ==  'nt' , 'not relevant on Windows' ) 
756755    @requireVenvCreate  
@@ -764,8 +763,9 @@ def test_venv_from_venv_with_symlink(self):
764763        self .addCleanup (rmtree , public_prefix )
765764        public_bin_dir  =  os .path .join (public_prefix , 'bin' )
766765        os .mkdir (public_bin_dir )
767-         public_exe  =  os .path .join (public_bin_dir , self . exe )
766+         public_exe  =  os .path .join (public_bin_dir , 'python3' )
768767        os .symlink (sys .executable , public_exe )
768+         underlying_prefix  =  sys .base_prefix 
769769        cmd  =  [public_exe ,
770770               "-m" ,
771771               "venv" ,
@@ -796,6 +796,24 @@ def test_venv_from_venv_with_symlink(self):
796796        contents  =  (pathlib .Path (second_venv ) /  'pyvenv.cfg' ).read_text ()
797797        self .assertIn (f'home = { public_bin_dir } \n ' , contents )
798798
799+         # Now validate the important sys values. 
800+         venv2_sys , _  =  check_output (
801+             [os .path .join (second_venv , 'bin' , 'python3' ),
802+              '-S' , '-c' ,
803+              "import sys; print(f'{sys._base_executable=}\\ n{sys.base_exec_prefix=}\\ n{sys.base_prefix=}')" ],
804+             encoding = 'utf8' ,
805+         )
806+         self .assertEqual (
807+             '\n ' .join ([
808+                 # The base executable should be the public one, while the exec_prefix can be the 
809+                 # internal one (and the same as the original interpreter's base_prefix). 
810+                 f"sys._base_executable='{ public_exe }  ,
811+                 f"sys.base_exec_prefix='{ underlying_prefix }  ,
812+                 f"sys.base_prefix='{ underlying_prefix }  ,
813+             ]),
814+             venv2_sys .strip (),
815+         )
816+ 
799817    @requireVenvCreate  
800818    def  test_activate_shell_script_has_no_dos_newlines (self ):
801819        """ 
0 commit comments