Resizing is used _inside_ libmpdec functions, and it is permitted to
change x->alloc several times while setting x->len at the end of the
function. Therefore, for dynamic mpd_t x->alloc can _temporarily_ drop
below x->len. Of course the final result always has x->len <= x->alloc.
For static mpd_t this cannot happen, since resizing to a smaller
coefficient is a no-op.
2) Remove micro optimization in mpd_switch_to_dyn(): Previously only the
valid initialized part of the existing coefficient up to x->len was
copied to the new dynamic memory area. Now copying does the same as
realloc() and the entire old memory area is copied.
The rationale for this change is that it is no longer needed to memorize
the explanation given in 1).
I thought I had run the full test suite before the last checkin, but
obviously I didn't. test_multibytecodec_support.py isn't really a test file,
it is a support file that contains a base test class. Rename it to
multibytecodec_support so that regrtest test discovery doesn't think it is a
test file that should be run.
This moves us further in the direction of using normal unittest facilities
instead of specialized regrtest ones. Any test module that can be correctly
run currently using 'python unittest -m test.test_xxx' can now be converted to
use normal unittest test loading by simply deleting its test_main, thus no
longer requiring manual maintenance of the list of tests to run. (Not all
tests can be converted that easily, since test_main sometimes does some
additional things (such as reap_children or reap_threads). In those cases the
extra code may be moved to setUpModule/tearDownModule methods, or perhaps the
same ends can be achieved in a different way, such as moving the decorators to
the test classes that need them, etc.)
I don't advocate going through and making this change wholesale, but any time
a list of tests in test_main would otherwise need to be updated, consideration
should instead be given to deleting test_main.
Previously mailbox was copying a list of attributes from one message object to
another in order to "copy the message data". This means that any time new
attributes were added to email.message.Message, mailbox broke. Now instead it
copies all attributes from the source object to the target object, skipping
any mailbox-object-specific attributes to produce the same clean initial
state it was previously getting by copying only the "known" attributes.
David Lam assisted in the development of this patch.