| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
I modified nntplib so the body method can accept an
optional second parameter pointing to a filehandle or
filename (string). This way, really long body
articles can be stored to disk instead of kept in
memory. The way I made the modification should make
it easy to extend this functionality to other extended
return methods.
|
| |
|
|
|
|
| |
Decode and encode underscores for header style encoding. Fixes bug #463996.
|
| |
|
|
|
|
|
|
| |
This is probably a little bit faster, but mostly is just cleaner code.
The old-style support is still used for Python versions < 2.2 so this
source file can be shared with PyXML.
|
|
|
|
|
| |
every time this gets called; move it out as a global helper function.
Simplify the call to the _dispatch() method of the registered instance.
|
|
|
|
|
|
|
|
|
|
|
|
| |
staticness when __dynamic__ = 1 becomes the default:
- Some classes which are used to test the difference between static
and dynamic.
- Subclasses of complex: complex uses old-style numbers and the slot
wrappers used by dynamic classes only support new-style numbers.
(Ideally, the complex type should be fixed, but that looks like a
labor-intensive job.)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
__rop__ now takes precendence over __op__. Those circumstances are:
- Both arguments are new-style classes
- Both arguments are new-style numbers
- Their implementation slots for tp_op differ
- Their types differ
- The right argument's type is a subtype of the left argument's type
Also did this for the ternary operator (pow) -- only the binary case
is dealt with properly though, since __rpow__ is not supported anyway.
|
|
|
|
| |
NodeList interface.
|
|
|
|
|
| |
Clean up a little; do not create an alias that is only used once, or store
attributes with constant values in an instance.
|
| |
|
|
|
|
|
| |
error-reporting for the classic compare-expected-output tests.
Curiously, the bug consisted of not simplifying the logic enough!
|
| |
|
|
|
|
|
|
|
|
| |
depending on the cycle detector code in the library implementation.
This is a *slightly* different patch than SF patch #417795, but takes
the same approach. (This version avoids calling the __len__() method of
the dict in the remove() functions.)
This closes SF patch #417795.
|
|
|
|
| |
rigmarole of __reduce__.
|
|
|
|
|
|
|
|
|
|
| |
fallback for objects that are neither supported by our dispatch table
nor have a __copy__ or __deepcopy__ method.
Changes to _reduce() in copy_reg.py to support reducing objects that
don't have a __dict__ -- copy.copy(complex()) now invokes _reduce().
Add tests for copy.copy() and copy.deepcopy() to test_regrtest.py.
|
|
|
|
| |
subclassing list to add the length and item() attributes.
|
|
|
|
|
| |
This should fix a bug in how time is allocated during exception propogation
(esp. in the presence of finally clauses).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
getting displayed, due to a special case here whose purpose I didn't
understand. So just disabled the doc suppression here.
Another special case here skips the docs when picking apart a method
and finding that the im_func is also in the class __dict__ under
the same name. That one I understood. It has a curious consequence,
though, wrt inherited properties: a static class copies inherited stuff
into the inheriting class's dict, and that affects whether or not this
special case triggers. The upshoot is that pydoc doesn't show the
function docstrings of getter/setter/deleter functions of inherited
properties in the property section when the class is static, but does
when the class is dynamic (bring up Lib/test/pydocfodder.py under
GUI pydoc to see this).
|
|
|
|
| |
order of defining class's name.
|
|
|
|
|
| |
Python since 1.5 (virtually everything I changed over the last week relies
on "modern" features, particularly nested scopes).
|
|
|
|
|
| |
here means it has no more than one base class to rummage through (in which
cases there's no potential confusion about resolution order).
|
|
|
|
| |
probably *should* be doing.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add raise_exception() to the _testcapi module. It isn't a test, but
the C API exists only to support test_exceptions. raise_exception()
takes two arguments -- an exception class and an integer specifying
how many arguments it should be called with.
test_exceptions uses BadException() to test the interpreter's behavior
when there is a problem instantiating the exception. test_capi1()
calls it with too many arguments. test_capi2() causes an exception to
be raised in the Python code of the constructor.
|
| |
|
|
|
|
|
| |
a better place. Excessively fragile code, but at least it breaks when
something in this area changes!
|
|
|
|
| |
added some new tests of message/delivery-status content type messages.
|
| |
|
|
|
|
|
|
|
| |
Also, add a clause to the big-if to handle message/delivery-status
content types. These create a message with subparts that are
Message instances, which best represent the header blocks of this
content type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
get_type(): Use a compiled regular expression, which can be shared.
_get_params_preserve(): A helper method which extracts the header's
parameter list preserving value quoting. I'm not sure that this
needs to be a public method. It's necessary because we want
get_param() and friends to return the unquoted parameter value,
however we want the quote-preserved form for set_boundary().
get_params(), get_param(), set_boundary(): Implement in terms of
_get_params_preserve().
walk(): Yield ourself first, then recurse over our subparts (if any).
|
|
|
|
| |
subtype for consistency with the rest of the package.
|
|
|
|
|
|
| |
typed_subpart_iterator(): Arguments major renamed to maintype and
minor renamed to subtype for consistency with the rest of the
package.
|
|
|
|
|
|
|
|
|
| |
Text.py and class Text => MIMEText.py and MIMEText
MessageRFC822.py and class MessageRFC822 => MIMEMessage.py and MIMEMessage
These are renamed so as to be more consistent; these are MIME specific
derived classes for when creating the object model out of whole cloth.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
_handle_text(): If the payload is None, then just return (i.e. don't
write anything). Subparts of message/delivery-status types
will have this property since they are just blocks of headers.
Also, when raising the TypeError, include the type of the
payload in the error message.
_handle_multipart(), _handle_message(): When creating a clone of self,
pass in our _mangle_from_ and maxheaderlen flags so the clone
has the same behavior.
_handle_message_delivery_status(): New method to do the proper
printing of message/delivery-status type messages. These have
to be handled differently than other message/* types because
their payloads are subparts containing just blocks of headers.
In class DecodedGenerator:
_dispatch(): Skip over multipart/* messages since we don't care
about them, and don't want the non-text format to appear in
the printed results.
|
| |
|
|
|
|
|
| |
Rather than add umpteen new obscure internal Iter types, got rid of all of
them. See the new comment.
|
|
|
|
|
|
| |
iterator, just test to make sure it has the two required iterator
protocol methods __iter__() and next() -- actually just test
hasattr-ness.
|
|
|
|
|
|
| |
use it. This simplifies the individual tests a little.
Added some new tests related to exception handling.
|
|
|
|
|
|
|
| |
the local save/modify/restore of sys.stdout, but add machinery so that
regrtest can tell test_support the value of sys.stdout at the time
regrtest.main() started, and test_support can pass that out later to anyone
who needs a "visible" stdout.
|
|
|
|
|
| |
__class__. The __new__ protocol is up to this. (Thanks to Tim for
pointing this out.)
|
| |
|
|
|
|
| |
favor of local save/modify/restore. The test suite should run fine again.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Made cls.__module__ writable.
- Ensure that obj.__dict__ is returned as {}, not None, even upon first
reference; it simply springs into life when you ask for it.
(*) The pickling support is provisional for the following reasons:
- It doesn't support classes with __slots__.
- It relies on additional support in copy_reg.py: the C method
__reduce__, defined in the object class, really calls calling
copy_reg._reduce(obj). Eventually the Python code in copy_reg.py
needs to be migrated to C, but I'd like to experiment with the
Python implementation first. The _reduce() code also relies on an
additional helper function, _reconstructor(), defined in
copy_reg.py; this should also be reimplemented in C.
|
|
|
|
| |
standalone.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
property() (get, set, del; not set, get, del).
+ Change "Data defined/inherited in ..." header lines to
"Data and non-method functions defined/inherited in ...". Things like
the value of __class__, and __new__, and class vrbls like the i in
class C:
i = int
show up in this section too. I don't think it's worth a separate
section to distinguish them from non-callable attrs, and there's no
obvious reliable way to distinguish callable from non-callable attrs
anyway.
|
|
|
|
|
|
| |
than <type 'ClassName'>. Exception: if it's a built-in type or an
extension type, continue to call it <type 'ClassName>. Call me a
wimp, but I don't want to break more user code than necessary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
same. I hope the test for structural equivalence is stringent enough.
It only allows the assignment if the old and new types:
- have the same basic size
- have the same item size
- have the same dict offset
- have the same weaklist offset
- have the same GC flag bit
- have a common base that is the same except for maybe the dict and
weaklist (which may have been added separately at the same offsets
in both types)
|