Noted by Joseph Armbruster; patch by Jessica McKellar.
The original code was 'for (;;) {...}', where ... ended
with a 'return -2' statement and did not contain a 'break' or 'continue'
statement. Therefore, the body of the loop is always executed once.
Once upon a time there was a 'continue' in the loop, but it was removed in
rev36346, committed by mwh on Wed Jul 7 17:44:12 2004.
message/rfc822 it turns it into an object whose body consists of
a list containing a single Message object. HeaderParser, on the
other hand, just copies the body as a string. Generator.flatten
has a special handler for the message mime type that expected the
body to be the one item list. This fails if the message was parsed
by HeaderParser. So we now check to see if the body is a string
first, and if so just we just emit it.
of the 'canonical' and 'is_canonical' methods) now consistently accept
integer arguments wherever a Decimal instance is accepted. Thanks
Juan José Conti for the patch.
close method refers to an identifier in the global module namespace.
This means that when __del__ is called during interpreter shutdown (if,
for example, the calling program still has a pointer to the shelf),
sometimes that global identifier would wind up being None, causing
mysterious 'ignored' exceptions. This patch checks for the possible None
value first before using the global, thus avoiding the error messages.
in XML processing instructions and comments. These raw characters are
allowed by the XML specification, and are necessary when outputting e.g.
PHP code in a processing instruction. Patch by Neil Muller.
and read operations on write-only file objects. On Windows, the system C
library would return a bogus result; on Solaris, it was possible to crash
the interpreter. Patch by Stefan Krah.
In Python 2.x, exceptions in finally blocks are not normalized. Since with
statements are implemented using finally blocks, ceval.c had to be tweaked to
distinguish between with finally blocks and normal ones.
A test for the finalization of generators containing with statements was also
added.
specified, rather than fall through to AF_PACKET (in the `socket` module).
Also, raise ValueError rather than TypeError when an unknown TIPC address
type is specified. Patch by Brian Curtin.
file position when calling `truncate()`. It would previously change the
file position to the given argument, which goes against the tradition of
ftruncate() and other truncation APIs. Patch by Pascal Chambon.
:class:`zipfile.ZipExtFile` class used to represent files stored inside
an archive. The new implementation is significantly faster and can
be wrapped in a :class:`io.BufferedReader` object for more speedups.
It also solves an issue where interleaved calls to `read()` and
`readline()` give wrong results. Patch by Nir Aides.
private memory allocation scheme in dtoa.c, along with a piece of code
that caches powers of 5 for future use. This makes it easier to
detect dtoa.c memory leaks with Valgrind or similar tools.
Patch by Stefan Krah.
- Issue #7714: Use ``gcc -dumpversion`` to detect the version of GCC on
MacOSX.
- Make configure look for util.h as well as libutil.h. The former
is the header file that on OSX contains the defition of openpty.
(Needed to compile for OSX 10.4 on OSX 10.6)
- Use the correct definition of CC to compile the pythonw executable
could crash in many places because of the PyByteArray_AS_STRING() macro
returning NULL. The macro now returns a statically allocated empty
string instead.
Also remove some now unused variables, and add comments clarifying the
possible outputs of the parsing section of _Py_dg_strtod. Thanks
Eric Smith for reviewing.
headers in multipart/signed MIME parts, which fixes one of the sources of
invalid modifications to such parts by Generator. Patch and tests by
Martin von Gagern.
Py3K warnings are DeprecationWarning by default this was causing -3 to
essentially be a no-op. Now DeprecationWarning is only silenced if -3 is not
used.
Closes issue #7700. Thanks Ezio Melotti and Florent Xicluna for patch help.
This was originally suggested by Guido, discussed on the stdlib-sig mailing
list, and given the OK by Guido directly to me. What this change essentially
means is that Python has taken a policy of silencing warnings that are only
of interest to developers by default. This should prevent users from seeing
warnings which are triggered by an application being run against a new
interpreter before the app developer has a chance to update their code.
Closes issue #7319. Thanks to Antoine Pitrou, Ezio Melotti, and Brian Curtin
for helping with the issue.
renaming of `cPickle` to `pickle`. The warning was annoying since there's
no alternative to cPickle if you care about performance. Patch by Florent
Xicluna.
to integer PyArg_Parse* format codes into a TypeError. Add a
DeprecationWarning for floats passed with the 'L' format code, which
didn't previously have a warning.
The previous implementation used execv(2) to run the real interpreter, which means that
you cannot use the arch(1) tool to select the architecture you want to use for a
universal build because that only affects the python/pythonw wrapper and not the actual
interpreter.
The new version uses posix_spawnv with a number of OSX-specific options that ensure that
the real interpreter is started using the same CPU architecture as the wrapper, and that
means that 'arch -ppc python' now actually works.
I've also changed the way that the wrapper looks for the framework: it is now linked to
the framework rather than hardcoding the framework path. This should make it easier to
provide pythonw support in tools like virtualenv.
self-test. Because of a change to the way tracebacks are printed,
this self-test was failing. The test is run (and passes) during normal
regression testing. So instead of running the failing self-test this
patch makes doctest emit a usage message. This is better behavior anyway
since passing in arguments is the real reason to run doctest as a command.
Bug discovery and initial patch by Florent Xicluna.
any errors that might occur during coercion of the left operand and
turning them into a TypeError with a message text that was confusing in
the given context. This patch lets any errors through, as was already
done during coercion of the right hand side.
This is for consistency with imitation file objects like StringIO and BytesIO.
This commit also adds a few tests, where they were lacking for concerned
methods.
default.
TarFile's errorlevel argument controls how errors are
handled that occur during extraction. There are three
possible levels 0, 1 and 2. If errorlevel is set to 1 or 2
fatal errors (e.g. a full filesystem) are raised as
exceptions. If it is set to 0, which is the default value,
extraction errors are suppressed, and error messages are
written to the debug log instead. But, if the debug log is
not activated, which is the default as well, all these
errors go unnoticed.
The original intention was to imitate GNU tar which tries
to extract as many members as possible instead of stopping
on the first error. It turns out that this is no good
default behaviour for a tar library. This patch simply
changes the default value for the errorlevel argument from
0 to 1, so that fatal extraction errors are raised as
EnvironmentError exceptions.
missing proper end-of-line termination. Patch and tests by
Scott Dial. The new tests include a test harness which will
make it easier to add additional tests.
`storbinary()` method of FTP and FTP_TLS objects gains an optional `rest`
argument. Patch by Pablo Mouzo.
(note: the patch also adds a test for the rest argument in retrbinary())
(Note that an empty archive is not the same as an empty file. An
empty archive contains no members and is correctly terminated with an
EOF block full of zeros. An empty file contains no data at all.)
The problem was that although tarfile was able to create empty
archives, it failed to open them raising a ReadError. On the other
hand, tarfile opened empty files without error in most read modes and
presented them as empty archives. (However, some modes still raised
errors: "r|gz" raised ReadError, but "r:gz" worked, "r:bz2" even
raised EOFError.)
In order to get a more fine-grained control over the various internal
error conditions I now split up the HeaderError exception into a
number of meaningful sub-exceptions. This makes it easier in the
TarFile.next() method to react to the different conditions in the
correct way.
The visible change in its behaviour now is that tarfile will open
empty archives correctly and raise ReadError consistently for empty
files.