Victor Stinner
0a1b8cba90
_Py_wrealpath() uses _Py_char2wchar() to decode the result, to support
surrogate characters.
16 years ago
Victor Stinner
350147b5ca
_Py_wreadlink(): catch _Py_char2wchar() failure
16 years ago
Victor Stinner
3f711f4a3e
_Py_wreadlink() uses _Py_char2wchar() to decode the result, to support
surrogate characters.
16 years ago
Victor Stinner
2f2ed1f36c
Fix ast_error_finish() and err_input(): filename can be NULL
Fix my previous commit (r85569).
16 years ago
Victor Stinner
4c7c8c3023
Issue #9713 , #10114 : Parser functions (eg. PyParser_ASTFromFile) expects
filenames encoded to the filesystem encoding with surrogateescape error handler
(to support undecodable bytes), instead of UTF-8 in strict mode.
16 years ago
Benjamin Peterson
e9633491ca
Merged revisions 85562 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85562 | benjamin.peterson | 2010-10-15 22:45:45 -0500 (Fri, 15 Oct 2010) | 1 line
don't identify the toplevel namespace by name #9997
........
16 years ago
Benjamin Peterson
230b20684f
don't identify the toplevel namespace by name #9997
16 years ago
Benjamin Peterson
294a9fcba6
fix refleak
16 years ago
Barry Warsaw
8cf4eae522
First (uncontroversial) part of issue 9807.
* Expose the build flags to Python as sys.abiflags
* Shared library libpythonX.Y<abiflags>.so
* python-config --abiflags
* Make two distutils tests that failed with --enable-shared (even before this
patch) succeed.
* Fix a few small style issues.
16 years ago
Victor Stinner
88bd891e6c
Fix imp_cache_from_source(): Decode make_compiled_pathname() result from the
filesystem encoding instead of utf-8.
imp_cache_from_source() encodes the input path to filesystem encoding and this
path is passed to make_compiled_pathname().
16 years ago
Victor Stinner
1a5630326f
imp_load_module() uses PyUnicode_FSConverter() to support surrogates in module
path
16 years ago
Victor Stinner
3ea23ddabf
imp.cache_from_source() uses PyUnicode_FSConverter() to support surrogates in
module path
16 years ago
Victor Stinner
8dbf629bbd
imp.load_dynamic() uses PyUnicode_FSConverter() to support surrogates
in the library path.
16 years ago
Victor Stinner
f3170ccef8
Use locale encoding if Py_FileSystemDefaultEncoding is not set
* PyUnicode_EncodeFSDefault(), PyUnicode_DecodeFSDefaultAndSize() and
PyUnicode_DecodeFSDefault() use the locale encoding instead of UTF-8 if
Py_FileSystemDefaultEncoding is NULL
* redecode_filenames() functions and _Py_code_object_list (issue #9630 )
are no more needed: remove them
16 years ago
Victor Stinner
6a4aff10f0
redecode_filename(): don't need to initialize variables
16 years ago
Victor Stinner
5d1e3438cd
Mark _Py_char2wchar() input argument as constant
16 years ago
Antoine Pitrou
3d400b7a58
Merged revisions 85497 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85497 | antoine.pitrou | 2010-10-14 23:15:17 +0200 (jeu., 14 oct. 2010) | 3 lines
Explicitly close some files (from issue #10093 )
........
16 years ago
Antoine Pitrou
b86680e299
Explicitly close some files (from issue #10093 )
16 years ago
Victor Stinner
f4061dac60
_Py_wgetcwd() decodes the path using _Py_char2wchar() to support surrogates
16 years ago
Victor Stinner
8f6b6b0cc3
Issue #9992 : Remove PYTHONFSENCODING environment variable.
16 years ago
Victor Stinner
a00064576a
ceval.c: catch recursion error on _PyUnicode_AsString(co->co_filename)
16 years ago
Antoine Pitrou
19f8edc39d
Issue #10062 : Allow building on platforms which do not have sem_timedwait.
16 years ago
Victor Stinner
6672d0c5bb
fileutils.c: document which encodings are used
16 years ago
Victor Stinner
015f4d87ab
_Py_wrealpath() requires the size of the output buffer
16 years ago
Victor Stinner
a4a759515e
_Py_stat() and _Py_fopen(): avoid PyUnicode_AsWideCharString() on Windows
On Windows, Py_UNICODE is wchar_t, so we can avoid the expensive Py_UNICODE*
=> wchar_t* conversion.
16 years ago
Victor Stinner
b306d7594f
Fix fileutils for Windows
* Don't define _Py_wstat() on Windows, Windows has its own _wstat() function
with a different API (the stat buffer has another type)
* Include windows.h
16 years ago
Victor Stinner
e7c8083bf1
Ooops, fileutils.c contains twice the same code
I suppose that I reapplied my local patch creating Python/fileutils.c whereas
the file already existed.
16 years ago
Victor Stinner
4e31443c4d
Create fileutils.c/.h
* _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
16 years ago
Victor Stinner
7ae7c87b05
_wrealpath() and _Py_wreadlink() support surrogates (PEP 383)
Use _Py_wchar2char() to support surrogate characters in the input path.
16 years ago
Victor Stinner
beb4135b8c
PyUnicode_AsWideCharString() takes a PyObject*, not a PyUnicodeObject*
All unicode functions uses PyObject* except PyUnicode_AsWideChar(). Fix the
prototype for the new function PyUnicode_AsWideCharString().
16 years ago
Victor Stinner
c08ec9fdba
Create a subfunction for PySys_SetArgvEx()
Create sys_update_path() static function. Do nothing if argc==0.
16 years ago
Amaury Forgeot d'Arc
7955fb638a
Merged revisions 85236 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85236 | amaury.forgeotdarc | 2010-10-06 00:15:37 +0200 (mer., 06 oct. 2010) | 2 lines
#9060 Let platforms without dup2() compile the replacement fonction without error.
........
16 years ago
Amaury Forgeot d'Arc
90774dd47b
#9060 Let platforms without dup2() compile the replacement fonction without error.
16 years ago
Brian Curtin
748cacee46
Remove an unreferenced variable. len is no longer needed.
16 years ago
Victor Stinner
c39211f51e
Issue #9630 : Redecode filenames when setting the filesystem encoding
Redecode the filenames of:
- all modules: __file__ and __path__ attributes
- all code objects: co_filename attribute
- sys.path
- sys.meta_path
- sys.executable
- sys.path_importer_cache (keys)
Keep weak references to all code objects until initfsencoding() is called, to
be able to redecode co_filename attribute of all code objects.
16 years ago
Victor Stinner
255dfdb5ce
Issue #9979 : Use PyUnicode_AsWideCharString() in import.c
Don't truncate path if it is too long anymore, and allocate fewer memory (but
allocate it on the heap, not on the stack).
16 years ago
Brett Cannon
5305a998d5
Since __import__ is not designed for general use, have its docstring point
people towards importlib.import_module().
Closes issue #7397 .
16 years ago
Benjamin Peterson
aa7fbd9564
revert r85003, poorly considered; breaks tests
16 years ago
Benjamin Peterson
81437c9025
don't count keyword arguments as positional #9943
16 years ago
Benjamin Peterson
d4efd9eb15
add column offset to all syntax errors
16 years ago
Benjamin Peterson
2c53971b37
add PyErr_SyntaxLocationEx, to support adding a column offset
16 years ago
Antoine Pitrou
b0b384b7c0
Issue #9901 : Destroying the GIL in Py_Finalize() can fail if some other
threads are still running. Instead, reinitialize the GIL on a second
call to Py_Initialize().
16 years ago
Kristján Valur Jónsson
2fea9b961d
issue 9786 Native TLS support for pthreads
PyThread_create_key now has a failure mode that the applicatino can detect.
16 years ago
Brett Cannon
bc2eff3112
PyImport_Import was using the old import hack of sticking a dummy value into
fromlist to get __import__ to return the module desired. Now it uses the proper
approach of fetching the module from sys.modules.
Closes issue #9252 . Thanks to Alexander Belopolsky for the bug report.
16 years ago
Antoine Pitrou
1df1536fb9
Issue #9828 : Destroy the GIL in Py_Finalize(), so that it gets properly
re-created on a subsequent call to Py_Initialize(). The problem (a crash)
wouldn't appear in 3.1 or 2.7 where the GIL's structure is more trivial.
16 years ago
Nick Coghlan
cd419abe42
Fix incorrect comment regarding MAGIC and TAG in import.c
16 years ago
Benjamin Peterson
e208b7c5b1
typo
16 years ago
Benjamin Peterson
d0de25d731
use Py_REFCNT
16 years ago
Benjamin Peterson
d2be5b4fe4
remove gil_drop_request in --without-threads
16 years ago
Benjamin Peterson
00ebe2cdc4
use DISPATCH() instead of continue
16 years ago