Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
persistent
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
persistent
Commits
cb6a544c
Commit
cb6a544c
authored
Dec 14, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deal with unicode attribute names under Py3k.
parent
a20f0a72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
9 deletions
+35
-9
persistent/cPersistence.c
persistent/cPersistence.c
+35
-9
No files found.
persistent/cPersistence.c
View file @
cb6a544c
...
@@ -83,6 +83,8 @@ fatal_1350(cPersistentObject *self, const char *caller, const char *detail)
...
@@ -83,6 +83,8 @@ fatal_1350(cPersistentObject *self, const char *caller, const char *detail)
static
void
ghostify
(
cPersistentObject
*
);
static
void
ghostify
(
cPersistentObject
*
);
static
PyObject
*
convert_name
(
PyObject
*
name
);
/* Load the state of the object, unghostifying it. Upon success, return 1.
/* Load the state of the object, unghostifying it. Upon success, return 1.
* If an error occurred, re-ghostify the object and return -1.
* If an error occurred, re-ghostify the object and return -1.
*/
*/
...
@@ -349,13 +351,24 @@ pickle_copy_dict(PyObject *state)
...
@@ -349,13 +351,24 @@ pickle_copy_dict(PyObject *state)
while
(
PyDict_Next
(
state
,
&
pos
,
&
key
,
&
value
))
while
(
PyDict_Next
(
state
,
&
pos
,
&
key
,
&
value
))
{
{
int
is_special
;
#ifdef PY3K
if
(
key
&&
PyUnicode_Check
(
key
))
{
PyObject
*
converted
=
convert_name
(
key
);
ckey
=
PyBytes_AS_STRING
(
converted
);
#else
if
(
key
&&
PyBytes_Check
(
key
))
if
(
key
&&
PyBytes_Check
(
key
))
{
{
ckey
=
PyBytes_AS_STRING
(
key
);
ckey
=
PyBytes_AS_STRING
(
key
);
if
(
*
ckey
==
'_'
&&
#endif
(
ckey
[
1
]
==
'v'
||
ckey
[
1
]
==
'p'
)
&&
is_special
=
(
*
ckey
==
'_'
&&
ckey
[
2
]
==
'_'
)
(
ckey
[
1
]
==
'v'
||
ckey
[
1
]
==
'p'
)
&&
/* skip volatile and persistent */
ckey
[
2
]
==
'_'
);
#ifdef PY3K
Py_DECREF
(
converted
);
#endif
if
(
is_special
)
/* skip volatile and persistent */
continue
;
continue
;
}
}
...
@@ -417,17 +430,30 @@ pickle___getstate__(PyObject *self)
...
@@ -417,17 +430,30 @@ pickle___getstate__(PyObject *self)
for
(
i
=
0
;
i
<
PyList_GET_SIZE
(
slotnames
);
i
++
)
for
(
i
=
0
;
i
<
PyList_GET_SIZE
(
slotnames
);
i
++
)
{
{
PyObject
*
name
,
*
value
;
PyObject
*
name
,
*
value
;
char
*
cname
;
name
=
PyList_GET_ITEM
(
slotnames
,
i
);
name
=
PyList_GET_ITEM
(
slotnames
,
i
);
#ifdef PY3K
if
(
PyUnicode_Check
(
name
))
{
char
*
cname
;
int
is_special
;
PyObject
*
converted
=
convert_name
(
name
);
cname
=
PyBytes_AS_STRING
(
converted
);
#else
if
(
PyBytes_Check
(
name
))
if
(
PyBytes_Check
(
name
))
{
{
cname
=
PyBytes_AS_STRING
(
name
);
cname
=
PyBytes_AS_STRING
(
name
);
if
(
*
cname
==
'_'
&&
#endif
(
cname
[
1
]
==
'v'
||
cname
[
1
]
==
'p'
)
&&
is_special
=
(
*
cname
==
'_'
&&
cname
[
2
]
==
'_'
)
(
cname
[
1
]
==
'v'
||
cname
[
1
]
==
'p'
)
&&
/* skip volatile and persistent */
cname
[
2
]
==
'_'
);
#ifdef PY3K
Py_DECREF
(
converted
);
#endif
if
(
is_special
)
/* skip volatile and persistent */
{
continue
;
continue
;
}
}
}
/* Unclear: Will this go through our getattr hook? */
/* Unclear: Will this go through our getattr hook? */
...
...
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