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
5ba655be
Commit
5ba655be
authored
Feb 17, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zlib'
parents
bff16616
aea9ef2d
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
540 additions
and
7 deletions
+540
-7
Makefile
Makefile
+1
-1
from_cpython/CMakeLists.txt
from_cpython/CMakeLists.txt
+1
-1
from_cpython/Include/pyconfig.h
from_cpython/Include/pyconfig.h
+1
-0
src/capi/modsupport.cpp
src/capi/modsupport.cpp
+10
-0
src/core/threading.cpp
src/core/threading.cpp
+0
-4
src/runtime/builtin_modules/thread.cpp
src/runtime/builtin_modules/thread.cpp
+32
-0
src/runtime/builtin_modules/thread_pthread.h
src/runtime/builtin_modules/thread_pthread.h
+479
-0
src/runtime/types.cpp
src/runtime/types.cpp
+2
-0
test/tests/zlib_test.py
test/tests/zlib_test.py
+7
-0
tools/lint.py
tools/lint.py
+7
-1
No files found.
Makefile
View file @
5ba655be
...
...
@@ -290,7 +290,7 @@ SRCS := $(MAIN_SRCS) $(STDLIB_SRCS)
STDLIB_OBJS
:=
stdlib.bc.o stdlib.stripped.bc.o
STDLIB_RELEASE_OBJS
:=
stdlib.release.bc.o
STDMODULE_SRCS
:=
errnomodule.c shamodule.c sha256module.c sha512module.c _math.c mathmodule.c md5.c md5module.c _randommodule.c _sre.c operator.c binascii.c pwdmodule.c posixmodule.c _struct.c datetimemodule.c _functoolsmodule.c _collectionsmodule.c itertoolsmodule.c resource.c signalmodule.c selectmodule.c fcntlmodule.c timemodule.c arraymodule.c
$(EXTRA_STDMODULE_SRCS)
STDMODULE_SRCS
:=
errnomodule.c shamodule.c sha256module.c sha512module.c _math.c mathmodule.c md5.c md5module.c _randommodule.c _sre.c operator.c binascii.c pwdmodule.c posixmodule.c _struct.c datetimemodule.c _functoolsmodule.c _collectionsmodule.c itertoolsmodule.c resource.c signalmodule.c selectmodule.c fcntlmodule.c timemodule.c arraymodule.c
zlibmodule.c
$(EXTRA_STDMODULE_SRCS)
STDOBJECT_SRCS
:=
structseq.c capsule.c stringobject.c
$(EXTRA_STDOBJECT_SRCS)
STDPYTHON_SRCS
:=
pyctype.c getargs.c formatter_string.c pystrtod.c dtoa.c
$(EXTRA_STDPYTHON_SRCS)
FROM_CPYTHON_SRCS
:=
$(
addprefix
from_cpython/Modules/,
$(STDMODULE_SRCS)
)
$(
addprefix
from_cpython/Objects/,
$(STDOBJECT_SRCS)
)
$(
addprefix
from_cpython/Python/,
$(STDPYTHON_SRCS)
)
...
...
from_cpython/CMakeLists.txt
View file @
5ba655be
...
...
@@ -15,7 +15,7 @@ endforeach(STDLIB_FILE)
add_custom_target
(
copy_stdlib ALL DEPENDS
${
STDLIB_TARGETS
}
)
# compile specified files in from_cpython/Modules
file
(
GLOB_RECURSE STDMODULE_SRCS Modules errnomodule.c shamodule.c sha256module.c sha512module.c _math.c mathmodule.c md5.c md5module.c _randommodule.c _sre.c operator.c binascii.c pwdmodule.c posixmodule.c _struct.c datetimemodule.c _functoolsmodule.c _collectionsmodule.c itertoolsmodule.c resource.c signalmodule.c selectmodule.c fcntlmodule.c timemodule.c arraymodule.c
)
file
(
GLOB_RECURSE STDMODULE_SRCS Modules errnomodule.c shamodule.c sha256module.c sha512module.c _math.c mathmodule.c md5.c md5module.c _randommodule.c _sre.c operator.c binascii.c pwdmodule.c posixmodule.c _struct.c datetimemodule.c _functoolsmodule.c _collectionsmodule.c itertoolsmodule.c resource.c signalmodule.c selectmodule.c fcntlmodule.c timemodule.c arraymodule.c
zlibmodule.c
)
# compile specified files in from_cpython/Objects
file
(
GLOB_RECURSE STDOBJECT_SRCS Objects structseq.c capsule.c stringobject.c
)
...
...
from_cpython/Include/pyconfig.h
View file @
5ba655be
...
...
@@ -27,6 +27,7 @@
#define SIZEOF_INT 4
#define SIZEOF_LONG 8
#define SIZEOF_LONG_LONG 8
#define SIZEOF_PTHREAD_T 8
#define HAVE_COPYSIGN 1
#define HAVE_ROUND 1
#define HAVE_HYPOT 1
...
...
src/capi/modsupport.cpp
View file @
5ba655be
...
...
@@ -283,6 +283,16 @@ extern "C" int PyModule_AddObject(PyObject* _m, const char* name, PyObject* valu
return
0
;
}
extern
"C"
int
PyModule_AddStringConstant
(
PyObject
*
m
,
const
char
*
name
,
const
char
*
value
)
noexcept
{
PyObject
*
o
=
PyString_FromString
(
value
);
if
(
!
o
)
return
-
1
;
if
(
PyModule_AddObject
(
m
,
name
,
o
)
==
0
)
return
0
;
Py_DECREF
(
o
);
return
-
1
;
}
extern
"C"
int
PyModule_AddIntConstant
(
PyObject
*
_m
,
const
char
*
name
,
long
value
)
noexcept
{
return
PyModule_AddObject
(
_m
,
name
,
boxInt
(
value
));
}
...
...
src/core/threading.cpp
View file @
5ba655be
...
...
@@ -613,10 +613,6 @@ void allowGLReadPreemption() {
}
#endif
extern
"C"
long
PyThread_get_thread_ident
(
void
)
noexcept
{
return
pthread_self
();
}
// We don't support CPython's TLS (yet?)
extern
"C"
void
PyThread_ReInitTLS
(
void
)
noexcept
{
// don't have to do anything since we don't support TLS
...
...
src/runtime/builtin_modules/thread.cpp
View file @
5ba655be
...
...
@@ -12,8 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <pthread.h>
#include <stddef.h>
#include "Python.h"
#include "pythread.h"
#include "core/threading.h"
#include "core/types.h"
#include "runtime/objmodel.h"
...
...
@@ -21,6 +25,34 @@
using
namespace
pyston
::
threading
;
static
int
initialized
;
static
void
PyThread__init_thread
(
void
);
/* Forward */
extern
"C"
void
PyThread_init_thread
(
void
)
noexcept
{
#ifdef Py_DEBUG
char
*
p
=
Py_GETENV
(
"PYTHONTHREADDEBUG"
);
if
(
p
)
{
if
(
*
p
)
thread_debug
=
atoi
(
p
);
else
thread_debug
=
1
;
}
#endif
/* Py_DEBUG */
if
(
initialized
)
return
;
initialized
=
1
;
PyThread__init_thread
();
}
/* Support for runtime thread stack size tuning.
A value of 0 means using the platform's default stack size
or the size specified by the THREAD_STACK_SIZE macro. */
static
size_t
_pythread_stacksize
=
0
;
#include "thread_pthread.h"
namespace
pyston
{
BoxedModule
*
thread_module
;
...
...
src/runtime/builtin_modules/thread_pthread.h
0 → 100644
View file @
5ba655be
This diff is collapsed.
Click to expand it.
src/runtime/types.cpp
View file @
5ba655be
...
...
@@ -61,6 +61,7 @@ extern "C" void initselect();
extern
"C"
void
initfcntl
();
extern
"C"
void
inittime
();
extern
"C"
void
initarray
();
extern
"C"
void
initzlib
();
namespace
pyston
{
...
...
@@ -1321,6 +1322,7 @@ void setupRuntime() {
initfcntl
();
inittime
();
initarray
();
initzlib
();
setupSysEnd
();
...
...
test/tests/zlib_test.py
0 → 100644
View file @
5ba655be
import
zlib
s
=
"hello world!"
s2
=
zlib
.
compress
(
s
)
print
repr
(
s2
)
s3
=
zlib
.
decompress
(
s2
)
print
repr
(
s3
)
tools/lint.py
View file @
5ba655be
...
...
@@ -2,7 +2,13 @@ import os
import
sys
def
file_is_from_cpython
(
fn
):
return
'from_cpython'
in
fn
if
'from_cpython'
in
fn
:
return
True
if
fn
.
endswith
(
"/thread_pthread.h"
):
return
True
return
False
def
verify_include_guard
(
_
,
dir
,
files
):
for
bn
in
files
:
...
...
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