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
7212a261
Commit
7212a261
authored
Mar 18, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some notes about threading.locals
Marius beat me to the punch with the fix this time :)
parent
4b51f74e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
from_cpython/Include/pystate.h
from_cpython/Include/pystate.h
+2
-0
test/tests/threading_local.py
test/tests/threading_local.py
+11
-5
No files found.
from_cpython/Include/pystate.h
View file @
7212a261
...
@@ -118,6 +118,8 @@ typedef struct _ts {
...
@@ -118,6 +118,8 @@ typedef struct _ts {
PyObject
*
curexc_traceback
;
PyObject
*
curexc_traceback
;
PyObject
*
dict
;
/* Stores per-thread state */
PyObject
*
dict
;
/* Stores per-thread state */
// Pyston note: additions in here need to be mirrored in ThreadStateInternal::accept
}
PyThreadState
;
}
PyThreadState
;
...
...
test/tests/threading_local.py
View file @
7212a261
import
gc
import
threading
import
threading
a
=
threading
.
local
()
a
=
threading
.
local
()
...
@@ -7,9 +8,14 @@ def f():
...
@@ -7,9 +8,14 @@ def f():
a
.
x
=
"goodbye world"
a
.
x
=
"goodbye world"
print
a
.
x
print
a
.
x
thread
=
threading
.
Thread
(
target
=
f
)
def
test
():
thread
.
start
()
thread
=
threading
.
Thread
(
target
=
f
)
thread
.
join
()
thread
.
start
()
thread
.
join
()
print
a
.
x
print
a
.
x
print
getattr
(
a
,
"doesnt_exist"
,
5
)
print
getattr
(
a
,
"doesnt_exist"
,
5
)
for
i
in
xrange
(
10
):
test
()
gc
.
collect
()
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