Martin Panter
6f9b010242
Fix a couple of typos in code comments
10 years ago
Victor Stinner
bc5b80bac1
Close #24784 : Fix compilation without thread support
Add "#ifdef WITH_THREAD" around cals to:
* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
10 years ago
Victor Stinner
92f0113701
Close #24784 : Fix compilation without thread support
Add "#ifdef WITH_THREAD" around cals to:
* PyGILState_Check()
* _PyImport_AcquireLock()
* _PyImport_ReleaseLock()
10 years ago
Steve Dower
8fc8980c96
Issue #23524 : Replace _PyVerify_fd function with calls to _set_thread_local_invalid_parameter_handler.
11 years ago
Victor Stinner
6f4fae8a95
Issue #23836 : Document functions releasing the GIL in fileutils.c
11 years ago
Victor Stinner
82c3e4599d
Issue #23836 : Add _Py_write_noraise() function
Helper to write() which retries write() if it is interrupted by a signal (fails
with EINTR).
11 years ago
Victor Stinner
e134a7fe36
Issue #23752 : _Py_fstat() is now responsible to raise the Python exception
Add _Py_fstat_noraise() function when a Python exception is not welcome.
11 years ago
Victor Stinner
91afbb6088
Issue #23753 : Move _Py_wstat() from Python/fileutils.c to Modules/getpath.c
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.
11 years ago
Victor Stinner
f329878e74
Issue #23753 : Python doesn't support anymore platforms without stat() or
fstat(), these functions are always required.
Remove HAVE_STAT and HAVE_FSTAT defines, and stop supporting DONT_HAVE_STAT and
DONT_HAVE_FSTAT.
11 years ago
Victor Stinner
a3c0202eb5
Issue #23708 : Save/restore errno in _Py_read() and _Py_write()
Save and then restore errno because PyErr_CheckSignals() and
PyErr_SetFromErrno() can modify it.
11 years ago
Victor Stinner
7f04d4d4b7
Issue #23708 : Split assertion expression in two assertions in _Py_read() and
_Py_write() to know which test failed on the buildbot "AMD64 Snow Leop 3.x".
11 years ago
Victor Stinner
c1cf4f7ef9
Issue #23708 : Fix _Py_read() compilation error on Windows
Fix typo: self->fd => fd
11 years ago
Victor Stinner
66aab0c4b5
Issue #23708 : Add _Py_read() and _Py_write() functions to factorize code handle
EINTR error and special cases for Windows.
These functions now truncate the length to PY_SSIZE_T_MAX to have a portable
and reliable behaviour. For example, read() result is undefined if counter is
greater than PY_SSIZE_T_MAX on Linux.
11 years ago
Victor Stinner
a47fc5c2dd
Issue #23694 : Handle EINTR in _Py_open() and _Py_fopen_obj()
Retry open()/fopen() if it fails with EINTR and the Python signal handler
doesn't raise an exception.
11 years ago
Victor Stinner
e42ccd2bfd
Issue #23694 : Enhance _Py_fopen(), it now raises an exception on error
* If fopen() fails, OSError is raised with the original filename object.
* The GIL is now released while calling fopen()
11 years ago
Victor Stinner
a555cfcb73
Issue #23694 : Enhance _Py_open(), it now raises exceptions
* _Py_open() now raises exceptions on error. If open() fails, it raises an
OSError with the filename.
* _Py_open() now releases the GIL while calling open()
* Add _Py_open_noraise() when _Py_open() cannot be used because the GIL is not
held
11 years ago
Steve Dower
41e7244c06
Fixes incorrect use of GetLastError where errno should be used.
11 years ago
Steve Dower
8acde7dcce
Issue #23524 : Change back to using Windows errors for _Py_fstat instead of the errno shim.
11 years ago
Steve Dower
d81431f587
Issue #23524 : Replace _PyVerify_fd function with calling _set_thread_local_invalid_parameter_handler on every thread.
11 years ago
Steve Dower
bf1f376b3e
Issue #23152 : Renames time_t_to_FILE_TIME to _Py_time_t_to_FILE_TIME, removes unused struct win32_stat and return value
11 years ago
Steve Dower
a2af1a5a5a
Issue #23152 : Renames attribute_data_to_stat to _Py_attribute_data_to_stat
11 years ago
Steve Dower
f2f373f593
Issue #23152 : Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
11 years ago
Benjamin Peterson
f18bf6fd2d
add some overflow checks before multiplying ( closes #23165 )
11 years ago
Victor Stinner
282124b8c4
Closes #22258 : Fix the the internal function set_inheritable() on Illumos.
This platform exposes the function ioctl(FIOCLEX), but calling it fails with
errno is ENOTTY: "Inappropriate ioctl for device". set_inheritable() now falls
back to the slower fcntl() (F_GETFD and then F_SETFD).
12 years ago
Victor Stinner
f6a271ae98
Issue #18395 : Rename ``_Py_char2wchar()`` to func:`Py_DecodeLocale`, rename
``_Py_wchar2char()`` to func:`Py_EncodeLocale`, and document these
functions.
12 years ago
Victor Stinner
1db9e7bb19
Issue #22054 : Add os.get_blocking() and os.set_blocking() functions to get and
set the blocking mode of a file descriptor (False if the O_NONBLOCK flag is
set, True otherwise). These functions are not available on Windows.
12 years ago
Stefan Krah
6c01e38677
Issue #19036 : Including locale.h should not depend on HAVE_LANGINFO_H.
12 years ago
Victor Stinner
b11d6cb711
fileutils.c: use MAXPATHLEN instead of PATH_MAX
PATH_MAX is not declared on IRIX nor Windows.
12 years ago
Stefan Krah
49d0479357
Add unused third arg for the benefit of Valgrind.
12 years ago
Antoine Pitrou
409b53840b
Don't export internal symbols ("make smelly")
12 years ago
Victor Stinner
b034eee711
Close #18954 : Fix some typo in fileutils.c comments
Patch written by Vajrasky Kok.
13 years ago
Victor Stinner
daf455554b
Issue #18571 : Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
13 years ago
Victor Stinner
65bf9cf26f
Issue #18203 : Fix decode_ascii_surrogateescape(), use PyMem_RawMalloc() as _Py_char2wchar()
13 years ago
Victor Stinner
1a7425f67a
Issue #18203 : Replace malloc() with PyMem_RawMalloc() at Python initialization
* 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()
13 years ago
Victor Stinner
14b9b11098
If MS_WIN64 is defined, MS_WINDOWS is also defined: #ifdef can be simplified.
13 years ago
Victor Stinner
56785eab33
Issue #9566 : Fix compiler warning on Windows 64-bit
13 years ago
Victor Stinner
313f10c722
Fix a compiler warning: in and out are unused in _Py_char2wchar() if
HAVE_MBRTOWC is not defined
13 years ago
Philip Jenvey
215c49a509
thinko
13 years ago
Victor Stinner
20b654acb5
Issue #16455 : On FreeBSD and Solaris, if the locale is C, the
ASCII/surrogateescape codec is now used, instead of the locale encoding, to
decode the command line arguments. This change fixes inconsistencies with
os.fsencode() and os.fsdecode() because these operating systems announces an
ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
13 years ago
Victor Stinner
d45c7f8d74
Issue #16455 : On FreeBSD and Solaris, if the locale is C, the
ASCII/surrogateescape codec is now used, instead of the locale encoding, to
decode the command line arguments. This change fixes inconsistencies with
os.fsencode() and os.fsdecode() because these operating systems announces an
ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
13 years ago
Victor Stinner
41a234a679
Issue #16416 : Fix compilation error
13 years ago
Victor Stinner
27b1ca29cc
Issue #16416 : On Mac OS X, operating system data are now always
encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding
(which may be ASCII if no locale environment variable is set), to avoid
inconsistencies with os.fsencode() and os.fsdecode() functions which are
already using UTF-8/surrogateescape.
13 years ago
Victor Stinner
0d92c4f667
Issue #16416 : Fix error handling in _Py_wchar2char() _Py_char2wchar() functions
13 years ago
Victor Stinner
e262377cab
Issue #16416 : OS data are now always encoded/decoded to/from
UTF-8/surrogateescape, instead of the locale encoding (which may be ASCII if no
locale environment variable is set), to avoid inconsistencies with
os.fsencode() and os.fsdecode() functions which are already using
UTF-8/surrogateescape.
13 years ago
Stefan Krah
6df5cae49a
Issue #15835 : Define PATH_MAX on HP-UX.
13 years ago
Victor Stinner
76df43de30
Issue #16330 : Use surrogate-related macros
Patch written by Serhiy Storchaka.
13 years ago
Brett Cannon
efb00c0cc1
Issue #14153 Create _Py_device_encoding() to prevent _io from having to import
the os module.
14 years ago
Antoine Pitrou
0e576f1f50
Issue #13626 : Add support for SSL Diffie-Hellman key exchange, through the
SSLContext.load_dh_params() method and the ssl.OP_SINGLE_DH_USE option.
14 years ago
Antoine Pitrou
2b1cc89572
_Py_fopen now allows bytes filenames under non-Windows platforms.
14 years ago
Victor Stinner
bd0850b857
import.c now catchs _Py_stat() exceptions
_Py_stat() now returns -2 if an exception was raised.
14 years ago