Commit Graph

24 Commits

Author SHA1 Message Date
Jeremy Hylton ce616e4009 Enter Jim Fulton's latest version. He writes:
I had to make a slight diddle to work with Python 1.4, which
we and some of our customers are still using. :(

I've also made a few minor enhancements:

  - You can now both get and set the memo using a 'memo'
    attribute.  This is handy for certain advanced applications
    that we have.

  - Added a 'binary' attribute to get and set the binary
    mode for a pickler.

  - Added a somewhat experimental 'fast' attribute.  When this
    is set, objects are not placed in the memo during pickling.
    This should lead to faster pickling and smaller pickles in
    cases where:

      o you *know* there are no circular references, and

      o either you've:

        - preloaded the memo with class information
          by pickling classes in non-fast mode or by
          manipilating the memo directly, or

        - aren't pickling instances.
1998-08-13 23:13:52 +00:00
Jeremy Hylton d10552379d Two fixes to find_class:
1. Only DECREF the class's module when the module is retrieved via
PyImport_Import.  If it is retrieved from the modules dictionary with
PyDict_GetItem, it is using a borrowed reference.

2. If the module doesn't define the desired class, raise the same
SystemError that pickle.py does instead of returning an AttributeError
(which is cryptic at best).

Also, fix the PyArg_ParseTuple in cpm_loads (the externally visible
loads) function:  Use "S" instead of "O" because cStringIO will croak
with a "bad arguments to internal function" if passed anything other
than a string.
1998-08-11 19:52:51 +00:00
Guido van Rossum e2d81cd4d7 Jim Fulton's patches to get rid of the class_map(). 1998-08-08 19:40:10 +00:00
Fred Drake 764b984db5 Use PyErr_ExceptionMatches(...) instead of PyErr_Occurred() == ... in two
places.
1998-05-28 04:33:37 +00:00
Guido van Rossum ed33a3f415 whichmodule(): remove redundant PyErr_Clear(); add explicit setting
of error when sys.modules isn't there.
1998-05-14 02:34:46 +00:00
Guido van Rossum 104be4a4a7 Use %.17f to format floats/doubles 1998-04-03 21:13:02 +00:00
Guido van Rossum 8a6dba3562 Clear class_map in constructor so that when it later detects an error
and the destructor is called early, it doesn't DECREF garbage.
1998-03-06 01:39:39 +00:00
Guido van Rossum 57d9f2e6ec Renamed Jim's PyErr_[JF]Format() to cPickle_ErrFormat(). It's not a
standard Python API function so it should not have a Py prefix.
1998-01-19 23:18:18 +00:00
Guido van Rossum 9716aaa14c Jim Fulton:
- Loading non-binary string pickles checks for insecure
          strings. This is needed because cPickle (still)
          uses a restricted eval to parse non-binary string pickles.
          This change is needed to prevent untrusted
          pickles like::

            "S'hello world'*2000000\012p0\012."

          from hosing an application.

        - User-defined types can now support unpickling without
          executing a constructor.

          The second value returned from __reduce__ can now be None,
          rather than an argument tuple. On unpickling, if the second
          value returned from __reduce__ during pickling was None, then
          rather than calling the first value returned from __reduce__,
          directly, the __basicnew__ method of the first value returned
          from __reduce__ is called without arguments.
1997-12-08 15:15:16 +00:00
Guido van Rossum fdde96ce98 New versions of cPickle and cStringIO, from Jim Fulton's cPickle 1.0b1
distribution.
1997-12-04 01:13:01 +00:00
Guido van Rossum f6e8316b01 Initialize __version__ to the correct version string regardless of
what RCS checkout options are used.  Problem first diagnosed by Marc
Lemburg.
1997-12-01 15:57:40 +00:00
Guido van Rossum 4518823ad0 In whichmodule(), use __module__ if set. 1997-09-28 05:38:51 +00:00
Guido van Rossum 9efe8ef7a1 #Plug small memory leaks in constructors. 1997-09-03 18:19:40 +00:00
Barry Warsaw 779133c707 Removed JF's dollar-Log-dollar RCS turd that caused compilation to
crash due to GvR's last check in message :-).  Will try to convince JF
to remove all this evilness.
1997-08-21 22:36:26 +00:00
Guido van Rossum c6ef204830 Added /**/ around #end tags 1997-08-21 02:30:45 +00:00
Guido van Rossum 725d941f0f Renamed strndup to pystrndup, to avoid conflicting prototype
in GNU libc on some platforms.
1997-08-20 23:38:57 +00:00
Guido van Rossum 142eeb8339 cPickle release 0.3 from Jim Fulton 1997-08-13 03:14:41 +00:00
Guido van Rossum 5a37d7d150 Renamed strndup to my_strndup to avoid conflict witth GNU libc. 1997-05-16 16:36:52 +00:00
Guido van Rossum de8d6d73fb Use compile-time test for 64-bit hardware instead of run-time test.
This silences some compilers.
1997-05-13 18:00:44 +00:00
Guido van Rossum b05a5c7698 Instead of importing graminit.h whenever one of the three grammar 'root'
symbols is needed, define these in Python.h with a Py_ prefix.
1997-05-07 17:46:13 +00:00
Guido van Rossum d385d59c09 Give PyErr_Format a new name and make it static. 1997-04-09 17:47:47 +00:00
Guido van Rossum 60456fdcfe Jim Fulton's version 2.2. 1997-04-09 17:36:32 +00:00
Barry Warsaw 93d29b6895 Eliminated gcc -Wall complaints:
- Quieted gcc -Wall by removing unused local variables.

    - Added some choice parentheses around assignments in conditional
      tests.

    - Removed an unused (and seemingly unreachable) err label in
      load_short_binstring().

    - in Unpickler_load(), removed \. in string format.

    - init_stuff() was declared to return an int, but had these
      problems:

	- it was returning NULL instead of 0 or 1 in some cases
	- it was falling of the end of the routine without returning
	  anything
	- the call of init_stuff() in initcPickle() was never checking
	  the return value anyway.

      I changed all this by returning 1 in the case of errors, 0 when
      no error occurred.  Then in initcPickle(), if init_stuff()
      returns non-zero, I call Py_FatalError().

Suppressing my urge to reformat according to Python coding standards!
:-)
1997-01-14 17:45:08 +00:00
Guido van Rossum 2f4caa4c48 cPickle, version 0.1. 1997-01-06 22:59:08 +00:00