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
631bd896
Commit
631bd896
authored
Jul 15, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the _bisect module
+ fix a leak in PyList_Insert
parent
48ec63a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
from_cpython/CMakeLists.txt
from_cpython/CMakeLists.txt
+1
-0
src/runtime/list.cpp
src/runtime/list.cpp
+11
-7
src/runtime/types.cpp
src/runtime/types.cpp
+2
-0
No files found.
from_cpython/CMakeLists.txt
View file @
631bd896
...
...
@@ -20,6 +20,7 @@ add_custom_target(copy_stdlib ALL DEPENDS ${STDLIB_TARGETS})
# compile specified files in from_cpython/Modules
file
(
GLOB_RECURSE STDMODULE_SRCS Modules
_bisectmodule.c
_codecsmodule.c
_collectionsmodule.c
_csv.c
...
...
src/runtime/list.cpp
View file @
631bd896
...
...
@@ -698,12 +698,7 @@ extern "C" Box* listDelitem(BoxedList* self, Box* slice) {
return
rtn
;
}
extern
"C"
Box
*
listInsert
(
BoxedList
*
self
,
Box
*
idx
,
Box
*
v
)
{
if
(
idx
->
cls
!=
int_cls
)
{
raiseExcHelper
(
TypeError
,
"an integer is required"
);
}
int64_t
n
=
static_cast
<
BoxedInt
*>
(
idx
)
->
n
;
extern
"C"
void
listInsertInternal
(
BoxedList
*
self
,
int64_t
n
,
Box
*
v
)
{
if
(
n
<
0
)
n
=
self
->
size
+
n
;
...
...
@@ -721,6 +716,15 @@ extern "C" Box* listInsert(BoxedList* self, Box* idx, Box* v) {
Py_INCREF
(
v
);
self
->
elts
->
elts
[
n
]
=
v
;
}
}
extern
"C"
Box
*
listInsert
(
BoxedList
*
self
,
Box
*
idx
,
Box
*
v
)
{
if
(
idx
->
cls
!=
int_cls
)
{
raiseExcHelper
(
TypeError
,
"an integer is required"
);
}
int64_t
n
=
static_cast
<
BoxedInt
*>
(
idx
)
->
n
;
listInsertInternal
(
self
,
n
,
v
);
Py_RETURN_NONE
;
}
...
...
@@ -735,7 +739,7 @@ extern "C" int PyList_Insert(PyObject* op, Py_ssize_t where, PyObject* newitem)
PyErr_BadInternalCall
();
return
-
1
;
}
listInsert
((
BoxedList
*
)
op
,
boxInt
(
where
)
,
newitem
);
listInsert
Internal
((
BoxedList
*
)
op
,
where
,
newitem
);
return
0
;
}
catch
(
ExcInfo
e
)
{
setCAPIException
(
e
);
...
...
src/runtime/types.cpp
View file @
631bd896
...
...
@@ -51,6 +51,7 @@
#include "runtime/super.h"
#include "runtime/util.h"
extern
"C"
void
init_bisect
();
extern
"C"
void
initerrno
();
extern
"C"
void
init_sha
();
extern
"C"
void
init_sha256
();
...
...
@@ -4085,6 +4086,7 @@ extern "C" {
struct
_inittab
_PyImport_Inittab
[]
=
{
{
"array"
,
initarray
},
{
"_ast"
,
init_ast
},
{
"binascii"
,
initbinascii
},
{
"_bisect"
,
init_bisect
},
{
"_codecs"
,
init_codecs
},
{
"_collections"
,
init_collections
},
{
"cStringIO"
,
initcStringIO
},
...
...
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