| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 225302c commit 9339925
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,7 @@ | |||
| 13 | 13 | from test.support import os_helper | |
| 14 | 14 | from test.support.script_helper import assert_python_ok, assert_python_failure | |
| 15 | 15 | from test.support import threading_helper | |
| 16 | + from test.support import import_helper | ||
| 16 | 17 | import textwrap | |
| 17 | 18 | import unittest | |
| 18 | 19 | import warnings | |
@@ -994,6 +995,15 @@ def test_module_names(self): | |||
| 994 | 995 | for name in sys.stdlib_module_names: | |
| 995 | 996 | self.assertIsInstance(name, str) | |
| 996 | 997 | ||
| 998 | + def test_stdlib_dir(self): | ||
| 999 | + os = import_helper.import_fresh_module('os') | ||
| 1000 | + marker = getattr(os, '__file__', None) | ||
| 1001 | + if marker and not os.path.exists(marker): | ||
| 1002 | + marker = None | ||
| 1003 | + expected = os.path.dirname(marker) if marker else None | ||
| 1004 | + actual = sys._stdlib_dir | ||
| 1005 | + self.assertEqual(actual, expected) | ||
| 1006 | + | ||
| 997 | 1007 | ||
| 998 | 1008 | @test.support.cpython_only | |
| 999 | 1009 | class UnraisableHookTest(unittest.TestCase): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2974,6 +2974,14 @@ _PySys_UpdateConfig(PyThreadState *tstate) | |||
| 2974 | 2974 | ||
| 2975 | 2975 | SET_SYS("_xoptions", sys_create_xoptions_dict(config)); | |
| 2976 | 2976 | ||
| 2977 | + const wchar_t *stdlibdir = _Py_GetStdlibDir(); | ||
| 2978 | + if (stdlibdir != NULL) { | ||
| 2979 | + SET_SYS_FROM_WSTR("_stdlib_dir", stdlibdir); | ||
| 2980 | + } | ||
| 2981 | + else { | ||
| 2982 | + PyDict_SetItemString(sysdict, "_stdlib_dir", Py_None); | ||
| 2983 | + } | ||
| 2984 | + | ||
| 2977 | 2985 | #undef SET_SYS_FROM_WSTR | |
| 2978 | 2986 | #undef COPY_LIST | |
| 2979 | 2987 | #undef COPY_WSTR | |
| Back | FazBrowse Home | New Git URL |
0 commit comments