Antoine Pitrou [Fri, 25 Feb 2011 20:27:33 +0000 (20:27 +0000)]
Issue #11114: Fix catastrophic performance of tell() on text files (up
to 1000x faster in some cases). It is still one to two order of magnitudes
slower than binary tell().
Lars Gustäbel [Wed, 23 Feb 2011 11:42:22 +0000 (11:42 +0000)]
Issue #11224: Improved sparse file read support (r85916) introduced a
regression in _FileInFile which is used in file-like objects returned
by TarFile.extractfile(). The inefficient design of the
_FileInFile.read() method causes various dramatic side-effects and
errors:
- The data segment of a file member is read completely into memory
every(!) time a small block is accessed. This is not only slow
but may cause unexpected MemoryErrors with very large files.
- Reading members from compressed tar archives is even slower
because of the excessive backwards seeking which is done when the
same data segment is read over and over again.
- As a backwards seek on a TarFile opened in stream mode is not
possible, using extractfile() fails with a StreamError.
Victor Stinner [Wed, 23 Feb 2011 00:21:43 +0000 (00:21 +0000)]
Issue #3080: Add PyModule_GetNameObject()
repr(module) uses %R to format module name and filenames, instead of '%s' and
'%U', so surrogates from undecodable bytes in a filename (PEP 383) are escaped.
Victor Stinner [Wed, 23 Feb 2011 00:02:00 +0000 (00:02 +0000)]
Issue #3080: Mark _PyImport_FindBuiltin() argument as constant
And as a consequence, mark also name argument of
_PyImport_FindExtensionUnicode() constant too. But I plan to change this
argument type to PyObject* later.
Brett Cannon [Tue, 22 Feb 2011 21:48:06 +0000 (21:48 +0000)]
Make Lib/crypt.py meet PEP 8 standards. This also led to a tweak in the new API
by making methods() into a module attribute as it is statically calculated.
Brett Cannon [Tue, 22 Feb 2011 03:25:12 +0000 (03:25 +0000)]
Issue #11074: Make 'tokenize' so it can be reloaded.
The module stored away the 'open' object as found in the global namespace
(which fell through to the built-in namespace) since it defined its own 'open'.
Problem is that if you reloaded the module it then grabbed the 'open' defined
in the previous load, leading to code that infinite recursed. Switched to
simply call builtins.open directly.
Brett Cannon [Tue, 22 Feb 2011 03:04:06 +0000 (03:04 +0000)]
Issue #10992: make tests pass when run under coverage.
Various tests fail when run under coverage. A primary culprit is refcount tests
which fail as the counts are thrown off by the coverage code. A new decorator
-- test.support.refcount_test -- is used to decorate tests which test refcounts
and to skip them when running under coverage. Other tests simply fail because
of changes in the system (e.g., __local__ suddenly appearing).
Thanks to Kristian Vlaardingerbroek for helping to diagnose the test failures.
Issue #11085: Moved collections abstract base classes into a separate module
called collections.abc, following the pattern used by importlib.abc. For
backwards compatibility, the names continue to also be imported into the
collections module.
Antoine Pitrou [Mon, 21 Feb 2011 23:41:12 +0000 (23:41 +0000)]
Issue #4681: Allow mmap() to work on file sizes and offsets larger than
4GB, even on 32-bit builds. Initial patch by Ross Lagerwall, adapted for
32-bit Windows.
Victor Stinner [Mon, 21 Feb 2011 21:05:50 +0000 (21:05 +0000)]
Remove filename variable from ceval.c
Issue #11168: Remove filename debug variable from PyEval_EvalFrameEx().
It encoded the Unicode filename to UTF-8, but the encoding fails on
undecodable filename (on surrogate characters) which raises an unexpected
UnicodeEncodeError on recursion limit.
Victor Stinner [Mon, 21 Feb 2011 20:51:28 +0000 (20:51 +0000)]
Remove bootstrap code of PyUnicode_AsEncodedString()
Issue #11187: Remove bootstrap code (use ASCII) of
PyUnicode_AsEncodedString(), it was replaced by a better fallback (use
the locale encoding) in PyUnicode_EncodeFSDefault().
Brett Cannon [Mon, 21 Feb 2011 19:29:56 +0000 (19:29 +0000)]
Issue #10990: Prevent tests from clobbering a set trace function.
Many tests simply didn't care if they unset a pre-existing trace function. This
made test coverage impossible. This patch fixes various tests to put back any
pre-existing trace function. It also introduces test.support.no_tracing as a
decorator which will temporarily unset the trace function for tests which
simply fail otherwise.
Thanks to Kristian Vlaardingerbroek for helping to find the cause of various
trace function unsets.
Georg Brandl [Sat, 19 Feb 2011 21:47:02 +0000 (21:47 +0000)]
#11249: in PyType_FromSpec, copy tp_doc slot since it usually will point to a static string literal which should not be deallocated together with the type.