]> granicus.if.org Git - python/log
python
21 years agoStyle consistency, so "grep ^function ..." works as expected.
Fred Drake [Thu, 30 Jan 2003 15:08:25 +0000 (15:08 +0000)]
Style consistency, so "grep ^function ..." works as expected.

21 years agodis(): Simplified stack emulation a bit.
Tim Peters [Thu, 30 Jan 2003 15:02:12 +0000 (15:02 +0000)]
dis():  Simplified stack emulation a bit.

21 years agoI was in this module anyway, so I did some janitorial things.
Michael W. Hudson [Thu, 30 Jan 2003 14:17:16 +0000 (14:17 +0000)]
I was in this module anyway, so I did some janitorial things.

METH_NOARGS functions are still called with two arguments, one NULL,
so put that back into the function definitions (I didn't know this
until recently).

Make get_history_length() METH_NOARGS.

21 years agoAdd the get_completer() function based on Michael Stone's patch in
Michael W. Hudson [Thu, 30 Jan 2003 10:12:51 +0000 (10:12 +0000)]
Add the get_completer() function based on Michael Stone's patch in

[ 676342 ] after using pdb readline does not work correctly

which is required to fix that bug.  So maaybe a bugfix candidate.

21 years agoThere was a subtle big in save_newobj(): it used self.save_global(t)
Guido van Rossum [Thu, 30 Jan 2003 06:37:41 +0000 (06:37 +0000)]
There was a subtle big in save_newobj(): it used self.save_global(t)
on the type instead of self.save(t).  This defeated the purpose of
NEWOBJ, because it didn't generate a BINGET opcode when t was already
memoized; but moreover, it would generate multiple BINPUT opcodes for
the same type!  pickletools.dis() doesn't like this.

How I found this?  I was playing with picklesize.py in the datetime
sandbox, and noticed that protocol 2 pickles for multiple objects were
in fact larger than protocol 1 pickles!  That was suspicious, so I
decided to disassemble one of the pickles.

