Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test_embed fails if --exec-prefix and --prefix differ #151096

Description

@djerius

Bug report

Bug description:

I've configured the Python build with separate --exec and --exec-prefix arguments as follows

./config.status --config:
--prefix=/proj/axaf/ots/python-3.14.5 --exec-prefix=/proj/axaf/ots/python-3.14.5/x86_64-linux_RHEL-8 --enable-optimizations PKG_CONFIG_PATH=/proj/axaf/ots/lib/pkgconfig:/proj/axaf/ots/x86_64-linux_RHEL-8/lib/pkgconfig:/proj/axaf/simul/lib/pkgconfig:/proj/axaf/simul/x86_64-linux_RHEL-8/lib/pkgconfig:/proj/axaf/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig CC=/usr/bin/gcc

The build succeeds, and all tests pass except for test_embed. The full output of ./python -m test test_embed -v is at the end of this report (uploading the file failed). Partial output showing the specific error is:

======================================================================
FAIL: test_init_is_python_build_with_home (test.test_embed.InitConfigTests.test_init_is_python_build_with_home)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/pool/dj/python/Python-3.14.5/Lib/test/test_embed.py", line 1560, in test_init_is_python_build_with_home
    self.check_all_configs("test_init_is_python_build", config,
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                           api=API_COMPAT, env=env)
                           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pool/dj/python/Python-3.14.5/Lib/test/test_embed.py", line 991, in check_all_configs
    self.check_config(configs, expected_config)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pool/dj/python/Python-3.14.5/Lib/test/test_embed.py", line 917, in check_config
    self.assertEqual(config, expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
AssertionError: {'argv': [''], 'base_exec_prefix': '/proj/a[2170 chars]None} != {'_config_init': 1, 'isolated': False, 'use[2130 chars]True}
  {'_config_init': 1,
   '_init_main': True,
   '_install_importlib': True,
   '_is_python_build': True,
   'argv': [''],
-  'base_exec_prefix': '/proj/axaf/ots/python-3.14.5/x86_64-linux_RHEL-8',
?                                                   --------------------

+  'base_exec_prefix': '/proj/axaf/ots/python-3.14.5',
[...]
-  'exec_prefix': '/proj/axaf/ots/python-3.14.5/x86_64-linux_RHEL-8',
?                                              --------------------

+  'exec_prefix': '/proj/axaf/ots/python-3.14.5',
Full log:

== CPython 3.14.5 (main, Jun 8 2026, 12:36:01) [GCC 8.5.0 20210514 (Red Hat 8.5.0-28)]
== Linux-4.18.0-553.123.1.el8_10.x86_64-x86_64-with-glibc2.28 little-endian
== Python build: release PGO
== cwd: /pool/dj/python/Python-3.14.5/build/test_python_worker_1942477æ
== CPU count: 256
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests

Using random seed: 3488175452
0:00:00 load avg: 1.58 Run 1 test sequentially in a single process
0:00:00 load avg: 1.58 [1/1] test_embed
test_audit (test.test_embed.AuditingTests.test_audit) ... ok
test_audit_run_command (test.test_embed.AuditingTests.test_audit_run_command) ... ok
test_audit_run_file (test.test_embed.AuditingTests.test_audit_run_file) ... ok
test_audit_run_interactivehook (test.test_embed.AuditingTests.test_audit_run_interactivehook) ... ok
test_audit_run_startup (test.test_embed.AuditingTests.test_audit_run_startup) ... ok
test_audit_run_stdin (test.test_embed.AuditingTests.test_audit_run_stdin) ... ok
test_audit_subinterpreter (test.test_embed.AuditingTests.test_audit_subinterpreter) ... ok
test_audit_tuple (test.test_embed.AuditingTests.test_audit_tuple) ... ok
test_get_incomplete_frame (test.test_embed.AuditingTests.test_get_incomplete_frame) ... ok
test_open_code_hook (test.test_embed.AuditingTests.test_open_code_hook) ... ok
test_bpo20891 (test.test_embed.EmbeddingTests.test_bpo20891)
bpo-20891: Calling PyGILState_Ensure in a non-Python thread must not ... ok
test_datetime_reset_strptime (test.test_embed.EmbeddingTests.test_datetime_reset_strptime) ... ok
test_finalize_structseq (test.test_embed.EmbeddingTests.test_finalize_structseq) ... ok
test_forced_io_encoding (test.test_embed.EmbeddingTests.test_forced_io_encoding) ... ok
test_getargs_reset_static_parser (test.test_embed.EmbeddingTests.test_getargs_reset_static_parser) ... ok
test_initialize_pymain (test.test_embed.EmbeddingTests.test_initialize_pymain)
bpo-34008: Calling Py_Main() after Py_Initialize() must not fail. ... ok
test_initialize_twice (test.test_embed.EmbeddingTests.test_initialize_twice)
bpo-33932: Calling Py_Initialize() twice should do nothing (and not ... ok
test_inittab_submodule_multiphase (test.test_embed.EmbeddingTests.test_inittab_submodule_multiphase) ... ok
test_inittab_submodule_singlephase (test.test_embed.EmbeddingTests.test_inittab_submodule_singlephase) ... ok
test_pre_initialization_api (test.test_embed.EmbeddingTests.test_pre_initialization_api)
Checks some key parts of the C-API that need to work before the runtime ... ok
test_pre_initialization_sys_options (test.test_embed.EmbeddingTests.test_pre_initialization_sys_options)
Checks that sys.warnoptions and sys._xoptions can be set before the ... ok
test_repeated_init_and_inittab (test.test_embed.EmbeddingTests.test_repeated_init_and_inittab) ... ok
test_run_main (test.test_embed.EmbeddingTests.test_run_main) ... ok
test_run_main_loop (test.test_embed.EmbeddingTests.test_run_main_loop) ... ok
test_simple_initialization_api (test.test_embed.EmbeddingTests.test_simple_initialization_api) ... ok
test_specialized_static_code_gets_unspecialized_at_Py_FINALIZE (test.test_embed.EmbeddingTests.test_specialized_static_code_gets_unspecialized_at_Py_FINALIZE) ... ok
test_static_types_inherited_slots (test.test_embed.EmbeddingTests.test_static_types_inherited_slots) ... ok
test_subinterps_different_ids (test.test_embed.EmbeddingTests.test_subinterps_different_ids) ... ok
test_subinterps_distinct_state (test.test_embed.EmbeddingTests.test_subinterps_distinct_state) ... ok
test_subinterps_main (test.test_embed.EmbeddingTests.test_subinterps_main) ... ok
test_ucnhash_capi_reset (test.test_embed.EmbeddingTests.test_ucnhash_capi_reset) ... ok
test_get_argc_argv (test.test_embed.InitConfigTests.test_get_argc_argv) ... ok
test_getpath_abspath_win32 (test.test_embed.InitConfigTests.test_getpath_abspath_win32) ... skipped 'specific to Windows'
test_global_pathconfig (test.test_embed.InitConfigTests.test_global_pathconfig) ... ok
test_init_compat_config (test.test_embed.InitConfigTests.test_init_compat_config) ... ok
test_init_compat_env (test.test_embed.InitConfigTests.test_init_compat_env) ... skipped 'segfaults on BOLT instrumented binaries'
test_init_default_config (test.test_embed.InitConfigTests.test_init_default_config) ... skipped 'segfaults on BOLT instrumented binaries'
test_init_dev_mode (test.test_embed.InitConfigTests.test_init_dev_mode) ... ok
test_init_dont_configure_locale (test.test_embed.InitConfigTests.test_init_dont_configure_locale) ... ok
test_init_dont_parse_argv (test.test_embed.InitConfigTests.test_init_dont_parse_argv) ... ok
test_init_env_dev_mode (test.test_embed.InitConfigTests.test_init_env_dev_mode) ... ok
test_init_env_dev_mode_alloc (test.test_embed.InitConfigTests.test_init_env_dev_mode_alloc) ... ok
test_init_from_config (test.test_embed.InitConfigTests.test_init_from_config) ... ok
test_init_global_config (test.test_embed.InitConfigTests.test_init_global_config) ... ok
test_init_in_background_thread (test.test_embed.InitConfigTests.test_init_in_background_thread) ... ok
test_init_is_python_build_with_home (test.test_embed.InitConfigTests.test_init_is_python_build_with_home) ... FAIL
test_init_isolated_config (test.test_embed.InitConfigTests.test_init_isolated_config) ... ok
test_init_isolated_flag (test.test_embed.InitConfigTests.test_init_isolated_flag) ... ok
test_init_main_interpreter_settings (test.test_embed.InitConfigTests.test_init_main_interpreter_settings) ... ok
test_init_parse_argv (test.test_embed.InitConfigTests.test_init_parse_argv) ... ok
test_init_pybuilddir (test.test_embed.InitConfigTests.test_init_pybuilddir) ... ok
test_init_pybuilddir_win32 (test.test_embed.InitConfigTests.test_init_pybuilddir_win32) ... skipped 'See test_init_pybuilddir'
test_init_python_config (test.test_embed.InitConfigTests.test_init_python_config) ... ok
test_init_python_env (test.test_embed.InitConfigTests.test_init_python_env) ... skipped 'segfaults on BOLT instrumented binaries'
test_init_pyvenv_cfg (test.test_embed.InitConfigTests.test_init_pyvenv_cfg) ... ok
test_init_read_set (test.test_embed.InitConfigTests.test_init_read_set) ... skipped 'as of 3.11 this test no longer works because path calculations do not occur on read'
test_init_run_main (test.test_embed.InitConfigTests.test_init_run_main) ... ok
test_init_setpath (test.test_embed.InitConfigTests.test_init_setpath) ... ok
test_init_setpath_config (test.test_embed.InitConfigTests.test_init_setpath_config) ... ok
test_init_setpythonhome (test.test_embed.InitConfigTests.test_init_setpythonhome) ... ok
test_init_sys_add (test.test_embed.InitConfigTests.test_init_sys_add) ... ok
test_init_use_frozen_modules (test.test_embed.InitConfigTests.test_init_use_frozen_modules) ... ok
test_init_warnoptions (test.test_embed.InitConfigTests.test_init_warnoptions) ... ok
test_initconfig_api (test.test_embed.InitConfigTests.test_initconfig_api) ... skipped 'segfaults on BOLT instrumented binaries'
test_initconfig_exit (test.test_embed.InitConfigTests.test_initconfig_exit) ... ok
test_initconfig_get_api (test.test_embed.InitConfigTests.test_initconfig_get_api) ... ok
test_initconfig_module (test.test_embed.InitConfigTests.test_initconfig_module) ... ok
test_preinit_compat_config (test.test_embed.InitConfigTests.test_preinit_compat_config) ... ok
test_preinit_dont_parse_argv (test.test_embed.InitConfigTests.test_preinit_dont_parse_argv) ... ok
test_preinit_isolated1 (test.test_embed.InitConfigTests.test_preinit_isolated1) ... ok
test_preinit_isolated2 (test.test_embed.InitConfigTests.test_preinit_isolated2) ... ok
test_preinit_isolated_config (test.test_embed.InitConfigTests.test_preinit_isolated_config) ... ok
test_preinit_parse_argv (test.test_embed.InitConfigTests.test_preinit_parse_argv) ... ok
test_preinit_python_config (test.test_embed.InitConfigTests.test_preinit_python_config) ... ok
test_frozenmain (test.test_embed.MiscTests.test_frozenmain) ... ok
test_no_memleak (test.test_embed.MiscTests.test_no_memleak) ... skipped '-X showrefcount requires a Python debug build'
test_presite (test.test_embed.MiscTests.test_presite) ... skipped '-X presite requires a Python debug build'
test_unicode_id_init (test.test_embed.MiscTests.test_unicode_id_init) ... ok

======================================================================
FAIL: test_init_is_python_build_with_home (test.test_embed.InitConfigTests.test_init_is_python_build_with_home)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/pool/dj/python/Python-3.14.5/Lib/test/test_embed.py", line 1560, in test_init_is_python_build_with_home
    self.check_all_configs("test_init_is_python_build", config,
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                           api=API_COMPAT, env=env)
                           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pool/dj/python/Python-3.14.5/Lib/test/test_embed.py", line 991, in check_all_configs
    self.check_config(configs, expected_config)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/pool/dj/python/Python-3.14.5/Lib/test/test_embed.py", line 917, in check_config
    self.assertEqual(config, expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
AssertionError: {'argv': [''], 'base_exec_prefix': '/proj/a[2170 chars]None} != {'_config_init': 1, 'isolated': False, 'use[2130 chars]True}
  {'_config_init': 1,
   '_init_main': True,
   '_install_importlib': True,
   '_is_python_build': True,
   'argv': [''],
-  'base_exec_prefix': '/proj/axaf/ots/python-3.14.5/x86_64-linux_RHEL-8',
?                                                   --------------------

+  'base_exec_prefix': '/proj/axaf/ots/python-3.14.5',
   'base_executable': '/pool/dj/python/Python-3.14.5/_testembed',
   'base_prefix': '/proj/axaf/ots/python-3.14.5',
   'buffered_stdio': True,
   'bytes_warning': 0,
   'check_hash_pycs_mode': 'default',
   'code_debug_ranges': True,
   'configure_c_stdio': False,
   'context_aware_warnings': 0,
   'cpu_count': -1,
   'dev_mode': False,
   'dump_refs': False,
   'dump_refs_file': None,
-  'exec_prefix': '/proj/axaf/ots/python-3.14.5/x86_64-linux_RHEL-8',
?                                              --------------------

+  'exec_prefix': '/proj/axaf/ots/python-3.14.5',
   'executable': '/pool/dj/python/Python-3.14.5/_testembed',
   'faulthandler': False,
   'hash_seed': 0,
   'home': '/pool/dj/python/Python-3.14.5',
   'import_time': 0,
   'inspect': False,
   'install_signal_handlers': True,
   'int_max_str_digits': 4300,
   'interactive': False,
   'isolated': False,
   'malloc_stats': False,
   'module_search_paths': ['/proj/axaf/ots/python-3.14.5/lib/python314.zip',
                           '/pool/dj/python/Python-3.14.5/Lib',
                           '/pool/dj/python/Python-3.14.5/build/lib.linux-x86_64-3.14',
                           '/proj/axaf/ots/python-3.14.5/lib/python314.zip',
                           '/pool/dj/python/Python-3.14.5/lib/python3.14',
                           '/pool/dj/python/Python-3.14.5/build/lib.linux-x86_64-3.14'],
   'module_search_paths_set': True,
   'optimization_level': 0,
   'orig_argv': [],
   'parse_argv': False,
   'parser_debug': False,
   'pathconfig_warnings': True,
   'perf_profiling': 0,
   'platlibdir': 'lib',
   'prefix': '/proj/axaf/ots/python-3.14.5',
   'program_name': './_testembed',
   'pycache_prefix': None,
   'pythonpath_env': '/proj/axaf/ots/python-3.14.5/lib/python314.zip:/pool/dj/python/Python-3.14.5/Lib:/pool/dj/python/Python-3.14.5/build/lib.linux-x86_64-3.14',
   'quiet': False,
   'remote_debug': True,
   'run_command': None,
   'run_filename': None,
   'run_module': None,
   'safe_path': False,
   'show_ref_count': False,
   'site_import': True,
   'skip_source_first_line': False,
   'stdlib_dir': '/pool/dj/python/Python-3.14.5/lib/python3.14',
   'sys_path_0': None,
   'thread_inherit_context': 0,
   'tracemalloc': 0,
   'use_environment': True,
   'use_frozen_modules': True,
   'use_hash_seed': False,
   'user_site_directory': True,
   'verbose': 0,
   'warn_default_encoding': False,
   'warnoptions': [],
   'write_bytecode': True,
   'xoptions': {}}

----------------------------------------------------------------------
Ran 78 tests in 3.088s

FAILED (failures=1, skipped=9)
test test_embed failed
0:00:03 load avg: 1.78 [1/1/1] test_embed failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
    test_embed

Total duration: 3.1 sec
Total tests: run=78 failures=1 skipped=9
Total test files: run=1/1 failed=1
Result: FAILURE

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions