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
3a2c0407
Commit
3a2c0407
authored
Nov 13, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hmm
parent
fabde965
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
9 deletions
+18
-9
from_cpython/Include/Python.h
from_cpython/Include/Python.h
+5
-0
from_cpython/Modules/threadmodule.c
from_cpython/Modules/threadmodule.c
+1
-0
src/runtime/builtin_modules/thread.cpp
src/runtime/builtin_modules/thread.cpp
+7
-7
src/runtime/types.cpp
src/runtime/types.cpp
+4
-1
src/runtime/types.h
src/runtime/types.h
+1
-1
No files found.
from_cpython/Include/Python.h
View file @
3a2c0407
...
...
@@ -123,6 +123,11 @@ PyAPI_FUNC(int) PyObject_DelHcAttrString(PyObject*, const char*) PYSTON_NOEXCEPT
// Workaround: call this instead of setting tp_dict.
PyAPI_FUNC
(
void
)
PyType_SetDict
(
PyTypeObject
*
,
PyObject
*
)
PYSTON_NOEXCEPT
;
// Pyston addition: register an object as a "static constant". Current purpose is that this will
// get decref'd when the interpreter shuts down.
// PyType_Ready calls this automatically.
PyAPI_FUNC
(
void
)
PyGC_RegisterStaticConstant
(
PyObject
*
)
PYSTON_NOEXCEPT
;
#include "codecs.h"
#include "pyerrors.h"
...
...
from_cpython/Modules/threadmodule.c
View file @
3a2c0407
...
...
@@ -945,6 +945,7 @@ initthread(void)
str_dict
=
PyString_InternFromString
(
"__dict__"
);
if
(
str_dict
==
NULL
)
return
;
PyGC_RegisterStaticConstant
(
str_dict
);
/* Initialize the C thread library */
//PyThread_init_thread(); // pyston change
...
...
src/runtime/builtin_modules/thread.cpp
View file @
3a2c0407
...
...
@@ -206,7 +206,7 @@ void setupThread() {
initthread
();
RELEASE_ASSERT
(
!
PyErr_Occurred
(),
""
);
Box
*
thread_module
=
getSysModulesDict
()
->
getOrNull
(
boxString
(
"thread"
));
Box
*
thread_module
=
getSysModulesDict
()
->
getOrNull
(
autoDecref
(
boxString
(
"thread"
)
));
assert
(
thread_module
);
thread_module
->
giveAttr
(
...
...
@@ -231,17 +231,17 @@ void setupThread() {
thread_lock_cls
->
giveAttr
(
"__module__"
,
boxString
(
"thread"
));
thread_lock_cls
->
giveAttr
(
"acquire"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
BoxedThreadLock
::
acquire
,
BOXED_BOOL
,
2
,
false
,
false
),
{
boxInt
(
1
)
}));
{
autoDecref
(
boxInt
(
1
)
)
}));
thread_lock_cls
->
giveAttr
(
"release"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
BoxedThreadLock
::
release
,
NONE
,
1
)));
thread_lock_cls
->
giveAttr
(
"acquire_lock"
,
thread_lock_cls
->
getattr
(
internStringMortal
(
"acquire"
)));
thread_lock_cls
->
giveAttr
(
"release_lock"
,
thread_lock_cls
->
getattr
(
internStringMortal
(
"release"
)));
thread_lock_cls
->
giveAttr
(
"__enter__"
,
thread_lock_cls
->
getattr
(
internStringMortal
(
"acquire"
)));
thread_lock_cls
->
giveAttr
Borrowed
(
"acquire_lock"
,
thread_lock_cls
->
getattr
(
getStaticString
(
"acquire"
)));
thread_lock_cls
->
giveAttr
Borrowed
(
"release_lock"
,
thread_lock_cls
->
getattr
(
getStaticString
(
"release"
)));
thread_lock_cls
->
giveAttr
Borrowed
(
"__enter__"
,
thread_lock_cls
->
getattr
(
getStaticString
(
"acquire"
)));
thread_lock_cls
->
giveAttr
(
"__exit__"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
BoxedThreadLock
::
exit
,
NONE
,
4
)));
thread_lock_cls
->
giveAttr
(
"locked"
,
new
BoxedFunction
(
FunctionMetadata
::
create
((
void
*
)
BoxedThreadLock
::
locked
,
BOXED_BOOL
,
1
)));
thread_lock_cls
->
giveAttr
(
"locked_lock"
,
thread_lock_cls
->
getattr
(
internStringMortal
(
"locked"
)));
thread_lock_cls
->
giveAttr
Borrowed
(
"locked_lock"
,
thread_lock_cls
->
getattr
(
getStaticString
(
"locked"
)));
thread_lock_cls
->
freeze
();
ThreadError
=
BoxedClass
::
create
(
type_cls
,
Exception
,
Exception
->
attrs_offset
,
Exception
->
tp_weaklistoffset
,
...
...
@@ -249,6 +249,6 @@ void setupThread() {
ThreadError
->
giveAttr
(
"__module__"
,
boxString
(
"thread"
));
ThreadError
->
freeze
();
thread_module
->
giveAttr
(
"error"
,
ThreadError
);
thread_module
->
giveAttr
Borrowed
(
"error"
,
ThreadError
);
}
}
src/runtime/types.cpp
View file @
3a2c0407
...
...
@@ -3431,6 +3431,9 @@ void BoxedClass::dealloc(Box* b) noexcept {
#endif
std
::
vector
<
Box
*>
constants
;
extern
"C"
void
PyGC_RegisterStaticConstant
(
Box
*
b
)
{
constants
.
push_back
(
b
);
}
extern
"C"
void
_PyUnicode_Fini
(
void
);
...
...
@@ -3922,7 +3925,7 @@ void setupRuntime() {
attrwrapperiter_cls
->
tp_iternext
=
AttrWrapperIter
::
next_capi
;
setupBuiltins
();
//
_PyExc_Init();
_PyExc_Init
();
//setupThread();
//initgc();
//setupImport();
...
...
src/runtime/types.h
View file @
3a2c0407
...
...
@@ -796,7 +796,7 @@ public:
DEFAULT_CLASS_SIMPLE
(
dict_cls
,
true
);
B
ox
*
getOrNull
(
Box
*
k
)
{
B
ORROWED
(
Box
*
)
getOrNull
(
Box
*
k
)
{
const
auto
&
p
=
d
.
find
(
BoxAndHash
(
k
));
if
(
p
!=
d
.
end
())
return
p
->
second
;
...
...
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