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
1a5837a3
Commit
1a5837a3
authored
Aug 04, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #795 from Daetalus/future_builtins
Enable future builtins module and add test file
parents
52e385e0
f9b80106
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
5 deletions
+51
-5
Makefile
Makefile
+3
-2
from_cpython/CMakeLists.txt
from_cpython/CMakeLists.txt
+3
-0
from_cpython/setup.py
from_cpython/setup.py
+8
-1
src/capi/abstract.cpp
src/capi/abstract.cpp
+16
-2
test/tests/builtins_future.py
test/tests/builtins_future.py
+21
-0
No files found.
Makefile
View file @
1a5837a3
...
@@ -1194,7 +1194,7 @@ TEST_EXT_MODULE_NAMES := basic_test descr_test slots_test
...
@@ -1194,7 +1194,7 @@ TEST_EXT_MODULE_NAMES := basic_test descr_test slots_test
TEST_EXT_MODULE_SRCS
:=
$
(
TEST_EXT_MODULE_NAMES:%
=
test
/test_extension/%.c
)
TEST_EXT_MODULE_SRCS
:=
$
(
TEST_EXT_MODULE_NAMES:%
=
test
/test_extension/%.c
)
TEST_EXT_MODULE_OBJS
:=
$
(
TEST_EXT_MODULE_NAMES:%
=
test
/test_extension/%.pyston.so
)
TEST_EXT_MODULE_OBJS
:=
$
(
TEST_EXT_MODULE_NAMES:%
=
test
/test_extension/%.pyston.so
)
SHAREDMODS_NAMES
:=
_multiprocessing pyexpat
SHAREDMODS_NAMES
:=
_multiprocessing pyexpat
future_builtins
SHAREDMODS_SRCS
:=
\
SHAREDMODS_SRCS
:=
\
_multiprocessing/multiprocessing.c
\
_multiprocessing/multiprocessing.c
\
_multiprocessing/semaphore.c
\
_multiprocessing/semaphore.c
\
...
@@ -1205,7 +1205,8 @@ SHAREDMODS_SRCS := \
...
@@ -1205,7 +1205,8 @@ SHAREDMODS_SRCS := \
expat/xmltok_impl.c
\
expat/xmltok_impl.c
\
expat/xmltok_ns.c
\
expat/xmltok_ns.c
\
pyexpat.c
\
pyexpat.c
\
_elementtree.c
_elementtree.c
\
future_builtins.c
SHAREDMODS_SRCS
:=
$
(
SHAREDMODS_SRCS:%
=
from_cpython/Modules/%
)
SHAREDMODS_SRCS
:=
$
(
SHAREDMODS_SRCS:%
=
from_cpython/Modules/%
)
SHAREDMODS_OBJS
:=
$
(
SHAREDMODS_NAMES:%
=
lib_pyston/%.pyston.so
)
SHAREDMODS_OBJS
:=
$
(
SHAREDMODS_NAMES:%
=
lib_pyston/%.pyston.so
)
...
...
from_cpython/CMakeLists.txt
View file @
1a5837a3
...
@@ -40,6 +40,7 @@ file(GLOB_RECURSE STDMODULE_SRCS Modules
...
@@ -40,6 +40,7 @@ file(GLOB_RECURSE STDMODULE_SRCS Modules
errnomodule.c
errnomodule.c
fcntlmodule.c
fcntlmodule.c
fileio.c
fileio.c
future_builtins.c
getpath.c
getpath.c
iobase.c
iobase.c
itertoolsmodule.c
itertoolsmodule.c
...
@@ -114,6 +115,7 @@ add_library(FROM_CPYTHON OBJECT ${STDMODULE_SRCS} ${STDOBJECT_SRCS} ${STDPYTHON_
...
@@ -114,6 +115,7 @@ add_library(FROM_CPYTHON OBJECT ${STDMODULE_SRCS} ${STDOBJECT_SRCS} ${STDPYTHON_
add_dependencies
(
FROM_CPYTHON copy_stdlib
)
add_dependencies
(
FROM_CPYTHON copy_stdlib
)
add_custom_command
(
OUTPUT
add_custom_command
(
OUTPUT
${
CMAKE_BINARY_DIR
}
/lib_pyston/future_builtins.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/_multiprocessing.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/_multiprocessing.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/pyexpat.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/pyexpat.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/_elementtree.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/_elementtree.pyston.so
...
@@ -141,6 +143,7 @@ add_custom_command(OUTPUT
...
@@ -141,6 +143,7 @@ add_custom_command(OUTPUT
Modules/expat/xmltok_impl.c
Modules/expat/xmltok_impl.c
Modules/expat/xmltok_ns.c
Modules/expat/xmltok_ns.c
Modules/pyexpat.c
Modules/pyexpat.c
Modules/future_builtins.c
Modules/_elementtree.c
Modules/_elementtree.c
Modules/bz2module.c
Modules/bz2module.c
Modules/grpmodule.c
Modules/grpmodule.c
...
...
from_cpython/setup.py
View file @
1a5837a3
...
@@ -17,6 +17,12 @@ def unique(f):
...
@@ -17,6 +17,12 @@ def unique(f):
return
cache
[
0
]
return
cache
[
0
]
return
wrapper
return
wrapper
@
unique
def
future_builtins_ext
():
return
Extension
(
"future_builtins"
,
sources
=
map
(
relpath
,
[
"Modules/future_builtins.c"
,
]))
@
unique
@
unique
def
multiprocessing_ext
():
def
multiprocessing_ext
():
return
Extension
(
"_multiprocessing"
,
sources
=
map
(
relpath
,
[
return
Extension
(
"_multiprocessing"
,
sources
=
map
(
relpath
,
[
...
@@ -115,7 +121,8 @@ def elementtree_ext():
...
@@ -115,7 +121,8 @@ def elementtree_ext():
sources
=
[
relpath
(
'Modules/_elementtree.c'
)],
sources
=
[
relpath
(
'Modules/_elementtree.c'
)],
depends
=
pyexpat
.
depends
,
depends
=
pyexpat
.
depends
,
)
)
ext_modules
=
[
multiprocessing_ext
(),
ext_modules
=
[
future_builtins_ext
(),
multiprocessing_ext
(),
pyexpat_ext
(),
pyexpat_ext
(),
elementtree_ext
(),
elementtree_ext
(),
bz2_ext
(),
bz2_ext
(),
...
...
src/capi/abstract.cpp
View file @
1a5837a3
...
@@ -2144,8 +2144,22 @@ extern "C" PyObject* PyNumber_Index(PyObject* o) noexcept {
...
@@ -2144,8 +2144,22 @@ extern "C" PyObject* PyNumber_Index(PyObject* o) noexcept {
}
}
extern
"C"
PyObject
*
PyNumber_ToBase
(
PyObject
*
n
,
int
base
)
noexcept
{
extern
"C"
PyObject
*
PyNumber_ToBase
(
PyObject
*
n
,
int
base
)
noexcept
{
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
PyObject
*
res
=
NULL
;
return
nullptr
;
PyObject
*
index
=
PyNumber_Index
(
n
);
if
(
!
index
)
return
NULL
;
if
(
PyLong_Check
(
index
))
res
=
_PyLong_Format
(
index
,
base
,
0
,
1
);
else
if
(
PyInt_Check
(
index
))
res
=
_PyInt_Format
((
PyIntObject
*
)
index
,
base
,
1
);
else
/* It should not be possible to get here, as
PyNumber_Index already has a check for the same
condition */
PyErr_SetString
(
PyExc_ValueError
,
"PyNumber_ToBase: index not int or long"
);
Py_DECREF
(
index
);
return
res
;
}
}
extern
"C"
Py_ssize_t
PyNumber_AsSsize_t
(
PyObject
*
item
,
PyObject
*
err
)
noexcept
{
extern
"C"
Py_ssize_t
PyNumber_AsSsize_t
(
PyObject
*
item
,
PyObject
*
err
)
noexcept
{
...
...
test/tests/builtins_future.py
0 → 100644
View file @
1a5837a3
from
future_builtins
import
hex
,
oct
,
map
,
zip
,
filter
from
itertools
import
imap
,
izip
,
ifilter
value_list1
=
[
0
,
42
,
42L
,
-
42
,
-
42L
,
""
,
(),
{},
[]]
value_list2
=
[
0
,
100
,
100L
,
-
100
,
-
100L
]
for
value1
in
value_list1
:
try
:
print
(
hex
(
value1
))
except
Exception
as
e
:
print
(
type
(
e
),
e
.
message
)
for
value2
in
value_list2
:
try
:
print
(
oct
(
value2
))
except
Exception
as
e
:
print
(
type
(
e
),
e
.
message
)
print
(
map
==
imap
)
print
(
zip
==
izip
)
print
(
filter
==
ifilter
)
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