Commit Graph

5364 Commits

Author SHA1 Message Date
Victor Stinner 2f02a51135 PyUnicode_EncodeFS() raises an exception if _Py_wchar2char() fails
* Add error_pos optional argument to _Py_wchar2char()
 * PyUnicode_EncodeFS() raises a UnicodeEncodeError or MemoryError if
   _Py_wchar2char() fails
2010-11-08 22:43:46 +00:00
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