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
c6994906
Commit
c6994906
authored
Apr 22, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a leak in interactive mode, -m mode and a leak when calling tp_setattr
parent
62300c69
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
+10
-4
from_cpython/Modules/_io/bufferedio.c
from_cpython/Modules/_io/bufferedio.c
+3
-0
src/jit.cpp
src/jit.cpp
+3
-1
src/runtime/capi.cpp
src/runtime/capi.cpp
+3
-3
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+1
-0
No files found.
from_cpython/Modules/_io/bufferedio.c
View file @
c6994906
...
@@ -732,6 +732,9 @@ _PyIO_trap_eintr(void)
...
@@ -732,6 +732,9 @@ _PyIO_trap_eintr(void)
if
(
eintr_int
==
NULL
)
{
if
(
eintr_int
==
NULL
)
{
eintr_int
=
PyLong_FromLong
(
EINTR
);
eintr_int
=
PyLong_FromLong
(
EINTR
);
assert
(
eintr_int
!=
NULL
);
assert
(
eintr_int
!=
NULL
);
// Pyston change:
PyGC_RegisterStaticConstant
(
eintr_int
);
}
}
if
(
!
PyErr_ExceptionMatches
(
PyExc_EnvironmentError
))
if
(
!
PyErr_ExceptionMatches
(
PyExc_EnvironmentError
))
return
0
;
return
0
;
...
...
src/jit.cpp
View file @
c6994906
...
@@ -476,7 +476,7 @@ static int main(int argc, char** argv) noexcept {
...
@@ -476,7 +476,7 @@ static int main(int argc, char** argv) noexcept {
}
}
}
else
if
(
module
!=
NULL
)
{
}
else
if
(
module
!=
NULL
)
{
// TODO: CPython uses the same main module for all code paths
// TODO: CPython uses the same main module for all code paths
main_module
=
createModule
(
boxString
(
"__main__"
),
"<string>"
);
main_module
=
createModule
(
autoDecref
(
boxString
(
"__main__"
)
),
"<string>"
);
rtncode
=
(
RunModule
(
module
,
1
)
!=
0
);
rtncode
=
(
RunModule
(
module
,
1
)
!=
0
);
}
else
{
}
else
{
main_module
=
createModule
(
autoDecref
(
boxString
(
"__main__"
)),
fn
?
fn
:
"<stdin>"
);
main_module
=
createModule
(
autoDecref
(
boxString
(
"__main__"
)),
fn
?
fn
:
"<stdin>"
);
...
@@ -526,6 +526,8 @@ static int main(int argc, char** argv) noexcept {
...
@@ -526,6 +526,8 @@ static int main(int argc, char** argv) noexcept {
PyObject
*
v
=
PyImport_ImportModule
(
"readline"
);
PyObject
*
v
=
PyImport_ImportModule
(
"readline"
);
if
(
!
v
)
if
(
!
v
)
PyErr_Clear
();
PyErr_Clear
();
else
Py_CLEAR
(
v
);
printf
(
"Pyston v%d.%d.%d (rev "
STRINGIFY
(
GITREV
)
")"
,
PYSTON_VERSION_MAJOR
,
PYSTON_VERSION_MINOR
,
printf
(
"Pyston v%d.%d.%d (rev "
STRINGIFY
(
GITREV
)
")"
,
PYSTON_VERSION_MAJOR
,
PYSTON_VERSION_MINOR
,
PYSTON_VERSION_MICRO
);
PYSTON_VERSION_MICRO
);
...
...
src/runtime/capi.cpp
View file @
c6994906
...
@@ -987,8 +987,6 @@ extern "C" int PyRun_InteractiveOneFlags(FILE* fp, const char* filename, PyCompi
...
@@ -987,8 +987,6 @@ extern "C" int PyRun_InteractiveOneFlags(FILE* fp, const char* filename, PyCompi
// Pyston change:
// Pyston change:
// d = PyModule_GetDict(m);
// d = PyModule_GetDict(m);
// v = run_mod(mod, filename, d, d, flags, arena);
// v = run_mod(mod, filename, d, d, flags, arena);
v
=
None
;
Py_INCREF
(
v
);
assert
(
PyModule_Check
(
m
));
assert
(
PyModule_Check
(
m
));
bool
failed
=
false
;
bool
failed
=
false
;
try
{
try
{
...
@@ -1005,7 +1003,9 @@ extern "C" int PyRun_InteractiveOneFlags(FILE* fp, const char* filename, PyCompi
...
@@ -1005,7 +1003,9 @@ extern "C" int PyRun_InteractiveOneFlags(FILE* fp, const char* filename, PyCompi
PyErr_Print
();
PyErr_Print
();
return
-
1
;
return
-
1
;
}
}
Py_DECREF
(
v
);
// Pyston change: we dont't have v
// Py_DECREF(v);
if
(
Py_FlushLine
())
if
(
Py_FlushLine
())
PyErr_Clear
();
PyErr_Clear
();
return
0
;
return
0
;
...
...
src/runtime/objmodel.cpp
View file @
c6994906
...
@@ -3120,6 +3120,7 @@ extern "C" void setattr(Box* obj, BoxedString* attr, STOLEN(Box*) attr_val) {
...
@@ -3120,6 +3120,7 @@ extern "C" void setattr(Box* obj, BoxedString* attr, STOLEN(Box*) attr_val) {
STAT_TIMER
(
t1
,
"us_timer_slowpath_tpsetattr"
,
10
);
STAT_TIMER
(
t1
,
"us_timer_slowpath_tpsetattr"
,
10
);
assert
(
attr
->
data
()[
attr
->
size
()]
==
'\0'
);
assert
(
attr
->
data
()[
attr
->
size
()]
==
'\0'
);
AUTO_DECREF
(
attr_val
);
int
rtn
=
obj
->
cls
->
tp_setattr
(
obj
,
const_cast
<
char
*>
(
attr
->
data
()),
attr_val
);
int
rtn
=
obj
->
cls
->
tp_setattr
(
obj
,
const_cast
<
char
*>
(
attr
->
data
()),
attr_val
);
if
(
rtn
)
if
(
rtn
)
throwCAPIException
();
throwCAPIException
();
...
...
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