Barry Warsaw [Mon, 19 Nov 2001 18:36:43 +0000 (18:36 +0000)]
formatdate(): Jason Mastaler correctly points out that divmod with a
negative modulus won't return the right values. So always do positive
modulus on an absolute value and twiddle the sign as appropriate after
the fact.
Barry Warsaw [Mon, 19 Nov 2001 16:31:06 +0000 (16:31 +0000)]
test_formatdate(), test_formatdate_zoneoffsets(): Two changes. First,
use the correct way to test for epoch, by looking at the year
component of gmtime(0). Add clause for Unix epoch and Mac epoch (Tim,
what is Windows epoch?).
Also, get rid of the strptime() test, it was way too problematic given
that strptime() is missing on many platforms and issues with locales.
Instead, simply test that formatdate() gets the numeric timezone
calculation correct for the altzone and timezone.
Barry Warsaw [Mon, 19 Nov 2001 16:28:07 +0000 (16:28 +0000)]
formatdate(): The calculation of the minutes part of the zone was
incorrect for "uneven" timezones. This algorithm should work for even
timezones (e.g. America/New_York) and uneven timezones (e.g.
Australia/Adelaide and America/St_Johns).
Fred Drake [Sun, 18 Nov 2001 04:58:28 +0000 (04:58 +0000)]
Clarified a couple of issues for the startElement*() handlers:
- the attrs value may be re-used by the parser, so the implementation
cannot rely on owning the object.
- an element with no namespace encountered in namespace mode will have a URI
of None, not "" (startElementNS() only).
Fred Drake [Sat, 17 Nov 2001 06:50:42 +0000 (06:50 +0000)]
Exhibit good form in C code: always provide docstrings in method tables, and
always fill in all slots of table entries.
Fixed a few minor markup errors.
Fred Drake [Sat, 17 Nov 2001 06:30:20 +0000 (06:30 +0000)]
Update to use more modern calling conventions; also avoid a magic number
in the function table. Add a docstring for the function as well, since
examples should show good form.
Barry Warsaw [Fri, 16 Nov 2001 22:16:04 +0000 (22:16 +0000)]
Add a clarification that the email package always deals in native line
endings, and that it is smtplib's job to convert those to RFC 2821
line endings when sending the message.
Fred Drake [Fri, 16 Nov 2001 06:02:55 +0000 (06:02 +0000)]
Clean up some markup a little bit more. Make this work with the PDF format,
which is a little more strict than the other formats on some things (fixable,
but not tonight).
Fred Drake [Fri, 16 Nov 2001 02:52:57 +0000 (02:52 +0000)]
Fix parsing of parameters from a URL; urlparse() did not check that it only
split parameters from the last path segment. Introduces two new functions,
urlsplit() and urlunsplit(), that do the simpler job of splitting the URL
without monkeying around with the parameters field, since that was not being
handled properly.
This closes bug #478038.
Barry Warsaw [Thu, 15 Nov 2001 23:45:26 +0000 (23:45 +0000)]
A change to sync with pickle.py:
find_class(): We no longer mask all exceptions[1] by transforming them
into SystemError. The latter is definitely not the right thing to do,
so we let any exceptions that occur in the PyObject_GetAttr() call to
simply propagate up if they occur.
[1] Note that pickle only masked ImportError, KeyError, and
AttributeError, but cPickle masked all exceptions.
Barry Warsaw [Thu, 15 Nov 2001 23:42:58 +0000 (23:42 +0000)]
Two changes:
load_inst(): Implement the security hook that cPickle already had.
When unpickling callables which are not classes, we look to see if the
object has an attribute __safe_for_unpickling__. If this exists and
has a true value, then we can call it to create the unpickled object.
Otherwise we raise an UnpicklingError.
find_class(): We no longer mask ImportError, KeyError, and
AttributeError by transforming them into SystemError. The latter is
definitely not the right thing to do, so we let the former three
exceptions simply propagate up if they occur, i.e. we remove the
try/except!
Barry Warsaw [Thu, 15 Nov 2001 23:39:07 +0000 (23:39 +0000)]
A massive rewrite affecting both the pickle and cPickle module
documentation. This addresses previously undocumented parts of the
public interfaces, the differences between pickle and cPickle,
security concerns, and on and on.
Guido van Rossum [Thu, 15 Nov 2001 20:27:54 +0000 (20:27 +0000)]
Correct the description of mixed multiple inheritance: the code
special-cases classic classes, it doesn't do anything about other
cases where different metaclasses are involved (except for the trivial
case where one metaclass is a subclass of the others). Also note that
it's metaclass, not metatype.
Tim Peters [Wed, 14 Nov 2001 23:32:33 +0000 (23:32 +0000)]
Changing diapers reminded Guido that he wanted to allow for some measure
of multiple inheritance from a mix of new- and classic-style classes.
This is his patch, plus a start at some test cases from me. Will check
in more, plus a NEWS blurb, later tonight.
Jack Jansen [Wed, 14 Nov 2001 10:59:57 +0000 (10:59 +0000)]
OSX tests used specific version numbers to test for new features and
used the default Darwin/* for the old code. Reversed those tests so
that compatibility code is in a switch leg with a specific version and
newer systems take the default leg.
This should allow Python to build on OSX 10.1.1 (which jumps from Darwin/1.4
to Darwin/5.1 due to a new numbering scheme).
Tim Peters [Tue, 13 Nov 2001 23:11:19 +0000 (23:11 +0000)]
CVS patch #477161: New "access" keyword for mmap, from Jay T Miller.
This gives mmap() on Windows the ability to create read-only, write-
through and copy-on-write mmaps. A new keyword argument is introduced
because the mmap() signatures diverged between Windows and Unix, so
while they (now) both support this functionality, there wasn't a way to
spell it in a common way without introducing a new spelling gimmick.
The old spellings are still accepted, so there isn't a backward-
compatibility issue here.
Barry Warsaw [Tue, 13 Nov 2001 20:16:52 +0000 (20:16 +0000)]
Committing the second part of patch #480902, an improved test suite
for dumbdbm.py, by Skip Montanaro. The first half of Skip's patch has
been postponed until Py2.3 since it adds new features.
Jack Jansen [Sat, 10 Nov 2001 23:21:55 +0000 (23:21 +0000)]
Add the MSL C library to the set of standard libraries
linked against. Most, but not all, of it is included in
PythonCore, but extensions may want to use some of
the routines not included. Fixes a bug reported by
Tom Loredo.
Jack Jansen [Sat, 10 Nov 2001 00:41:43 +0000 (00:41 +0000)]
Fixed various problems with command-dot handling (some very old):
- Don't scan for cmd-. unless in the foreground
- Scan before switching out to other processes, not after
- don't scan if SchedParams.check_interrupt is false (!)
- But: do scan if we're blocked on I/O
One problem remains: in the last case KeyboardInterrupt is raised
too late.
Tim Peters [Fri, 9 Nov 2001 19:23:47 +0000 (19:23 +0000)]
open_the_file(): this routine has a borrowed reference to the file
object, so the "Metroworks only" section should not decref it in case
of error (the caller is responsible for decref'ing in case of error --
and does).