This really needs a unit test, but I'm exhausted.  I'll be late for
work as it is. :-(

21 years agoSlight code rearrangement to avoid testing getstate twice.
Guido van Rossum [Thu, 30 Jan 2003 05:41:19 +0000 (05:41 +0000)]
Slight code rearrangement to avoid testing getstate twice.

21 years agoIn save_newobj(), if an object's __getnewargs__ and __getstate__ are
Guido van Rossum [Thu, 30 Jan 2003 05:39:04 +0000 (05:39 +0000)]
In save_newobj(), if an object's __getnewargs__ and __getstate__ are
the same function, don't save the state or write a BUILD opcode.  This
is so that a type (e.g. datetime :-) can support protocol 2 using
__getnewargs__ while also supporting protocol 0 and 1 using
__getstate__.  (Without this, the state would be pickled twice with
protocol 2, unless __getstate__ is defined to return None, which
breaks protocol 0 and 1.)

21 years agoAuthor markup: Andrew got to it first
Raymond Hettinger [Thu, 30 Jan 2003 01:03:38 +0000 (01:03 +0000)]
Author markup:  Andrew got to it first

21 years agoSF patch 672098: Three __contains__ implementations
Raymond Hettinger [Thu, 30 Jan 2003 00:56:33 +0000 (00:56 +0000)]
SF patch 672098: Three __contains__ implementations

Contributed by Jp Calderone.

21 years agoFix [ 583477 ] wrong dest size.
Mark Hammond [Wed, 29 Jan 2003 22:38:29 +0000 (22:38 +0000)]
Fix [ 583477 ] wrong dest size.

Note this code is not used by the core on Win32, but in a block used only
by Windows CE.

21 years agoUse %c rather than chr() to turn some ints into chars.
Guido van Rossum [Wed, 29 Jan 2003 20:14:23 +0000 (20:14 +0000)]
Use %c rather than chr() to turn some ints into chars.

21 years agodis(): This had a problem with proto 0 pickles, in that POP sometimes
Tim Peters [Wed, 29 Jan 2003 20:12:21 +0000 (20:12 +0000)]
dis():  This had a problem with proto 0 pickles, in that POP sometimes
popped a MARK, but without stack emulation the disassembler couldn't
know that, and subsequent indentation got hosed.

Now the disassembler does do enough stack emulation to catch this.  While
I was at it, also added lots of sanity checks for other stack operations,
and correct use of the memo.  This goes (I think) a long way toward being
a "pickle verifier" now too.

21 years agoImplement appropriate __getnewargs__ for all immutable subclassable builtin
Guido van Rossum [Wed, 29 Jan 2003 17:58:45 +0000 (17:58 +0000)]
Implement appropriate __getnewargs__ for all immutable subclassable builtin
types.  The special handling for these can now be removed from save_newobj().
Add some testing for this.

Also add support for setting the 'fast' flag on the Python Pickler class,
which suppresses use of the memo.

21 years agoOnly log a message and chmod() when the mode isn't already what we
Guido van Rossum [Wed, 29 Jan 2003 16:58:31 +0000 (16:58 +0000)]
Only log a message and chmod() when the mode isn't already what we
want it to be.  Log both the old and new mode.

21 years ago- The mac-specific tests should also be run on darwin.
Jack Jansen [Wed, 29 Jan 2003 16:24:16 +0000 (16:24 +0000)]
- The mac-specific tests should also be run on darwin.
- Added test_aepack to the mac/darwin specific tests.

21 years agominor grammar tweaks
Skip Montanaro [Wed, 29 Jan 2003 15:41:33 +0000 (15:41 +0000)]
minor grammar tweaks

21 years agoTeach the parsermodule about floor division. Fixes
Michael W. Hudson [Wed, 29 Jan 2003 14:20:23 +0000 (14:20 +0000)]
Teach the parsermodule about floor division.  Fixes

[ 676521 ] parser module validation failure

bugfix candidate.

21 years agoMoved aepack test code to the test suite.
Jack Jansen [Wed, 29 Jan 2003 10:41:18 +0000 (10:41 +0000)]
Moved aepack test code to the test suite.

21 years agoSome objects could have uninitialized attributes. Fixed.
Jack Jansen [Wed, 29 Jan 2003 10:39:19 +0000 (10:39 +0000)]
Some objects could have uninitialized attributes. Fixed.

21 years agotest_macfs found an error on the first day of its existence: round trips for date...
Jack Jansen [Wed, 29 Jan 2003 09:56:56 +0000 (09:56 +0000)]
test_macfs found an error on the first day of its existence: round trips for date values to FSSpec.{Get,Set}Dates didn't work in MacPython-OS9. Fixed.

21 years agoDocument the demise of all pretenses of safety, and the difference
Guido van Rossum [Wed, 29 Jan 2003 06:24:30 +0000 (06:24 +0000)]
Document the demise of all pretenses of safety, and the difference
between cPickle and pickle.py regarding __safe_for_unpickling__ before
Python 2.3.

21 years agoDeclare Protocol 2 as implemented.
Guido van Rossum [Wed, 29 Jan 2003 06:16:12 +0000 (06:16 +0000)]
Declare Protocol 2 as implemented.

21 years agoSupport for extension codes. (By accident I checked in the tests first.)
Guido van Rossum [Wed, 29 Jan 2003 06:14:11 +0000 (06:14 +0000)]
Support for extension codes.  (By accident I checked in the tests first.)

21 years agoTest all three EXT opcodes, and move these tests into
Guido van Rossum [Wed, 29 Jan 2003 06:12:46 +0000 (06:12 +0000)]
Test all three EXT opcodes, and move these tests into
TempAbstractPickleTests, because they don't work with cPickle yet.

21 years agoMake the footer at the end of a \verbatiminput stand out a little
Fred Drake [Wed, 29 Jan 2003 05:14:44 +0000 (05:14 +0000)]
Make the footer at the end of a \verbatiminput stand out a little
more, to make it easier to tell apart from the verbatim content.

21 years agoMove a footnote to the end of the sentence, so the note mark won't
Fred Drake [Wed, 29 Jan 2003 05:10:27 +0000 (05:10 +0000)]
Move a footnote to the end of the sentence, so the note mark won't
interfere with the flow of the sentence.

21 years agoWhitespace normalization.
Tim Peters [Wed, 29 Jan 2003 03:49:43 +0000 (03:49 +0000)]
Whitespace normalization.

21 years agopickle: Comment repair.
Tim Peters [Wed, 29 Jan 2003 00:56:17 +0000 (00:56 +0000)]
pickle:  Comment repair.
pickletools:  Import decode_long from pickle instead of duplicating it.

21 years agoUpdated info about test_bsddb3 failures.
Tim Peters [Wed, 29 Jan 2003 00:38:42 +0000 (00:38 +0000)]
Updated info about test_bsddb3 failures.

21 years agoExpect test_macostools and test_macfs to get skipped whenever
Tim Peters [Wed, 29 Jan 2003 00:35:32 +0000 (00:35 +0000)]
Expect test_macostools and test_macfs to get skipped whenever
sys.platform != mac.  Likewise expect test_win{reg,sound} to get skipped
on non-win32 platforms.

21 years agoTest aliases too.
Jack Jansen [Tue, 28 Jan 2003 23:54:05 +0000 (23:54 +0000)]
Test aliases too.

21 years agoConverted to not use macfs whenever possible.
Jack Jansen [Tue, 28 Jan 2003 23:53:40 +0000 (23:53 +0000)]
Converted to not use macfs whenever possible.

21 years agoAdded a missing INCREF in pathname().
Jack Jansen [Tue, 28 Jan 2003 23:29:46 +0000 (23:29 +0000)]
Added a missing INCREF in pathname().

21 years agoTemporary hacks to arrange that the pickle tests relying on protocol 2
Tim Peters [Tue, 28 Jan 2003 22:34:11 +0000 (22:34 +0000)]
Temporary hacks to arrange that the pickle tests relying on protocol 2
only get run by test_pickle.py now (& not by test_cpickle.py).  This
should be undone when protocol 2 is implemented in cPickle too.
test_cpickle should pass again.

21 years agoAdd a comment about how some built-in types should grow a
Guido van Rossum [Tue, 28 Jan 2003 22:31:25 +0000 (22:31 +0000)]
Add a comment about how some built-in types should grow a
__getnewargs__ method.

21 years agoGet rid of __safe_for_unpickling__ and safe_constructors.
Guido van Rossum [Tue, 28 Jan 2003 22:29:13 +0000 (22:29 +0000)]
Get rid of __safe_for_unpickling__ and safe_constructors.

Also tidied up a few lines, got rid of apply(), added a comment.

21 years agoRenamed "bin" arguments to "proto". Note that this test currently
Tim Peters [Tue, 28 Jan 2003 22:26:28 +0000 (22:26 +0000)]
Renamed "bin" arguments to "proto".  Note that this test currently
fails, for reasons unrelated to this patch.

21 years agoMore markup changes for consistency.
Fred Drake [Tue, 28 Jan 2003 22:09:16 +0000 (22:09 +0000)]
More markup changes for consistency.

21 years agoVarious minor markup adjustments.
Fred Drake [Tue, 28 Jan 2003 22:02:35 +0000 (22:02 +0000)]
Various minor markup adjustments.

21 years agoAdd a test for a list subclass with a __dict__ as well as slots.
Guido van Rossum [Tue, 28 Jan 2003 22:02:31 +0000 (22:02 +0000)]
Add a test for a list subclass with a __dict__ as well as slots.

21 years agoInstead of bad hacks trying to worm around the inherited
Guido van Rossum [Tue, 28 Jan 2003 22:01:16 +0000 (22:01 +0000)]
Instead of bad hacks trying to worm around the inherited
object.__reduce__, do a getattr() on the class so we can explicitly
test for it.  The reduce()-calling code becomes a bit more regular as
a result.

Also add support slots: if an object has slots, the default state is
(dict, slots) where dict is the __dict__ or None, and slots is a dict
mapping slot names to slot values.  We do a best-effort approach to
find slot names, assuming the __slots__ fields of classes aren't
modified after class definition time to misrepresent the actual list
of slots defined by a class.

21 years agoAdded missing dependency.
Fred Drake [Tue, 28 Jan 2003 21:53:05 +0000 (21:53 +0000)]
Added missing dependency.

21 years agoInstall "python$(VERSION)" into /usr/local as the symlink to the framework,
Jack Jansen [Tue, 28 Jan 2003 21:45:44 +0000 (21:45 +0000)]
Install "python$(VERSION)" into /usr/local as the symlink to the framework,
and also create a symlink "python" pointing to "python$(VERSION)".
Fixes #675745.

21 years agoDon't import Nav. It isn't needed, and importing it doesn't work in a
Jack Jansen [Tue, 28 Jan 2003 21:40:36 +0000 (21:40 +0000)]
Don't import Nav. It isn't needed, and importing it doesn't work in a
non-windowing Python.

21 years agoFinally created the first two tests for MacPython modules: macfs and
Jack Jansen [Tue, 28 Jan 2003 21:39:28 +0000 (21:39 +0000)]
Finally created the first two tests for MacPython modules: macfs and
macostools.

21 years agoComment out a test that was anticipating SF patch 661536 -- but that
Guido van Rossum [Tue, 28 Jan 2003 20:39:49 +0000 (20:39 +0000)]
Comment out a test that was anticipating SF patch 661536 -- but that
isn't checked in yet. :-(

21 years agoAdded new private API function _PyLong_NumBits. This will be used at the
Tim Peters [Tue, 28 Jan 2003 20:37:45 +0000 (20:37 +0000)]
Added new private API function _PyLong_NumBits.  This will be used at the
start for the C implemention of new pickle LONG1 and LONG4 opcodes (the
linear-time way to pickle a long is to call _PyLong_AsByteArray, but
the caller has no idea how big an array to allocate, and correct
calculation is a bit subtle).

21 years agoThe default __reduce__ on the base object type obscured any
Guido van Rossum [Tue, 28 Jan 2003 19:48:18 +0000 (19:48 +0000)]
The default __reduce__ on the base object type obscured any
possibility of calling save_reduce().  Add a special hack for this.
The tests for this are much simpler now (no __getstate__ or
__getnewargs__ needed).

21 years agoFix SF bug# 676155, RuntimeWarning with tp_compare
Neal Norwitz [Tue, 28 Jan 2003 19:21:24 +0000 (19:21 +0000)]
Fix SF bug# 676155, RuntimeWarning with tp_compare

Check return value of PyLong_AsDouble(), it can return an error.

21 years agoMove the NEWOBJ-generating code to a separate function, and invoke it
Guido van Rossum [Tue, 28 Jan 2003 18:22:35 +0000 (18:22 +0000)]
Move the NEWOBJ-generating code to a separate function, and invoke it
after checking for __reduce__.

21 years agoSome experimental support for generating NEWOBJ with proto=2, and
Guido van Rossum [Tue, 28 Jan 2003 17:55:05 +0000 (17:55 +0000)]
Some experimental support for generating NEWOBJ with proto=2, and
fixed a bug in load_newobj().

21 years agoVerify treatment of unary minus on negative numbers SF bug #660455.
Guido van Rossum [Tue, 28 Jan 2003 17:48:21 +0000 (17:48 +0000)]
Verify treatment of unary minus on negative numbers SF bug #660455.

21 years agoBump the version number
Barry Warsaw [Tue, 28 Jan 2003 17:30:46 +0000 (17:30 +0000)]
Bump the version number

21 years agoEverything worked in both the distutils distro and in Python 2.3cvs,
Barry Warsaw [Tue, 28 Jan 2003 17:20:44 +0000 (17:20 +0000)]
Everything worked in both the distutils distro and in Python 2.3cvs,
so merge from the bsddb-bsddb3-schizo-branch back to the trunk.

21 years agosave_empty_tuple(): Comment on why we can't get rid of this.
Tim Peters [Tue, 28 Jan 2003 16:58:41 +0000 (16:58 +0000)]
save_empty_tuple():  Comment on why we can't get rid of this.

21 years agosave_dict(): Added a comment about the control flow NealN missed.
Tim Peters [Tue, 28 Jan 2003 16:47:59 +0000 (16:47 +0000)]
save_dict():  Added a comment about the control flow NealN missed.

21 years ago_is_string_secure(): This method is no longer used; removed it. (It
Tim Peters [Tue, 28 Jan 2003 16:42:22 +0000 (16:42 +0000)]
_is_string_secure():  This method is no longer used; removed it.  (It
was used before string-escape codecs were added to the core.)

21 years agoMade save() fit on a page, while adding comments. (I moved some type
Guido van Rossum [Tue, 28 Jan 2003 16:34:19 +0000 (16:34 +0000)]
Made save() fit on a page, while adding comments.  (I moved some type
checks to save_reduce(), which can also be called from a subclass.)

Also tweaked some more comments.

21 years agoGot rid of the _quotes global. Used only once, and is trivial.
Tim Peters [Tue, 28 Jan 2003 16:23:33 +0000 (16:23 +0000)]
Got rid of the _quotes global.  Used only once, and is trivial.

21 years agoUse raw-mode docstring whenever there's an escape code in an example --
Tim Peters [Tue, 28 Jan 2003 16:01:25 +0000 (16:01 +0000)]
Use raw-mode docstring whenever there's an escape code in an example --
they're easier to read this way.

21 years ago_dis_test should be a raw string now that it contains \x escapes.
Guido van Rossum [Tue, 28 Jan 2003 15:37:13 +0000 (15:37 +0000)]
_dis_test should be a raw string now that it contains \x escapes.

21 years agodis(): Not all opcodes are printable anymore, so print the repr
Tim Peters [Tue, 28 Jan 2003 15:27:57 +0000 (15:27 +0000)]
dis():  Not all opcodes are printable anymore, so print the repr
of the opcode character instead (but stripping the quotes).

Added a proto 2 test section for the canonical recursive-tuple case.
Note that since pickle's save_tuple() takes different paths depending on
tuple length now, beefier tests are really needed (but not in pickletools);
the "short tuple" case tried here was actually broken yesterday, and it's
subtle stuff so needs to be tested.

21 years agoAdd a few comments. Change the way the protocol is checked (it must
Guido van Rossum [Tue, 28 Jan 2003 15:19:53 +0000 (15:19 +0000)]
Add a few comments.  Change the way the protocol is checked (it must
be one of 0, 1 or 2).

I should note that the previous checkin also added NEWOBJ support to
the unpickler -- but there's nothing yet that generates this.

21 years agoRename all variables 'object' to 'obj' to avoid conflicts with the
Guido van Rossum [Tue, 28 Jan 2003 15:10:22 +0000 (15:10 +0000)]
Rename all variables 'object' to 'obj' to avoid conflicts with the
type 'object'.  Also minor docstring tweakage, and rearranged a few
lines in save().

21 years agoFix one disassembly output now that empty tuples are no longer
Guido van Rossum [Tue, 28 Jan 2003 15:09:10 +0000 (15:09 +0000)]
Fix one disassembly output now that empty tuples are no longer
memoized in text mode.  Fixed some variable names in the disassembler
doctest.

21 years agoDon't memoize the empty tuple in protocol 0.
Guido van Rossum [Tue, 28 Jan 2003 14:40:16 +0000 (14:40 +0000)]
Don't memoize the empty tuple in protocol 0.

21 years agoUpdate to the final version released as Expat 1.95.6 (maintaining
Fred Drake [Tue, 28 Jan 2003 06:42:40 +0000 (06:42 +0000)]
Update to the final version released as Expat 1.95.6 (maintaining
Martin's integration changes).

21 years agosave_tuple(): So long as the charter is rewriting for clarity, the snaky
Tim Peters [Tue, 28 Jan 2003 05:48:29 +0000 (05:48 +0000)]
save_tuple():  So long as the charter is rewriting for clarity, the snaky
control flow had to be simplified.

21 years agosave_tuple(): I believe the new code for TUPLE{1,2,3} in proto 2 was
Tim Peters [Tue, 28 Jan 2003 05:34:53 +0000 (05:34 +0000)]
save_tuple():  I believe the new code for TUPLE{1,2,3} in proto 2 was
incorrect for recursive tuples.  Tried to repair; seems to work OK, but
there are no checked-in tests for this yet.

21 years agoComments.
Tim Peters [Tue, 28 Jan 2003 05:12:08 +0000 (05:12 +0000)]
Comments.

21 years agoNow that proto2 is defined, replaced XXX blocks with text about it.
Tim Peters [Tue, 28 Jan 2003 04:56:33 +0000 (04:56 +0000)]
Now that proto2 is defined, replaced XXX blocks with text about it.

Also moved the proto2 opcode descriptors into the sections they fit (like
TUPLE{1,2,3} in the group of tuple-building opcodes; etc).

21 years agoOK, this is really the last one tonight!
Guido van Rossum [Tue, 28 Jan 2003 04:25:27 +0000 (04:25 +0000)]
OK, this is really the last one tonight!

NEWFALSE and NEWTRUE.

21 years agoShouldn't test short tuples with all items equal -- one potential bug
Guido van Rossum [Tue, 28 Jan 2003 04:20:02 +0000 (04:20 +0000)]
Shouldn't test short tuples with all items equal -- one potential bug
would be that the tuple is reversed on unpickling, and we should catch
that. :-)

Goodnight -- that's it for toniht!

21 years agoMore protocol 2: TUPLE1, TUPLE2, TUPLE3.
Guido van Rossum [Tue, 28 Jan 2003 04:14:51 +0000 (04:14 +0000)]
More protocol 2: TUPLE1, TUPLE2, TUPLE3.

Also moved the special case for empty tuples from save() to save_tuple().

21 years agoRename 'bin' arg to 'proto'. Keep the default at 0 lest the tests
Guido van Rossum [Tue, 28 Jan 2003 03:51:53 +0000 (03:51 +0000)]
Rename 'bin' arg to 'proto'.  Keep the default at 0 lest the tests
change in meaning.

21 years agosave_inst(): Rewrote to have only one branch on self.bin. Also got rid
Tim Peters [Tue, 28 Jan 2003 03:51:36 +0000 (03:51 +0000)]
save_inst():  Rewrote to have only one branch on self.bin.  Also got rid
of my recent XXX comment, taking a (what appears to be vanishingly small)
chance and calling self.memoize() instead.

21 years agoFirst baby steps towards implementing protocol 2: PROTO, LONG1 and LONG4.
Guido van Rossum [Tue, 28 Jan 2003 03:49:52 +0000 (03:49 +0000)]
First baby steps towards implementing protocol 2: PROTO, LONG1 and LONG4.

21 years agoFixed odd whitespace after "if", which I believe I introduced long ago.
Tim Peters [Tue, 28 Jan 2003 03:41:54 +0000 (03:41 +0000)]
Fixed odd whitespace after "if", which I believe I introduced long ago.

21 years agosave_int(): Fixed two new off-by-1 glitches.
Tim Peters [Tue, 28 Jan 2003 03:40:52 +0000 (03:40 +0000)]
save_int():  Fixed two new off-by-1 glitches.

21 years agoAdd a comment explaining that struct.pack() beats marshal.dumps(), but
Guido van Rossum [Tue, 28 Jan 2003 03:17:21 +0000 (03:17 +0000)]
Add a comment explaining that struct.pack() beats marshal.dumps(), but
marshal.loads() beats struct.unpack()!  Possibly because the latter
creates a one-tuple. :-(

21 years agoGot rid of mdumps; I timed it, and struct.pack("<i", x) is more than
Guido van Rossum [Tue, 28 Jan 2003 03:03:08 +0000 (03:03 +0000)]
Got rid of mdumps; I timed it, and struct.pack("<i", x) is more than
40% faster than marshal.dumps(x)[1:]!  (That's not counting the
module attribute lookups, which can be avoided in either case.)

21 years agosave_tuple(): Minor rewriting, and added a comment about the subtlety
Tim Peters [Tue, 28 Jan 2003 02:09:55 +0000 (02:09 +0000)]
save_tuple():  Minor rewriting, and added a comment about the subtlety
created by recursive tuples.

21 years agoload_appends(): replaced .append() loop with an .extend().
Tim Peters [Tue, 28 Jan 2003 01:44:45 +0000 (01:44 +0000)]
load_appends():  replaced .append() loop with an .extend().

21 years agoComments.
Tim Peters [Tue, 28 Jan 2003 01:41:51 +0000 (01:41 +0000)]
Comments.

21 years agosave_dict(): Untangled most of the bin-vs-not-bin logic. Also used
Tim Peters [Tue, 28 Jan 2003 01:34:43 +0000 (01:34 +0000)]
save_dict():  Untangled most of the bin-vs-not-bin logic.  Also used
iteritems() instead of materializing a (possibly giant) list of the
items.

21 years agosave_list(): Rewrote, to untangle the proto 0 from the proto 1 cases.
Tim Peters [Tue, 28 Jan 2003 01:15:46 +0000 (01:15 +0000)]
save_list():  Rewrote, to untangle the proto 0 from the proto 1 cases.
The code is much easier to follow now, and I bet it's faster too.

21 years agosave_list(): removed unused local "d".
Tim Peters [Tue, 28 Jan 2003 01:07:48 +0000 (01:07 +0000)]
save_list():  removed unused local "d".

21 years agosave_list(): removed unused local "memo".
Tim Peters [Tue, 28 Jan 2003 01:07:10 +0000 (01:07 +0000)]
save_list():  removed unused local "memo".

21 years agosave_pers(): Switched the order of cases, to get rid of a "not", and to
Tim Peters [Tue, 28 Jan 2003 01:03:10 +0000 (01:03 +0000)]
save_pers():  Switched the order of cases, to get rid of a "not", and to
make the bin-vs-not-bin order consistent with what other routines try to
do (they almost all handle the bin case first).

21 years agoSeveral routines appeared to inline the guts of memoize(), possibly for
Tim Peters [Tue, 28 Jan 2003 01:00:38 +0000 (01:00 +0000)]
Several routines appeared to inline the guts of memoize(), possibly for
some notion of low-level efficiency.  Undid that, but left one routine
alone:  save_inst() claims it has a reason for not using memoize().
I don't understand that comment, so added an XXX comment there.

21 years agosave(): Fiddled the control flow to put the normal case where it
Tim Peters [Tue, 28 Jan 2003 00:48:09 +0000 (00:48 +0000)]
save():  Fiddled the control flow to put the normal case where it
belongs.  This is a much smaller change than it may appear:  the bulk
of the function merely got unindented by one level.

21 years agoAdded XXX about save()'s special-casing of tuples -- I don't get it.
Tim Peters [Tue, 28 Jan 2003 00:43:26 +0000 (00:43 +0000)]
Added XXX about save()'s special-casing of tuples -- I don't get it.

21 years agosave_bool(): simplified.
Tim Peters [Tue, 28 Jan 2003 00:26:14 +0000 (00:26 +0000)]
save_bool():  simplified.

21 years agoRepaired grammar in new comment.
Tim Peters [Tue, 28 Jan 2003 00:24:43 +0000 (00:24 +0000)]
Repaired grammar in new comment.

21 years agoclear_memo(): Repaired grammar in docstring.
Tim Peters [Tue, 28 Jan 2003 00:23:36 +0000 (00:23 +0000)]
clear_memo():  Repaired grammar in docstring.

21 years agoAdded one-line comments to the proto 2 opcodes.
Tim Peters [Tue, 28 Jan 2003 00:22:12 +0000 (00:22 +0000)]
Added one-line comments to the proto 2 opcodes.

21 years agoUse proper function name in exception messages
Neal Norwitz [Tue, 28 Jan 2003 00:20:41 +0000 (00:20 +0000)]
Use proper function name in exception messages

21 years agoRemoved the new LONG2 opcode: it's extravagant. If LONG1 isn't enough,
Tim Peters [Tue, 28 Jan 2003 00:13:19 +0000 (00:13 +0000)]
Removed the new LONG2 opcode:  it's extravagant.  If LONG1 isn't enough,
then the embedded argument consumes at least 256 bytes.  The difference
between a 3-byte prefix (LONG2 + 2 bytes) and a 5-byte prefix (LONG4 +
4 bytes) is at worst less than 1%.  Note that binary strings and binary
Unicode strings also have only "size is 1 byte, or size is 4 bytes?"
flavors, and I expect for the same reason.  The only place a 2-byte
thingie was used was in BININT2, where the 2 bytes make up the *entire*
embedded argument (and now EXT2 also does this); that's a large savings
over 4 bytes, because the total opcode+argument size is so small in
the BININT2/EXT2 case.

Removed the TAKEN_FROM_ARGUMENT "number of bytes" code, and bifurcated it
into TAKEN_FROM_ARGUMENT1 and TAKEN_FROM_ARGUMENT4.  Now there's enough
info in ArgumentDescriptor objects to deduce the # of bytes consumed by
each opcode.

Rearranged the order in which proto2 opcodes are listed in pickle.py.

21 years agoDocumented the 2's-comp business for the new long opcodes.
Tim Peters [Mon, 27 Jan 2003 23:54:04 +0000 (23:54 +0000)]
Documented the 2's-comp business for the new long opcodes.

21 years agoWhitespace normalization.
Tim Peters [Mon, 27 Jan 2003 23:51:36 +0000 (23:51 +0000)]
Whitespace normalization.