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
ea1c4746
Commit
ea1c4746
authored
May 01, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #481 from kmod/capi_gcroots
Add PyGC_AddRoot calls any time we assign to a static variable
parents
27e04718
961be6f6
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
36 additions
and
35 deletions
+36
-35
Makefile
Makefile
+1
-0
from_cpython/Modules/_csv.c
from_cpython/Modules/_csv.c
+2
-2
from_cpython/Modules/_io/bufferedio.c
from_cpython/Modules/_io/bufferedio.c
+1
-1
from_cpython/Modules/_ssl.c
from_cpython/Modules/_ssl.c
+2
-2
from_cpython/Modules/_struct.c
from_cpython/Modules/_struct.c
+1
-1
from_cpython/Modules/binascii.c
from_cpython/Modules/binascii.c
+2
-2
from_cpython/Modules/datetimemodule.c
from_cpython/Modules/datetimemodule.c
+1
-1
from_cpython/Modules/posixmodule.c
from_cpython/Modules/posixmodule.c
+3
-3
from_cpython/Modules/resource.c
from_cpython/Modules/resource.c
+2
-2
from_cpython/Modules/selectmodule.c
from_cpython/Modules/selectmodule.c
+1
-1
from_cpython/Modules/signalmodule.c
from_cpython/Modules/signalmodule.c
+5
-5
from_cpython/Modules/socketmodule.c
from_cpython/Modules/socketmodule.c
+8
-8
from_cpython/Modules/threadmodule.c
from_cpython/Modules/threadmodule.c
+2
-2
from_cpython/Modules/timemodule.c
from_cpython/Modules/timemodule.c
+1
-1
from_cpython/Modules/zipimport.c
from_cpython/Modules/zipimport.c
+3
-3
from_cpython/Modules/zlibmodule.c
from_cpython/Modules/zlibmodule.c
+1
-1
No files found.
Makefile
View file @
ea1c4746
...
@@ -529,6 +529,7 @@ quick_check:
...
@@ -529,6 +529,7 @@ quick_check:
$(MAKE)
pyston_dbg
$(MAKE)
pyston_dbg
$(MAKE)
check_format
$(MAKE)
check_format
$(MAKE)
unittests
$(MAKE)
unittests
$(MAKE)
ext_pyston ext_python
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-R
pyston_dbg
-j
$(TEST_THREADS)
-a
=
-S
-k
--order-by-mtime
$(TESTS_DIR)
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-R
pyston_dbg
-j
$(TEST_THREADS)
-a
=
-S
-k
--order-by-mtime
$(TESTS_DIR)
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-R
pyston_dbg
-j
$(TEST_THREADS)
-a
=
-S
-k
--exit-code-only
--skip-failing
$(TEST_DIR)
/cpython
$(ARGS)
$(PYTHON)
$(TOOLS_DIR)
/tester.py
-R
pyston_dbg
-j
$(TEST_THREADS)
-a
=
-S
-k
--exit-code-only
--skip-failing
$(TEST_DIR)
/cpython
$(ARGS)
...
...
from_cpython/Modules/_csv.c
View file @
ea1c4746
...
@@ -1603,7 +1603,7 @@ init_csv(void)
...
@@ -1603,7 +1603,7 @@ init_csv(void)
return
;
return
;
/* Add _dialects dictionary */
/* Add _dialects dictionary */
dialects
=
Py
Dict_New
(
);
dialects
=
Py
GC_AddRoot
(
PyDict_New
()
);
if
(
dialects
==
NULL
)
if
(
dialects
==
NULL
)
return
;
return
;
if
(
PyModule_AddObject
(
module
,
"_dialects"
,
dialects
))
if
(
PyModule_AddObject
(
module
,
"_dialects"
,
dialects
))
...
@@ -1622,7 +1622,7 @@ init_csv(void)
...
@@ -1622,7 +1622,7 @@ init_csv(void)
return
;
return
;
/* Add the CSV exception object to the module. */
/* Add the CSV exception object to the module. */
error_obj
=
Py
Err_NewException
(
"_csv.Error"
,
NULL
,
NULL
);
error_obj
=
Py
GC_AddRoot
(
PyErr_NewException
(
"_csv.Error"
,
NULL
,
NULL
)
);
if
(
error_obj
==
NULL
)
if
(
error_obj
==
NULL
)
return
;
return
;
PyModule_AddObject
(
module
,
"Error"
,
error_obj
);
PyModule_AddObject
(
module
,
"Error"
,
error_obj
);
...
...
from_cpython/Modules/_io/bufferedio.c
View file @
ea1c4746
...
@@ -730,7 +730,7 @@ _PyIO_trap_eintr(void)
...
@@ -730,7 +730,7 @@ _PyIO_trap_eintr(void)
PyEnvironmentErrorObject
*
env_err
;
PyEnvironmentErrorObject
*
env_err
;
if
(
eintr_int
==
NULL
)
{
if
(
eintr_int
==
NULL
)
{
eintr_int
=
Py
Long_FromLong
(
EINTR
);
eintr_int
=
Py
GC_AddRoot
(
PyLong_FromLong
(
EINTR
)
);
assert
(
eintr_int
!=
NULL
);
assert
(
eintr_int
!=
NULL
);
}
}
if
(
!
PyErr_ExceptionMatches
(
PyExc_EnvironmentError
))
if
(
!
PyErr_ExceptionMatches
(
PyExc_EnvironmentError
))
...
...
from_cpython/Modules/_ssl.c
View file @
ea1c4746
...
@@ -1777,9 +1777,9 @@ init_ssl(void)
...
@@ -1777,9 +1777,9 @@ init_ssl(void)
OpenSSL_add_all_algorithms
();
OpenSSL_add_all_algorithms
();
/* Add symbols to module dict */
/* Add symbols to module dict */
PySSLErrorObject
=
PyErr_NewException
(
"ssl.SSLError"
,
PySSLErrorObject
=
Py
GC_AddRoot
(
Py
Err_NewException
(
"ssl.SSLError"
,
PySocketModule
.
error
,
PySocketModule
.
error
,
NULL
);
NULL
)
)
;
if
(
PySSLErrorObject
==
NULL
)
if
(
PySSLErrorObject
==
NULL
)
return
;
return
;
if
(
PyDict_SetItemString
(
d
,
"SSLError"
,
PySSLErrorObject
)
!=
0
)
if
(
PyDict_SetItemString
(
d
,
"SSLError"
,
PySSLErrorObject
)
!=
0
)
...
...
from_cpython/Modules/_struct.c
View file @
ea1c4746
...
@@ -2077,7 +2077,7 @@ init_struct(void)
...
@@ -2077,7 +2077,7 @@ init_struct(void)
/* Add some symbolic constants to the module */
/* Add some symbolic constants to the module */
if
(
StructError
==
NULL
)
{
if
(
StructError
==
NULL
)
{
StructError
=
Py
Err_NewException
(
"struct.error"
,
NULL
,
NULL
);
StructError
=
Py
GC_AddRoot
(
PyErr_NewException
(
"struct.error"
,
NULL
,
NULL
)
);
if
(
StructError
==
NULL
)
if
(
StructError
==
NULL
)
return
;
return
;
}
}
...
...
from_cpython/Modules/binascii.c
View file @
ea1c4746
...
@@ -1511,8 +1511,8 @@ initbinascii(void)
...
@@ -1511,8 +1511,8 @@ initbinascii(void)
PyDict_SetItemString
(
d
,
"__doc__"
,
x
);
PyDict_SetItemString
(
d
,
"__doc__"
,
x
);
Py_XDECREF
(
x
);
Py_XDECREF
(
x
);
Error
=
Py
Err_NewException
(
"binascii.Error"
,
NULL
,
NULL
);
Error
=
Py
GC_AddRoot
(
PyErr_NewException
(
"binascii.Error"
,
NULL
,
NULL
)
);
PyDict_SetItemString
(
d
,
"Error"
,
Error
);
PyDict_SetItemString
(
d
,
"Error"
,
Error
);
Incomplete
=
Py
Err_NewException
(
"binascii.Incomplete"
,
NULL
,
NULL
);
Incomplete
=
Py
GC_AddRoot
(
PyErr_NewException
(
"binascii.Incomplete"
,
NULL
,
NULL
)
);
PyDict_SetItemString
(
d
,
"Incomplete"
,
Incomplete
);
PyDict_SetItemString
(
d
,
"Incomplete"
,
Incomplete
);
}
}
from_cpython/Modules/datetimemodule.c
View file @
ea1c4746
...
@@ -3936,7 +3936,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
...
@@ -3936,7 +3936,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
return
NULL
;
return
NULL
;
if
(
module
==
NULL
&&
if
(
module
==
NULL
&&
(
module
=
Py
Import_ImportModuleNoBlock
(
"_strptime"
))
==
NULL
)
(
module
=
Py
GC_AddRoot
(
PyImport_ImportModuleNoBlock
(
"_strptime"
)
))
==
NULL
)
return
NULL
;
return
NULL
;
/* _strptime._strptime returns a two-element tuple. The first
/* _strptime._strptime returns a two-element tuple. The first
...
...
from_cpython/Modules/posixmodule.c
View file @
ea1c4746
...
@@ -4935,7 +4935,7 @@ _PyPopen(char *cmdstring, int mode, int n, int bufsize)
...
@@ -4935,7 +4935,7 @@ _PyPopen(char *cmdstring, int mode, int n, int bufsize)
*/
*/
if
(
!
_PyPopenProcs
)
if
(
!
_PyPopenProcs
)
{
{
_PyPopenProcs
=
Py
Dict_New
(
);
_PyPopenProcs
=
Py
GC_AddRoot
(
PyDict_New
()
);
}
}
if
(
_PyPopenProcs
)
if
(
_PyPopenProcs
)
...
@@ -5682,7 +5682,7 @@ _PyPopen(char *cmdstring, int mode, int n)
...
@@ -5682,7 +5682,7 @@ _PyPopen(char *cmdstring, int mode, int n)
* and variable number of files involved.
* and variable number of files involved.
*/
*/
if
(
!
_PyPopenProcs
)
{
if
(
!
_PyPopenProcs
)
{
_PyPopenProcs
=
Py
Dict_New
(
);
_PyPopenProcs
=
Py
GC_AddRoot
(
PyDict_New
()
);
}
}
if
(
_PyPopenProcs
)
{
if
(
_PyPopenProcs
)
{
...
@@ -6105,7 +6105,7 @@ wait_helper(pid_t pid, int status, struct rusage *ru)
...
@@ -6105,7 +6105,7 @@ wait_helper(pid_t pid, int status, struct rusage *ru)
PyObject
*
m
=
PyImport_ImportModuleNoBlock
(
"resource"
);
PyObject
*
m
=
PyImport_ImportModuleNoBlock
(
"resource"
);
if
(
m
==
NULL
)
if
(
m
==
NULL
)
return
NULL
;
return
NULL
;
struct_rusage
=
Py
Object_GetAttrString
(
m
,
"struct_rusage"
);
struct_rusage
=
Py
GC_AddRoot
(
PyObject_GetAttrString
(
m
,
"struct_rusage"
)
);
Py_DECREF
(
m
);
Py_DECREF
(
m
);
if
(
struct_rusage
==
NULL
)
if
(
struct_rusage
==
NULL
)
return
NULL
;
return
NULL
;
...
...
from_cpython/Modules/resource.c
View file @
ea1c4746
...
@@ -254,8 +254,8 @@ initresource(void)
...
@@ -254,8 +254,8 @@ initresource(void)
/* Add some symbolic constants to the module */
/* Add some symbolic constants to the module */
if
(
ResourceError
==
NULL
)
{
if
(
ResourceError
==
NULL
)
{
ResourceError
=
PyErr_NewException
(
"resource.error"
,
ResourceError
=
Py
GC_AddRoot
(
Py
Err_NewException
(
"resource.error"
,
NULL
,
NULL
);
NULL
,
NULL
)
)
;
}
}
Py_INCREF
(
ResourceError
);
Py_INCREF
(
ResourceError
);
PyModule_AddObject
(
m
,
"error"
,
ResourceError
);
PyModule_AddObject
(
m
,
"error"
,
ResourceError
);
...
...
from_cpython/Modules/selectmodule.c
View file @
ea1c4746
...
@@ -1807,7 +1807,7 @@ initselect(void)
...
@@ -1807,7 +1807,7 @@ initselect(void)
if
(
m
==
NULL
)
if
(
m
==
NULL
)
return
;
return
;
SelectError
=
Py
Err_NewException
(
"select.error"
,
NULL
,
NULL
);
SelectError
=
Py
GC_AddRoot
(
PyErr_NewException
(
"select.error"
,
NULL
,
NULL
)
);
Py_INCREF
(
SelectError
);
Py_INCREF
(
SelectError
);
PyModule_AddObject
(
m
,
"error"
,
SelectError
);
PyModule_AddObject
(
m
,
"error"
,
SelectError
);
...
...
from_cpython/Modules/signalmodule.c
View file @
ea1c4746
...
@@ -587,11 +587,11 @@ initsignal(void)
...
@@ -587,11 +587,11 @@ initsignal(void)
/* Add some symbolic constants to the module */
/* Add some symbolic constants to the module */
d
=
PyModule_GetDict
(
m
);
d
=
PyModule_GetDict
(
m
);
x
=
DefaultHandler
=
Py
Long_FromVoidPtr
((
void
*
)
SIG_DFL
);
x
=
DefaultHandler
=
Py
GC_AddRoot
(
PyLong_FromVoidPtr
((
void
*
)
SIG_DFL
)
);
if
(
!
x
||
PyDict_SetItemString
(
d
,
"SIG_DFL"
,
x
)
<
0
)
if
(
!
x
||
PyDict_SetItemString
(
d
,
"SIG_DFL"
,
x
)
<
0
)
goto
finally
;
goto
finally
;
x
=
IgnoreHandler
=
Py
Long_FromVoidPtr
((
void
*
)
SIG_IGN
);
x
=
IgnoreHandler
=
Py
GC_AddRoot
(
PyLong_FromVoidPtr
((
void
*
)
SIG_IGN
)
);
if
(
!
x
||
PyDict_SetItemString
(
d
,
"SIG_IGN"
,
x
)
<
0
)
if
(
!
x
||
PyDict_SetItemString
(
d
,
"SIG_IGN"
,
x
)
<
0
)
goto
finally
;
goto
finally
;
...
@@ -600,7 +600,7 @@ initsignal(void)
...
@@ -600,7 +600,7 @@ initsignal(void)
goto
finally
;
goto
finally
;
Py_DECREF
(
x
);
Py_DECREF
(
x
);
x
=
IntHandler
=
Py
Dict_GetItemString
(
d
,
"default_int_handler"
);
x
=
IntHandler
=
Py
GC_AddRoot
(
PyDict_GetItemString
(
d
,
"default_int_handler"
)
);
if
(
!
x
)
if
(
!
x
)
goto
finally
;
goto
finally
;
Py_INCREF
(
IntHandler
);
Py_INCREF
(
IntHandler
);
...
@@ -834,8 +834,8 @@ initsignal(void)
...
@@ -834,8 +834,8 @@ initsignal(void)
#endif
#endif
#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
ItimerError
=
PyErr_NewException
(
"signal.ItimerError"
,
ItimerError
=
Py
GC_AddRoot
(
Py
Err_NewException
(
"signal.ItimerError"
,
PyExc_IOError
,
NULL
);
PyExc_IOError
,
NULL
)
)
;
if
(
ItimerError
!=
NULL
)
if
(
ItimerError
!=
NULL
)
PyDict_SetItemString
(
d
,
"ItimerError"
,
ItimerError
);
PyDict_SetItemString
(
d
,
"ItimerError"
,
ItimerError
);
#endif
#endif
...
...
from_cpython/Modules/socketmodule.c
View file @
ea1c4746
...
@@ -4588,27 +4588,27 @@ init_socket(void)
...
@@ -4588,27 +4588,27 @@ init_socket(void)
if
(
m
==
NULL
)
if
(
m
==
NULL
)
return
;
return
;
socket_error
=
PyErr_NewException
(
"socket.error"
,
socket_error
=
Py
GC_AddRoot
(
Py
Err_NewException
(
"socket.error"
,
PyExc_IOError
,
NULL
);
PyExc_IOError
,
NULL
)
)
;
if
(
socket_error
==
NULL
)
if
(
socket_error
==
NULL
)
return
;
return
;
PySocketModuleAPI
.
error
=
socket_error
;
PySocketModuleAPI
.
error
=
socket_error
;
Py_INCREF
(
socket_error
);
Py_INCREF
(
socket_error
);
PyModule_AddObject
(
m
,
"error"
,
socket_error
);
PyModule_AddObject
(
m
,
"error"
,
socket_error
);
socket_herror
=
PyErr_NewException
(
"socket.herror"
,
socket_herror
=
Py
GC_AddRoot
(
Py
Err_NewException
(
"socket.herror"
,
socket_error
,
NULL
);
socket_error
,
NULL
)
)
;
if
(
socket_herror
==
NULL
)
if
(
socket_herror
==
NULL
)
return
;
return
;
Py_INCREF
(
socket_herror
);
Py_INCREF
(
socket_herror
);
PyModule_AddObject
(
m
,
"herror"
,
socket_herror
);
PyModule_AddObject
(
m
,
"herror"
,
socket_herror
);
socket_gaierror
=
PyErr_NewException
(
"socket.gaierror"
,
socket_error
,
socket_gaierror
=
Py
GC_AddRoot
(
Py
Err_NewException
(
"socket.gaierror"
,
socket_error
,
NULL
);
NULL
)
)
;
if
(
socket_gaierror
==
NULL
)
if
(
socket_gaierror
==
NULL
)
return
;
return
;
Py_INCREF
(
socket_gaierror
);
Py_INCREF
(
socket_gaierror
);
PyModule_AddObject
(
m
,
"gaierror"
,
socket_gaierror
);
PyModule_AddObject
(
m
,
"gaierror"
,
socket_gaierror
);
socket_timeout
=
PyErr_NewException
(
"socket.timeout"
,
socket_timeout
=
Py
GC_AddRoot
(
Py
Err_NewException
(
"socket.timeout"
,
socket_error
,
NULL
);
socket_error
,
NULL
)
)
;
if
(
socket_timeout
==
NULL
)
if
(
socket_timeout
==
NULL
)
return
;
return
;
Py_INCREF
(
socket_timeout
);
Py_INCREF
(
socket_timeout
);
...
...
from_cpython/Modules/threadmodule.c
View file @
ea1c4746
...
@@ -911,7 +911,7 @@ initthread(void)
...
@@ -911,7 +911,7 @@ initthread(void)
/* Add a symbolic constant */
/* Add a symbolic constant */
d
=
PyModule_GetDict
(
m
);
d
=
PyModule_GetDict
(
m
);
ThreadError
=
Py
Err_NewException
(
"thread.error"
,
NULL
,
NULL
);
ThreadError
=
Py
GC_AddRoot
(
PyErr_NewException
(
"thread.error"
,
NULL
,
NULL
)
);
PyDict_SetItemString
(
d
,
"error"
,
ThreadError
);
PyDict_SetItemString
(
d
,
"error"
,
ThreadError
);
Locktype
.
tp_doc
=
lock_doc
;
Locktype
.
tp_doc
=
lock_doc
;
if
(
PyType_Ready
(
&
Locktype
)
<
0
)
if
(
PyType_Ready
(
&
Locktype
)
<
0
)
...
@@ -925,7 +925,7 @@ initthread(void)
...
@@ -925,7 +925,7 @@ initthread(void)
nb_threads
=
0
;
nb_threads
=
0
;
str_dict
=
Py
String_InternFromString
(
"__dict__"
);
str_dict
=
Py
GC_AddRoot
(
PyString_InternFromString
(
"__dict__"
)
);
if
(
str_dict
==
NULL
)
if
(
str_dict
==
NULL
)
return
;
return
;
...
...
from_cpython/Modules/timemodule.c
View file @
ea1c4746
...
@@ -864,7 +864,7 @@ inittime(void)
...
@@ -864,7 +864,7 @@ inittime(void)
*/
*/
Py_XDECREF
(
moddict
);
Py_XDECREF
(
moddict
);
/* Squirrel away the module's dictionary for the y2k check */
/* Squirrel away the module's dictionary for the y2k check */
moddict
=
Py
Module_GetDict
(
m
);
moddict
=
Py
GC_AddRoot
(
PyModule_GetDict
(
m
)
);
Py_INCREF
(
moddict
);
Py_INCREF
(
moddict
);
/* Set, or reset, module variables like time.timezone */
/* Set, or reset, module variables like time.timezone */
...
...
from_cpython/Modules/zipimport.c
View file @
ea1c4746
...
@@ -1246,8 +1246,8 @@ initzipimport(void)
...
@@ -1246,8 +1246,8 @@ initzipimport(void)
if
(
mod
==
NULL
)
if
(
mod
==
NULL
)
return
;
return
;
ZipImportError
=
PyErr_NewException
(
"zipimport.ZipImportError"
,
ZipImportError
=
Py
GC_AddRoot
(
Py
Err_NewException
(
"zipimport.ZipImportError"
,
PyExc_ImportError
,
NULL
);
PyExc_ImportError
,
NULL
)
)
;
if
(
ZipImportError
==
NULL
)
if
(
ZipImportError
==
NULL
)
return
;
return
;
...
@@ -1261,7 +1261,7 @@ initzipimport(void)
...
@@ -1261,7 +1261,7 @@ initzipimport(void)
(
PyObject
*
)
&
ZipImporter_Type
)
<
0
)
(
PyObject
*
)
&
ZipImporter_Type
)
<
0
)
return
;
return
;
zip_directory_cache
=
Py
Dict_New
(
);
zip_directory_cache
=
Py
GC_AddRoot
(
PyDict_New
()
);
if
(
zip_directory_cache
==
NULL
)
if
(
zip_directory_cache
==
NULL
)
return
;
return
;
Py_INCREF
(
zip_directory_cache
);
Py_INCREF
(
zip_directory_cache
);
...
...
from_cpython/Modules/zlibmodule.c
View file @
ea1c4746
...
@@ -1066,7 +1066,7 @@ PyInit_zlib(void)
...
@@ -1066,7 +1066,7 @@ PyInit_zlib(void)
if
(
m
==
NULL
)
if
(
m
==
NULL
)
return
;
return
;
ZlibError
=
Py
Err_NewException
(
"zlib.error"
,
NULL
,
NULL
);
ZlibError
=
Py
GC_AddRoot
(
PyErr_NewException
(
"zlib.error"
,
NULL
,
NULL
)
);
if
(
ZlibError
!=
NULL
)
{
if
(
ZlibError
!=
NULL
)
{
Py_INCREF
(
ZlibError
);
Py_INCREF
(
ZlibError
);
PyModule_AddObject
(
m
,
"error"
,
ZlibError
);
PyModule_AddObject
(
m
,
"error"
,
ZlibError
);
...
...
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