Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
90cf25e6
Commit
90cf25e6
authored
Feb 26, 1997
by
chris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
object stored in Pickler memo along with id
parent
20a05502
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
13 deletions
+25
-13
lib/Components/cPickle/cPickle.c
lib/Components/cPickle/cPickle.c
+16
-4
lib/Components/cPickle/pickle.py
lib/Components/cPickle/pickle.py
+9
-9
No files found.
lib/Components/cPickle/cPickle.c
View file @
90cf25e6
/*
$Id: cPickle.c,v 1.2
1 1997/02/19 15:29:36 jim
Exp $
$Id: cPickle.c,v 1.2
2 1997/02/26 19:34:38 chris
Exp $
Copyright
...
...
@@ -486,6 +486,9 @@ get(Picklerobject *self, PyObject *id) {
UNLESS
(
value
=
PyDict_GetItem
(
self
->
memo
,
id
))
return
-
1
;
UNLESS
(
value
=
PyTuple_GetItem
(
value
,
0
))
return
-
1
;
c_value
=
PyInt_AsLong
(
value
);
if
(
!
self
->
bin
)
{
...
...
@@ -520,7 +523,7 @@ static int
put
(
Picklerobject
*
self
,
PyObject
*
ob
)
{
char
c_str
[
30
];
int
p
,
len
,
res
=
-
1
;
PyObject
*
py_ob_id
=
0
,
*
memo_len
=
0
;
PyObject
*
py_ob_id
=
0
,
*
memo_len
=
0
,
*
t
=
0
;
if
(
ob
->
ob_refcnt
<
2
)
return
0
;
...
...
@@ -558,7 +561,15 @@ put(Picklerobject *self, PyObject *ob) {
UNLESS
(
memo_len
=
PyInt_FromLong
(
p
))
goto
finally
;
if
(
PyDict_SetItem
(
self
->
memo
,
py_ob_id
,
memo_len
)
<
0
)
UNLESS
(
t
=
PyTuple_New
(
2
))
goto
finally
;
PyTuple_SET_ITEM
(
t
,
0
,
memo_len
);
Py_INCREF
(
memo_len
);
PyTuple_SET_ITEM
(
t
,
1
,
ob
);
Py_INCREF
(
ob
);
if
(
PyDict_SetItem
(
self
->
memo
,
py_ob_id
,
t
)
<
0
)
goto
finally
;
res
=
0
;
...
...
@@ -566,6 +577,7 @@ put(Picklerobject *self, PyObject *ob) {
finally:
Py_XDECREF
(
py_ob_id
);
Py_XDECREF
(
memo_len
);
Py_XDECREF
(
t
);
return
res
;
}
...
...
@@ -3507,7 +3519,7 @@ init_stuff(PyObject *module, PyObject *module_dict) {
void
initcPickle
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.2
1
$"
;
char
*
rev
=
"$Revision: 1.2
2
$"
;
/* Create the module and add the functions */
m
=
Py_InitModule4
(
"cPickle"
,
cPickle_methods
,
...
...
lib/Components/cPickle/pickle.py
View file @
90cf25e6
# $Id: pickle.py,v 1.
7 1997/02/21 22:24:2
3 chris Exp $
# $Id: pickle.py,v 1.
8 1997/02/26 19:34:5
3 chris Exp $
#
# Copyright
#
...
...
@@ -295,7 +295,7 @@ class Pickler:
return
if
memo
.
has_key
(
d
):
self
.
write
(
self
.
get
(
memo
[
d
]))
self
.
write
(
self
.
get
(
memo
[
d
]
[
0
]
))
return
try
:
...
...
@@ -417,7 +417,7 @@ class Pickler:
memo_len
=
len
(
memo
)
self
.
write
(
self
.
put
(
memo_len
))
memo
[
d
]
=
memo_len
memo
[
d
]
=
(
memo_len
,
object
)
dispatch
[
StringType
]
=
save_string
def
save_tuple
(
self
,
object
):
...
...
@@ -434,12 +434,12 @@ class Pickler:
save
(
element
)
if
(
memo
.
has_key
(
d
)):
write
(
POP
*
len
(
object
)
+
self
.
get
(
memo
[
d
]))
write
(
POP
*
len
(
object
)
+
self
.
get
(
memo
[
d
]
[
0
]
))
return
memo_len
=
len
(
memo
)
self
.
write
(
TUPLE
+
self
.
put
(
memo_len
))
memo
[
d
]
=
memo_len
memo
[
d
]
=
(
memo_len
,
object
)
dispatch
[
TupleType
]
=
save_tuple
def
save_empty_tuple
(
self
,
object
):
...
...
@@ -473,7 +473,7 @@ class Pickler:
memo_len
=
len
(
memo
)
write
(
self
.
put
(
memo_len
))
memo
[
d
]
=
memo_len
memo
[
d
]
=
(
memo_len
,
object
)
dispatch
[
ListType
]
=
save_list
def
save_dict
(
self
,
object
):
...
...
@@ -506,7 +506,7 @@ class Pickler:
memo_len
=
len
(
memo
)
self
.
write
(
self
.
put
(
memo_len
))
memo
[
d
]
=
memo_len
memo
[
d
]
=
(
memo_len
,
object
)
dispatch
[
DictionaryType
]
=
save_dict
def
save_inst
(
self
,
object
):
...
...
@@ -540,7 +540,7 @@ class Pickler:
write
(
INST
+
module
+
'
\
n
'
+
name
+
'
\
n
'
+
self
.
put
(
memo_len
))
memo
[
d
]
=
memo_len
memo
[
d
]
=
(
memo_len
,
object
)
try
:
getstate
=
object
.
__getstate__
...
...
@@ -564,7 +564,7 @@ class Pickler:
memo_len
=
len
(
memo
)
write
(
GLOBAL
+
module
+
'
\
n
'
+
name
+
'
\
n
'
+
self
.
put
(
memo_len
))
memo
[
id
(
object
)]
=
memo_len
memo
[
id
(
object
)]
=
(
memo_len
,
object
)
dispatch
[
ClassType
]
=
save_global
dispatch
[
FunctionType
]
=
save_global
dispatch
[
BuiltinFunctionType
]
=
save_global
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment