Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
88fc68e8
Commit
88fc68e8
authored
Nov 12, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed several bugs in pickling ZClass instances.
parent
b06b35af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
31 deletions
+27
-31
src/ZODB/coptimizations.c
src/ZODB/coptimizations.c
+27
-31
No files found.
src/ZODB/coptimizations.c
View file @
88fc68e8
...
@@ -92,7 +92,7 @@ static void PyVar_Assign(PyObject **v, PyObject *e) { Py_XDECREF(*v); *v=e;}
...
@@ -92,7 +92,7 @@ static void PyVar_Assign(PyObject **v, PyObject *e) { Py_XDECREF(*v); *v=e;}
#define OBJECT(O) ((PyObject*)(O))
#define OBJECT(O) ((PyObject*)(O))
static
PyObject
*
py__p_oid
,
*
py__p_jar
,
*
py___getinitargs__
,
*
py___module__
;
static
PyObject
*
py__p_oid
,
*
py__p_jar
,
*
py___getinitargs__
,
*
py___module__
;
static
PyObject
*
py_new_oid
,
*
py___class__
;
static
PyObject
*
py_new_oid
,
*
py___class__
,
*
py___name__
;
typedef
struct
{
typedef
struct
{
...
@@ -131,7 +131,7 @@ persistent_id_dealloc(persistent_id *self)
...
@@ -131,7 +131,7 @@ persistent_id_dealloc(persistent_id *self)
static
PyObject
*
static
PyObject
*
persistent_id_call
(
persistent_id
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
persistent_id_call
(
persistent_id
*
self
,
PyObject
*
args
,
PyObject
*
kwargs
)
{
{
PyObject
*
object
,
*
oid
,
*
jar
=
NULL
,
*
r
=
NULL
,
*
klass
;
PyObject
*
object
,
*
oid
,
*
jar
=
NULL
,
*
r
=
NULL
,
*
klass
=
NULL
;
/*
/*
def persistent_id(object, self=self,stackup=stackup):
def persistent_id(object, self=self,stackup=stackup):
...
@@ -201,15 +201,13 @@ persistent_id_call(persistent_id *self, PyObject *args, PyObject *kwargs)
...
@@ -201,15 +201,13 @@ persistent_id_call(persistent_id *self, PyObject *args, PyObject *kwargs)
Py_DECREF
(
r
);
Py_DECREF
(
r
);
}
}
Py_XDECREF
(
jar
);
/*
/*
klass=object.__class__
klass=object.__class__
if klass is ExtensionKlass: return oid
if klass is ExtensionKlass: return oid
*/
*/
if
(
PyExtensionClass_Check
(
object
))
return
oid
;
if
(
PyExtensionClass_Check
(
object
))
goto
return_
oid
;
/*
/*
if hasattr(klass, '__getinitargs__'): return oid
if hasattr(klass, '__getinitargs__'): return oid
...
@@ -218,41 +216,34 @@ persistent_id_call(persistent_id *self, PyObject *args, PyObject *kwargs)
...
@@ -218,41 +216,34 @@ persistent_id_call(persistent_id *self, PyObject *args, PyObject *kwargs)
if
((
r
=
PyObject_GetAttr
(
klass
,
py___getinitargs__
)))
if
((
r
=
PyObject_GetAttr
(
klass
,
py___getinitargs__
)))
{
{
Py_DECREF
(
r
);
Py_DECREF
(
r
);
return
oid
;
goto
return_
oid
;
}
}
PyErr_Clear
();
PyErr_Clear
();
/*
/*
module=getattr(klass,'__module__','')
module=getattr(klass,'__module__','')
if module: klass=module, klass.__name__
if module: klass=module, klass.__name__
else: return oid # degenerate 1.x ZClass case
*/
*/
if
((
jar
=
PyObject_GetAttr
(
klass
,
py___module__
)))
UNLESS
(
jar
=
PyObject_GetAttr
(
klass
,
py___module__
))
goto
err
;
{
UNLESS
(
r
=
PyTuple_New
(
2
))
goto
err
;
UNLESS
(
PyObject_IsTrue
(
jar
))
goto
return_oid
;
PyTuple_SET_ITEM
(
r
,
0
,
jar
);
Py_INCREF
(
klass
);
ASSIGN
(
klass
,
PyObject_GetAttr
(
klass
,
py___name__
));
PyTuple_SET_ITEM
(
r
,
1
,
klass
);
UNLESS
(
klass
)
goto
err
;
klass
=
r
;
}
UNLESS
(
r
=
PyTuple_New
(
2
))
goto
err
;
else
PyTuple_SET_ITEM
(
r
,
0
,
jar
);
{
PyTuple_SET_ITEM
(
r
,
1
,
klass
);
PyErr_Clear
();
klass
=
r
;
Py_INCREF
(
klass
);
jar
=
NULL
;
}
/*
/*
return oid, klass
return oid, klass
*/
*/
if
((
r
=
PyTuple_New
(
2
)))
UNLESS
(
r
=
PyTuple_New
(
2
))
goto
err
;
{
PyTuple_SET_ITEM
(
r
,
0
,
oid
);
PyTuple_SET_ITEM
(
r
,
0
,
oid
);
PyTuple_SET_ITEM
(
r
,
1
,
klass
);
PyTuple_SET_ITEM
(
r
,
1
,
klass
);
}
else
{
Py_DECREF
(
oid
);
Py_DECREF
(
klass
);
}
return
r
;
return
r
;
not_persistent:
not_persistent:
...
@@ -261,8 +252,12 @@ not_persistent:
...
@@ -261,8 +252,12 @@ not_persistent:
err:
err:
Py_DECREF
(
oid
);
Py_DECREF
(
oid
);
oid
=
NULL
;
return_oid:
Py_XDECREF
(
jar
);
Py_XDECREF
(
jar
);
return
NULL
;
Py_XDECREF
(
klass
);
return
oid
;
}
}
...
@@ -310,7 +305,7 @@ void
...
@@ -310,7 +305,7 @@ void
initcoptimizations
()
initcoptimizations
()
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
3
$"
;
char
*
rev
=
"$Revision: 1.
4
$"
;
#define make_string(S) if (! (py_ ## S=PyString_FromString(#S))) return
#define make_string(S) if (! (py_ ## S=PyString_FromString(#S))) return
make_string
(
_p_oid
);
make_string
(
_p_oid
);
...
@@ -318,6 +313,7 @@ initcoptimizations()
...
@@ -318,6 +313,7 @@ initcoptimizations()
make_string
(
__getinitargs__
);
make_string
(
__getinitargs__
);
make_string
(
__module__
);
make_string
(
__module__
);
make_string
(
__class__
);
make_string
(
__class__
);
make_string
(
__name__
);
make_string
(
new_oid
);
make_string
(
new_oid
);
UNLESS
(
ExtensionClassImported
)
return
;
UNLESS
(
ExtensionClassImported
)
return
;
...
...
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