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
d1eb84d5
Commit
d1eb84d5
authored
Jul 22, 2015
by
Rudi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure to intern attribute string in PyObject_SetAttr.
parent
07f0a1aa
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 @
d1eb84d5
...
...
@@ -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 @
d1eb84d5
...
...
@@ -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