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
aea9ef2d
Commit
aea9ef2d
authored
Feb 17, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable the zlib module
parent
1a20fdce
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
2 deletions
+21
-2
Makefile
Makefile
+1
-1
from_cpython/CMakeLists.txt
from_cpython/CMakeLists.txt
+1
-1
src/capi/modsupport.cpp
src/capi/modsupport.cpp
+10
-0
src/runtime/types.cpp
src/runtime/types.cpp
+2
-0
test/tests/zlib_test.py
test/tests/zlib_test.py
+7
-0
No files found.
Makefile
View file @
aea9ef2d
...
@@ -290,7 +290,7 @@ SRCS := $(MAIN_SRCS) $(STDLIB_SRCS)
...
@@ -290,7 +290,7 @@ SRCS := $(MAIN_SRCS) $(STDLIB_SRCS)
STDLIB_OBJS
:=
stdlib.bc.o stdlib.stripped.bc.o
STDLIB_OBJS
:=
stdlib.bc.o stdlib.stripped.bc.o
STDLIB_RELEASE_OBJS
:=
stdlib.release.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)
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)
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_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 @
aea9ef2d
...
@@ -15,7 +15,7 @@ endforeach(STDLIB_FILE)
...
@@ -15,7 +15,7 @@ endforeach(STDLIB_FILE)
add_custom_target
(
copy_stdlib ALL DEPENDS
${
STDLIB_TARGETS
}
)
add_custom_target
(
copy_stdlib ALL DEPENDS
${
STDLIB_TARGETS
}
)
# compile specified files in from_cpython/Modules
# 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
# compile specified files in from_cpython/Objects
file
(
GLOB_RECURSE STDOBJECT_SRCS Objects structseq.c capsule.c stringobject.c
)
file
(
GLOB_RECURSE STDOBJECT_SRCS Objects structseq.c capsule.c stringobject.c
)
...
...
src/capi/modsupport.cpp
View file @
aea9ef2d
...
@@ -283,6 +283,16 @@ extern "C" int PyModule_AddObject(PyObject* _m, const char* name, PyObject* valu
...
@@ -283,6 +283,16 @@ extern "C" int PyModule_AddObject(PyObject* _m, const char* name, PyObject* valu
return
0
;
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
{
extern
"C"
int
PyModule_AddIntConstant
(
PyObject
*
_m
,
const
char
*
name
,
long
value
)
noexcept
{
return
PyModule_AddObject
(
_m
,
name
,
boxInt
(
value
));
return
PyModule_AddObject
(
_m
,
name
,
boxInt
(
value
));
}
}
...
...
src/runtime/types.cpp
View file @
aea9ef2d
...
@@ -61,6 +61,7 @@ extern "C" void initselect();
...
@@ -61,6 +61,7 @@ extern "C" void initselect();
extern
"C"
void
initfcntl
();
extern
"C"
void
initfcntl
();
extern
"C"
void
inittime
();
extern
"C"
void
inittime
();
extern
"C"
void
initarray
();
extern
"C"
void
initarray
();
extern
"C"
void
initzlib
();
namespace
pyston
{
namespace
pyston
{
...
@@ -1321,6 +1322,7 @@ void setupRuntime() {
...
@@ -1321,6 +1322,7 @@ void setupRuntime() {
initfcntl
();
initfcntl
();
inittime
();
inittime
();
initarray
();
initarray
();
initzlib
();
setupSysEnd
();
setupSysEnd
();
...
...
test/tests/zlib_test.py
0 → 100644
View file @
aea9ef2d
import
zlib
s
=
"hello world!"
s2
=
zlib
.
compress
(
s
)
print
repr
(
s2
)
s3
=
zlib
.
decompress
(
s2
)
print
repr
(
s3
)
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