summaryrefslogtreecommitdiff
path: root/Modules/getpath.c
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-32030: Fix calculate_path() on macOS (#4526)Victor Stinner2017-11-231-8/+9
|
* bpo-32030: Rewrite calculate_path() (#4521)Victor Stinner2017-11-231-338/+517
| | | | | | | | | | | | | | | | | * calculate_path() rewritten in Modules/getpath.c and PC/getpathp.c * Move global variables into a new PyPathConfig structure. * calculate_path(): * Split the huge calculate_path() function into subfunctions. * Add PyCalculatePath structure to pass data between subfunctions. * Document PyCalculatePath fields. * Move cleanup code into a new calculate_free() subfunction * calculate_init() now handles Py_DecodeLocale() failures properly * calculate_path() is now atomic: only replace PyPathConfig (path_config) at once on success. * _Py_GetPythonHomeWithConfig() now returns an error on failure * Add _Py_INIT_NO_MEMORY() helper: report a memory allocation failure * Coding style fixes (PEP 7)
* bpo-32030: Add _PyMainInterpreterConfig.pythonhome (#4513)Victor Stinner2017-11-231-3/+3
| | | | | | | | | | | | * Py_Main() now reads the PYTHONHOME environment variable * Add _Py_GetPythonHomeWithConfig() private function * Add _PyWarnings_InitWithConfig() * init_filters() doesn't get the current core configuration from the current interpreter or Python thread anymore. Pass explicitly the configuration to _PyWarnings_InitWithConfig(). * _Py_InitializeCore() now fails on _PyWarnings_InitWithConfig() failure. * Pass configuration as constant
* bpo-32030: Move PYTHONPATH to _PyMainInterpreterConfig (#4511)Victor Stinner2017-11-231-9/+9
| | | | Move _PyCoreConfig.module_search_path_env to _PyMainInterpreterConfig structure.
* bpo-32030: Add _PyCoreConfig.module_search_path_env (#4504)Victor Stinner2017-11-231-18/+43
| | | | | | | | | | | Changes: * Py_Main() initializes _PyCoreConfig.module_search_path_env from the PYTHONPATH environment variable. * PyInterpreterState_New() now initializes core_config and config fields * Compute sys.path a little bit ealier in _Py_InitializeMainInterpreter() and new_interpreter() * Add _Py_GetPathWithConfig() private function.
* bpo-31532: Fix memory corruption due to allocator mix (#3679)nurelin2017-09-201-1/+1
| | | | | | | | | | | | Fix a memory corruption in getpath.c due to mixed memory allocators between Py_GetPath() and Py_SetPath(). The fix use the Raw allocator to mimic the windows version. This patch should be used from python3.6 to the current version for more details, see the bug report and https://github.com/pyinstaller/pyinstaller/issues/2812
* Issue #19398: Extra slash no longer added to sys.path components in case ofSerhiy Storchaka2016-11-111-1/+4
|\ | | | | | | | | empty compile-time PYTHONPATH components. This fixes some tests in -S or -I modes.
| * Issue #19398: Extra slash no longer added to sys.path components in case ofSerhiy Storchaka2016-11-111-1/+4
| | | | | | | | | | empty compile-time PYTHONPATH components. This fixes some tests in -S or -I modes.
* | merge 3.5Benjamin Peterson2016-06-021-19/+2
|\ \ | |/
| * remove (hilarious) defaults for various constants getpath.c needsBenjamin Peterson2016-06-021-19/+2
| |
* | Issue #25923: Added the const qualifier to static constant arrays.Serhiy Storchaka2015-12-251-2/+2
|/
* Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-3/+2
| | | | | | The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.
* Issue #23753: Move _Py_wstat() from Python/fileutils.c to Modules/getpath.cVictor Stinner2015-03-241-0/+17
| | | | | | | I expected more users of _Py_wstat(), but in practice it's only used by Modules/getpath.c. Move the function because it's not needed on Windows. Windows uses PC/getpathp.c which uses the Win32 API (ex: GetFileAttributesW()) not the POSIX API.
* Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integerSerhiy Storchaka2015-02-161-1/+1
|\ | | | | | | overflows. Added few missed PyErr_NoMemory().
| * Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integerSerhiy Storchaka2015-02-161-1/+1
| | | | | | | | overflows. Added few missed PyErr_NoMemory().
* | Issue #17095: merge from 3.4Ned Deily2014-09-141-14/+0
|\ \ | |/
| * Issue #17095: Temporarily revert getpath.c change that added the ModulesNed Deily2014-09-141-14/+0
| | | | | | | | | | | | directory to sys.path when running from a build directory. That has proven to be problematic for several standard library modules with C extension modules whose builds can fail on some platforms.
* | Issue #18395: Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, renameVictor Stinner2014-08-011-8/+8
|/ | | | | ``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document these functions.
* Issue #17095: Fix Modules/Setup *shared* support.Ned Deily2014-06-021-0/+14
| | | | Original patch by Thomas Wouters.
* Issue #16136: Remove VMS support and VMS-related codeChristian Heimes2013-12-211-5/+1
|
* calculate_path() now fails with a fatal error when it fails to allocate memoryVictor Stinner2013-11-161-49/+40
| | | | for module_search_path. It was already the case on _Py_char2wchar() failure.
* Don't mix wide character strings and byte strings (L"lib/python" VERSION): useVictor Stinner2013-11-161-6/+13
| | | | | | | _Py_char2wchar() to decode lib_python instead. Some compilers don't support concatenating literals: L"wide" "bytes". Example: IRIX compiler.
* Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0],Christian Heimes2013-07-221-4/+12
|\ | | | | | | prefix and exec_prefix if the operation system does not obey MAXPATHLEN.
| * Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0],Christian Heimes2013-07-221-4/+12
| | | | | | | | prefix and exec_prefix if the operation system does not obey MAXPATHLEN.
* | Issue #18203: Replace malloc() with PyMem_RawMalloc() at Python initializationVictor Stinner2013-07-071-11/+9
| | | | | | | | | | | | | | * Replace malloc() with PyMem_RawMalloc() * Replace PyMem_Malloc() with PyMem_RawMalloc() where the GIL is not held. * _Py_char2wchar() now returns a buffer allocated by PyMem_RawMalloc(), instead of PyMem_Malloc()
* | Issue #16309: Make PYTHONPATH= behavior the same as if PYTHONPATH not set at ↵Andrew Svetlov2012-11-031-3/+1
|/ | | | | | all. Thanks to Armin Rigo and Alexey Kachayev.
* Closes #15307: symlinks now work on OS X with framework Python builds. ↵Vinay Sajip2012-07-171-4/+12
| | | | Patch by Ronald Oussoren.
* Implemented PEP 405 (Python virtual environments).Vinay Sajip2012-05-261-0/+86
|
* calculate_path() decodes the PYTHONPATH environment variable from the localeVictor Stinner2011-06-201-7/+9
| | | | | | encoding using _Py_char2wchar() instead of mbstowcs() to store undecodable bytes as surrogates characters (PEP 383) instead of ignoring silently the PYTHONPATH variable.
* Issue #10914: fix bogus memory management in Modules/getpath.c, leading to a ↵Antoine Pitrou2011-03-171-3/+7
| | | | possible crash when calling Py_SetPath()
* Merge branches/pep-0384.Martin v. Löwis2010-12-031-1/+1
|
* getpath.c: fix test to detech PyUnicode_AsWideChar() failureVictor Stinner2010-11-101-4/+4
| | | | | | PyUnicode_AsWideChar() result is signed, whereas it was stored in a unsigned variable, and then the test was "n >= 0" which is always true to an unsigned number. Patch written by Hallvard B Furuseth.
* Issue #6011: decode PREFIX, EXEC_PREFIX and PYTHONPATH variables usingVictor Stinner2010-11-081-17/+30
| | | | | _Py_char2wchar(), instead of L"" VAR hack, to escape undecodable bytes using the surrogateescape error handler.
* Issue #6011: getpath: decode VPATH env var from the locale encodingVictor Stinner2010-10-231-7/+10
| | | | | | Instead of casting it to wchar_t* without conversion. It fixes a bug if Python is compiled a non-ascii directory, different than the source code directory, with C locale.
* Oops, fix my previous commit (r85583) on calculate_path()Victor Stinner2010-10-161-4/+7
| | | | path value may be changed, so keep a copy in a new variable.
* calculate_path(): use _Py_char2wchar() to decode the PATH environment variable,Victor Stinner2010-10-161-9/+4
| | | | to support surrogate characters
* _Py_wgetcwd() decodes the path using _Py_char2wchar() to support surrogatesVictor Stinner2010-10-141-6/+6
|
* copy_absolute() keeps the relative path on _Py_wgetcwd() failureVictor Stinner2010-10-071-2/+5
| | | | | .. instead of raising a fatal error. Even if the current directory was deleted, use relative paths may still work (eg. run Python with "../python").
* copy_absolute() raises a fatal error on _Py_wgetcwd() failureVictor Stinner2010-10-071-1/+2
|
* Create fileutils.c/.hVictor Stinner2010-10-071-77/+4
| | | | | | | * _Py_fopen() and _Py_stat() come from Python/import.c * (_Py)_wrealpath() comes from Python/sysmodule.c * _Py_char2wchar(), _Py_wchar2char() and _Py_wfopen() come from Modules/main.c * (_Py)_wstat(), (_Py)_wgetcwd(), _Py_wreadlink() come from Modules/getpath.c
* _wrealpath() and _Py_wreadlink() support surrogates (PEP 383)Victor Stinner2010-10-071-3/+6
| | | | Use _Py_wchar2char() to support surrogate characters in the input path.
* issue 9910Kristján Valur Jónsson2010-09-271-0/+20
| | | | Add a Py_SetPath api to override magic path computations when starting up python.
* Fix indentation in Modules/getpath.cAntoine Pitrou2010-08-141-59/+59
|
* Add comments about Windows in Modules/getpath.cAntoine Pitrou2010-08-141-2/+7
|
* Kill a gcc warning introduced by r83988Victor Stinner2010-08-141-1/+2
|
* Create _Py_wchar2char() function, reverse of _Py_char2wchar()Victor Stinner2010-08-131-4/+7
| | | | | * Use _Py_wchar2char() in _wstat() and _Py_wfopen() * Document _Py_char2wchar()
* Reimplement addbuilddir() in C inside getpath.c, so as to execute itAntoine Pitrou2010-08-131-4/+27
| | | | | at interpreter startup before importing any non-builtin modules. Should fix #9589.
* Ensure that sys.prefix can reliably be foundRonald Oussoren2010-07-231-1/+1
| | | | | | | | | | | | | on OSX. This fixes a small issue that was exposed by running test_subprocess through regrtest (and hence in a subdirectory). Without this patch running python.exe from the build tree will fail when these tree conditions are true: 1) the CWD is not the root of build tree 2) python.exe is found through $PATH 3) the framework is not yet installed
* Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-85/+85
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* Merged revisions 78835-78837 via svnmerge fromVictor Stinner2010-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78835 | victor.stinner | 2010-03-11 13:34:39 +0100 (jeu., 11 mars 2010) | 7 lines Issue #7774: Set sys.executable to an empty string if argv[0] has been set to an non existent program name and Python is unable to retrieve the real program name. Fix also sysconfig: if sys.executable is an empty string, use the current working directory. ........ r78836 | victor.stinner | 2010-03-11 14:27:35 +0100 (jeu., 11 mars 2010) | 4 lines Fix test_executable introduce in previous commit (r78835): Windows is able to retrieve the absolute Python path even if argv[0] has been set to a non existent program name. ........ r78837 | victor.stinner | 2010-03-11 14:46:06 +0100 (jeu., 11 mars 2010) | 3 lines Another fix to test_executable() of test_sys: set the current working to avoid the #7774 bug. ........