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
3d9ead49
Commit
3d9ead49
authored
May 02, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #486 from tjhance/tuple-resize
prohibit _PyTuple_Resize for objects that are subclasses of tuple
parents
95539215
570ba0a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
src/runtime/tuple.cpp
src/runtime/tuple.cpp
+3
-7
No files found.
src/runtime/tuple.cpp
View file @
3d9ead49
...
...
@@ -119,7 +119,7 @@ extern "C" int _PyTuple_Resize(PyObject** pv, Py_ssize_t newsize) noexcept {
}
int
BoxedTuple
::
Resize
(
BoxedTuple
**
pv
,
size_t
newsize
)
noexcept
{
assert
(
isSubclass
((
*
pv
)
->
cls
,
tuple_cls
)
);
assert
(
(
*
pv
)
->
cls
==
tuple_cls
);
BoxedTuple
*
t
=
static_cast
<
BoxedTuple
*>
(
*
pv
);
...
...
@@ -132,12 +132,8 @@ int BoxedTuple::Resize(BoxedTuple** pv, size_t newsize) noexcept {
return
0
;
}
BoxedTuple
*
resized
;
if
(
t
->
cls
==
tuple_cls
)
resized
=
new
(
newsize
)
BoxedTuple
(
newsize
);
// we want an uninitialized tuple, but this will memset it with 0.
else
resized
=
new
(
t
->
cls
,
newsize
)
BoxedTuple
(
newsize
);
// we need an uninitialized string, but this will memset
BoxedTuple
*
resized
=
new
(
newsize
)
BoxedTuple
(
newsize
);
// we want an uninitialized tuple, but this will memset it with 0.
memmove
(
resized
->
elts
,
t
->
elts
,
t
->
size
());
*
pv
=
resized
;
...
...
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