Antoine Pitrou
243757eb79
Issue #10180 : Pickling file objects is now explicitly forbidden, since
...
unpickling them produced nonsensical results.
2010-11-05 21:15:39 +00:00
Antoine Pitrou
39a6591507
Issue #10311 : The signal module now restores errno before returning from
...
its low-level signal handler. Patch by Hallvard B Furuseth.
2010-11-05 19:47:27 +00:00
Hirokazu Yamamoto
09fff7a8d1
Fixed socket_gethostname() on windows.
2010-11-05 17:24:13 +00:00
Antoine Pitrou
b5d8204f0f
Issue #10279 : fix test_gc under Win64.
2010-11-05 00:05:25 +00:00
Antoine Pitrou
2397dd58b7
Issue #10314 : improve performance of JSON encoding with sort_keys=True
2010-11-04 16:51:32 +00:00
Hirokazu Yamamoto
3cdd5cb959
Issue #5391 : mmap.read_byte() should return unsigned value [0, 255]
...
instead of signed value [-127, 128].
2010-11-04 12:09:08 +00:00
Senthil Kumaran
95c0700eff
Fix Issue 10307 - compile error in readline.c
2010-11-04 03:51:05 +00:00
Antoine Pitrou
87298c4a23
No declarations in the middle of a block (fixes compile under Windows)
2010-10-31 21:03:01 +00:00
Antoine Pitrou
e974571d36
Issue #10160 : Speed up operator.attrgetter. Patch by Christos Georgiou.
2010-10-31 15:26:04 +00:00
Benjamin Peterson
bbb0412ad1
if FileIO.__init__ fails, close fd
2010-10-30 23:16:28 +00:00
Benjamin Peterson
430d469758
fix style
2010-10-30 23:13:57 +00:00
Antoine Pitrou
8d2b51b46a
Issue #10253 : FileIO leaks a file descriptor when trying to open a file
...
for append that isn't seekable. Patch by Brian Brazil.
2010-10-30 16:19:14 +00:00
Benjamin Peterson
e857b29fdd
plug refleak
2010-10-29 21:37:26 +00:00
Martin v. Löwis
72f48422e2
Issue #9377 : Use Unicode API for gethostname on Windows.
2010-10-29 18:20:08 +00:00
Antoine Pitrou
e033e06db0
Issue #10093 : ResourceWarnings are now issued when files and sockets are
...
deallocated without explicit closing. These warnings are silenced by
default, except in pydebug mode.
2010-10-29 10:38:18 +00:00
Antoine Pitrou
b156a46b26
Issue #8852 : Allow the socket module to build on OpenSolaris.
2010-10-27 20:13:57 +00:00
Antoine Pitrou
ea5d17d9af
In open(), only set the buffer size from st.st_blksize when it is greater
...
than 1. This matches the pure Python implementation in _pyio and should
fix a couple of failures on the NetBSD buildbot.
2010-10-27 19:45:43 +00:00
Jesus Cea
7e9065cf8c
Issue #10143 : Update "os.pathconf" values
2010-10-25 13:02:04 +00:00
Georg Brandl
770a2be364
These are true PyCFunctions, after adding the second argument to oss_self, no need to cast.
2010-10-24 20:47:32 +00:00
Georg Brandl
08be72d0aa
Add a new warning gategory, ResourceWarning, as discussed on python-dev. It is silent by default,
...
except when configured --with-pydebug.
Emit this warning from the GC shutdown procedure, rather than just printing to stderr.
2010-10-24 15:11:22 +00:00
Georg Brandl
687a1fa546
Add casts (one needed, one for consistency).
2010-10-24 14:21:42 +00:00
Antoine Pitrou
29aad0005d
Issue #10185 : use Py_hash_t instead of long
2010-10-23 19:42:38 +00:00
Georg Brandl
1e908af335
#6518 : enable context manager protocol for ossaudiodev types.
2010-10-23 17:31:52 +00:00
Victor Stinner
2158231433
Issue #6011 : getpath: decode VPATH env var from the locale encoding
...
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.
2010-10-23 00:13:28 +00:00
Antoine Pitrou
ff150f2921
Revert r85797 (and r85798): it broke the Windows buildbots because of
...
test_multiprocessing's misbehaviour.
2010-10-22 21:41:05 +00:00
Antoine Pitrou
7eecffd05d
Issue #9935 : Speed up pickling of instances of user-defined classes.
2010-10-22 19:43:59 +00:00
Antoine Pitrou
61ec8de809
For now, remove accept4() code (issue #10115 )
2010-10-22 18:44:15 +00:00
Antoine Pitrou
d532321f7b
Issue #5639 : Add a *server_hostname* argument to `SSLContext.wrap_socket`
...
in order to support the TLS SNI extension. `HTTPSConnection` and
`urlopen()` also use this argument, so that HTTPS virtual hosts are now
supported.
2010-10-22 18:19:07 +00:00
Georg Brandl
28928aef2e
#4829 : better error message for invalid file mode
2010-10-21 13:45:52 +00:00
Antoine Pitrou
9583cac633
Issue #10089 : Add support for arbitrary -X options on the command-line.
...
They can be retrieved through a new attribute `sys._xoptions`.
2010-10-21 13:42:28 +00:00
Victor Stinner
f933e1ab6f
Issue #4388 : On Mac OS X, decode command line arguments from UTF-8, instead of
...
the locale encoding. If the LANG (and LC_ALL and LC_CTYPE) environment variable
is not set, the locale encoding is ISO-8859-1, whereas most programs (including
Python) expect UTF-8. Python already uses UTF-8 for the filesystem encoding and
to encode command line arguments on this OS.
2010-10-20 22:58:25 +00:00
Victor Stinner
07298a1f04
zipimport: remove arbitrary length limit from message formats
...
PyErr_Format() and PyUnicode_FromFormat() are able to allocate the right buffer
size and to catch memory allocation failures.
2010-10-18 22:45:54 +00:00
Victor Stinner
9e40fad193
zipimport: document archive encoding; fix indentation
2010-10-18 22:34:46 +00:00
Victor Stinner
965a8a1c5b
Revert r85699 and r85701 (zipimport): fullname is a module name, not a path
...
UTF-8 is just fine for module names.
2010-10-18 21:44:33 +00:00
Victor Stinner
8c8ed0a799
zipimport: fix "can't find module ..." error message
...
I cannot use %U: fullname is a bytes object, not an unicode object. %A format
cannot be used, it adds 'b' (bytes) prefix. So create cant_find_module()
function to decode the filename and raise the error message.
2010-10-18 21:21:02 +00:00
Victor Stinner
0410656b30
zipimport: find_module(), is_package() and get_source() supports surrogates
...
Use PyUnicode_FSConverter to support surrogates in the full name.
2010-10-18 20:44:08 +00:00
Victor Stinner
269aeb7c0d
zipimport: pass path size to make_filename()
...
Don't hardcode path size in make_filename().
2010-10-18 20:40:59 +00:00
Georg Brandl
016cec75bd
Fix hash function type.
2010-10-18 12:24:53 +00:00
Victor Stinner
2a94f4c0ef
get_code_from_data() uses the filesystem encoding to encode the module path,
...
instead of utf-8.
2010-10-18 12:15:34 +00:00
Victor Stinner
d36c8217e1
zipimport: read_directory() uses cp437 or utf-8 (in strict mode), depending on
...
the unicode flag, to decode the filename, instead of the filesystem encoding.
Use the same choice than the zipfile module.
2010-10-18 12:13:46 +00:00
Victor Stinner
08654e18ee
zipimport: get_module_code() returns modpath as a Unicode object
...
... instead of a char*. Encode the module path to the fileystem encoding
(for PyImport_ExecCodeModuleEx) instead of utf-8.
2010-10-18 12:09:02 +00:00
Victor Stinner
26fabe1369
zipimporter_load_module() doesn't destroy mod on error
...
PyImport_AddModule() returns a borrowed reference. Don't display "import ... #
loaded from Zip ..." on error.
2010-10-18 12:03:25 +00:00
Victor Stinner
72f767e601
zipimport: encode the prefix to the fileystem encoding
2010-10-18 11:44:21 +00:00
Victor Stinner
353349caeb
zipimport, get_module_code(): avoid useless _PyUnicode_AsString()
2010-10-18 11:40:40 +00:00
Victor Stinner
c342fca222
zipimport: fix indentation
2010-10-18 11:39:05 +00:00
Georg Brandl
f038b32d0b
Remove more unneeded casts to hashfunc.
2010-10-18 07:35:09 +00:00
Georg Brandl
d49bf5e8a5
Fix type of hash function.
2010-10-18 07:30:06 +00:00
Georg Brandl
646fdd6c61
Fix compiler warning about unused static function.
2010-10-18 07:27:55 +00:00
Georg Brandl
c7f4af4cbe
Fix compiler warnings about formatting pid_t as an int, by always casting to long.
2010-10-18 05:06:18 +00:00
R. David Murray
e194dd60f0
#678250 : Make mmap flush a noop on ACCESS_READ and ACCESS_COPY.
...
Patch by Sébastien Sablé. This solves a test_mmap failure on AIX.
2010-10-18 01:14:06 +00:00
Benjamin Peterson
223f091737
fix strict aliasing warnings
2010-10-17 21:12:18 +00:00
Benjamin Peterson
8f67d0893f
make hashes always the size of pointers; introduce Py_hash_t #9778
2010-10-17 20:54:53 +00:00
Martin v. Löwis
a2e7d9bdc1
Fix T_BOOL bug of issue 8845.
2010-10-17 19:48:29 +00:00
Victor Stinner
e0f3268715
run_file(): encode the filename with PyUnicode_EncodeFSDefault() instead of
...
PyUnicode_AsUTF8String()
2010-10-17 19:34:51 +00:00
Amaury Forgeot d'Arc
20f11fe43c
Fix compilation warning in _ctypes module on Window
2010-10-17 08:34:22 +00:00
Gregory P. Smith
68e0135e41
Fix multiprocessing Semaphore's on netbsd5. SEM_VALUE_MAX is defined
...
as (~0U) on NetBSD which was causing it to appear as -1 when used as
a signed int for _multprocessing.SemLock.SEM_VALUE_MAX. This works
around the problem by substituting INT_MAX on systems where it appears
negative when used as an int.
2010-10-17 02:14:36 +00:00
Victor Stinner
49d3f2514b
_PyImport_FixupExtension() and _PyImport_FindExtension() uses FS encoding
...
* Rename _PyImport_FindExtension() to _PyImport_FindExtensionUnicode():
the filename becomes a Unicode object instead of byte string
* Rename _PyImport_FixupExtension() to _PyImport_FixupExtensionUnicode():
the filename becomes a Unicode object instead of byte string
2010-10-17 01:24:53 +00:00
Gregory P. Smith
3e85dfd15e
applying netbsd-wizs-mod.patch from issue5510 -
...
fixes for netbsd (and dragonflybsd?)
2010-10-17 00:43:10 +00:00
Victor Stinner
61aad57dc9
Oops, fix my previous commit (r85583) on calculate_path()
...
path value may be changed, so keep a copy in a new variable.
2010-10-16 23:38:07 +00:00
Victor Stinner
dc4b2a712f
calculate_path(): use _Py_char2wchar() to decode the PATH environment variable,
...
to support surrogate characters
2010-10-16 23:34:22 +00:00
Victor Stinner
168e117e0a
Add an optional size argument to _Py_char2wchar()
...
_Py_char2wchar() callers usually need the result size in characters. Since it's
trivial to compute it in _Py_char2wchar() (O(1) whereas wcslen() is O(n)), add
an option to get it.
2010-10-16 23:16:16 +00:00
Georg Brandl
2a531395cd
Get rid of a "unused static function" warning.
2010-10-16 20:33:11 +00:00
Victor Stinner
5a7913eb3b
zipimport: catch _PyUnicode_AsString() failure in get_code_from_data()
...
It occurs if the path contains surrogates.
2010-10-16 11:29:07 +00:00
R. David Murray
e16cda9ad8
#9862 : On AIX PIPE_BUF is broken. Make it 512.
...
Patch by Sébastien Sablé.
2010-10-15 23:12:57 +00:00
Georg Brandl
c01537f742
#9054 : fix crash when using pyexpat with a system expat lib version 2.0.1.
2010-10-15 16:26:08 +00:00
Georg Brandl
b4dac71a87
#5355 : Provide mappings from Expat error numbers to string descriptions and backwards, in order to actually make it possible to analyze error codes provided by ExpatError.
2010-10-15 14:46:48 +00:00
Alexander Belopolsky
1bcbaab15a
Issue 9183: Intern UTC timezone.
2010-10-14 17:03:51 +00:00
Antoine Pitrou
b1c5496738
Issue #7523 : Add SOCK_CLOEXEC and SOCK_NONBLOCK to the socket module,
...
where supported by the system. Patch by Nikita Vetoshkin.
2010-10-14 15:05:38 +00:00
Victor Stinner
f4061dac60
_Py_wgetcwd() decodes the path using _Py_char2wchar() to support surrogates
2010-10-14 12:37:19 +00:00
Victor Stinner
9a6692f6d7
Py_Main() uses _Py_wchar2char() to encode the filename in error messages
2010-10-14 10:51:24 +00:00
Georg Brandl
66c221e993
#9418 : first step of moving private string methods to _string module.
2010-10-14 07:04:07 +00:00
Victor Stinner
052a04d34a
Revert r85435 (and r85440): decode command line arguments from utf-8
...
Python exits with a fatal error if the command line contains an undecodable
argument. PyUnicode_FromString() fails at the first undecodable byte because it
calls the error handler, but error handlers are not ready before Python
initialization.
2010-10-13 23:24:06 +00:00
Alexander Belopolsky
59a289d16b
Issue 9005: Removed dead code.
2010-10-13 22:54:34 +00:00
Victor Stinner
a21350976e
main(): catch PyUnicode_FromString() failure (exit)
2010-10-13 22:36:16 +00:00
Victor Stinner
90bbaa57f9
Issue #9992 : On Mac OS X, decode command line arguments from utf-8 instead of
...
the locale encoding.
2010-10-13 22:15:06 +00:00
Benjamin Peterson
eb1410fc40
constify to appease compiler warnings
2010-10-13 22:06:39 +00:00
Victor Stinner
8f6b6b0cc3
Issue #9992 : Remove PYTHONFSENCODING environment variable.
2010-10-13 22:02:27 +00:00
Antoine Pitrou
fc113eeb7d
Define a "session_id_context" at context creation. This is recommended
...
for the OpenSSL server-side session cache.
2010-10-13 12:46:13 +00:00
Gregory P. Smith
bd4dacb3f9
Fix compile on NetBSD 5.0 (or anything else using an old 0.9.9-dev OpenSSL).
2010-10-13 03:53:21 +00:00
Gregory P. Smith
2501aca628
fix compliation on NetBSD
2010-10-13 03:39:47 +00:00
Antoine Pitrou
04248a8d99
Issue #3873 : Speed up unpickling from file objects which have a peek()
...
method.
2010-10-12 20:51:21 +00:00
Antoine Pitrou
b0182c8ca5
Issue #10075 : Add a session_stats() method to SSLContext objects.
2010-10-12 20:09:02 +00:00
Martin v. Löwis
baecd7243a
Upgrade to Unicode 6.0.0.
...
makeunicodedata.py: download all data files from unicode.org,
switch to extracting Unihan data from zip file.
Read linebreakprops and derivednormalizationprops even for
old versions, even though they are not used in delta records.
test:unicode.py: U+11000 is now assigned, use U+14000 instead.
2010-10-11 22:42:28 +00:00
Antoine Pitrou
5b0e9e84e9
Issue #10055 : Make json C89-compliant in UCS4 mode.
2010-10-09 15:24:28 +00:00
Victor Stinner
4f3abb0f09
copy_absolute() keeps the relative path on _Py_wgetcwd() failure
...
.. instead of raising a fatal error. Even if the current directory was deleted,
use relative paths may still work (eg. run Python with "../python").
2010-10-07 23:29:18 +00:00
Victor Stinner
41c8b377d7
copy_absolute() raises a fatal error on _Py_wgetcwd() failure
2010-10-07 22:42:51 +00:00
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
2010-10-07 21:45:39 +00:00
Victor Stinner
7ae7c87b05
_wrealpath() and _Py_wreadlink() support surrogates (PEP 383)
...
Use _Py_wchar2char() to support surrogate characters in the input path.
2010-10-07 11:06:49 +00:00
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().
2010-10-07 01:02:42 +00:00
Victor Stinner
ef12810f0c
time: fix gcc warning
...
* Create format_arg variable to use the right types
* Strip trailing spaces
2010-10-07 01:00:52 +00:00
Victor Stinner
4726e40e00
Rewrite RunMainFromImporter()
...
* fix argv0 reference counter if PyList_SetItem() fails
* don't use complex if conditions, but a simple indentation and "goto error"
* simplify error handling (remove Py_XDECREF(importer) from the error label)
* don't set sys_path to NULL (it's useless, sys_path is a borrowed reference
and sys_path is not a static variable)
* try to write only one instruction per line for better readability
2010-10-06 23:24:57 +00:00
Victor Stinner
46c7b3b283
Issue #8670 : Rename testcapi unicode test methods
...
* test_aswidechar() => unicode_aswidechar()
* test_aswidecharstring() => unicode_aswidecharstring()
2010-10-02 11:49:31 +00:00
Victor Stinner
ea3f305a25
Oops, revert unwanted _testcapi changes of r85174
2010-10-02 11:46:20 +00:00
Victor Stinner
749261e241
Issue #8670 : ctypes.c_wchar supports non-BMP characters with 32 bits wchar_t
2010-10-02 11:25:35 +00:00
Victor Stinner
1c24bd0252
Issue #8870 : PyUnicode_AsWideCharString() doesn't count the trailing nul character
...
And write unit tests for PyUnicode_AsWideChar() and PyUnicode_AsWideCharString().
2010-10-02 11:03:13 +00:00
Brian Curtin
9e88b5aeee
Fix #10003 . Add SIGBREAK to the set of valid signals on Windows.
...
This fixes a regression noticed by bzr, introduced by issue #9324 .
2010-10-01 14:49:24 +00:00
Alexander Belopolsky
38e2996152
Issue #6608 : time.asctime is now checking struct tm fields its input
...
before passing it to the system asctime. Patch by MunSic Jeong.
2010-10-01 14:18:49 +00:00
Mark Dickinson
c60371748b
Issue #9599 : Further accuracy tweaks to loghelper. For an integer n that's small enough to be converted to a float without overflow, log(n) is now computed as log(float(n)), and similarly for log10.
2010-09-29 19:06:36 +00:00
Victor Stinner
4c2e4fa242
Issue #9979 : Use PyUnicode_AsWideCharString() in _ctypes module
...
* Convert unicode to wide character string before creating the PyCapsule
object
* Catch integer overflow
* Avoid useless memset()
* Prepare the support of surrogates
2010-09-29 10:37:16 +00:00
Victor Stinner
b29047876d
Issue #9979 : Use PyUnicode_AsWideCharString() in time.strftime()
...
Allocate memory with PyMem_Alloc() instead of the PyBytes API. Prepare the
surrogates support.
2010-09-29 10:34:19 +00:00