Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
885046a2
Commit
885046a2
authored
Jul 22, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #744 from rudi-c/fix_setstate
Make sure to intern attribute string in PyObject_SetAttr.
parents
e6893159
d1eb84d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
src/capi/object.cpp
src/capi/object.cpp
+5
-2
test/tests/exceptions_basic.py
test/tests/exceptions_basic.py
+9
-0
No files found.
src/capi/object.cpp
View file @
885046a2
...
...
@@ -445,12 +445,15 @@ extern "C" int PyObject_SetAttr(PyObject* obj, PyObject* name, PyObject* value)
}
}
BoxedString
*
name_str
=
static_cast
<
BoxedString
*>
(
name
);
internStringMortalInplace
(
name_str
);
assert
(
PyString_Check
(
name
));
try
{
if
(
value
==
NULL
)
delattr
(
obj
,
static_cast
<
BoxedString
*>
(
name
)
);
delattr
(
obj
,
name_str
);
else
setattr
(
obj
,
static_cast
<
BoxedString
*>
(
name
)
,
value
);
setattr
(
obj
,
name_str
,
value
);
}
catch
(
ExcInfo
e
)
{
setCAPIException
(
e
);
return
-
1
;
...
...
test/tests/exceptions_basic.py
View file @
885046a2
...
...
@@ -101,3 +101,12 @@ def f14():
except
Exception
:
pass
f14
()
def
test_set_state
():
exc
=
BaseException
()
print
exc
.
__dict__
attrs
=
{
"x"
:
1
,
"y"
:
2
}
exc
.
__setstate__
(
attrs
)
print
exc
.
__dict__
==
attrs
test_set_state
()
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