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
063f08fe
Commit
063f08fe
authored
May 11, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
capifunc_cls.__name__, PyNumber_Invert
parent
358610b9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
9 deletions
+22
-9
src/capi/abstract.cpp
src/capi/abstract.cpp
+6
-2
src/capi/types.h
src/capi/types.h
+8
-0
src/runtime/capi.cpp
src/runtime/capi.cpp
+2
-0
test/tests/math_test.py
test/tests/math_test.py
+2
-0
test/tests/operator__name__.py
test/tests/operator__name__.py
+0
-7
test/tests/operator_test.py
test/tests/operator_test.py
+4
-0
No files found.
src/capi/abstract.cpp
View file @
063f08fe
...
...
@@ -1621,8 +1621,12 @@ extern "C" PyObject* PyNumber_Absolute(PyObject* o) noexcept {
}
extern
"C"
PyObject
*
PyNumber_Invert
(
PyObject
*
o
)
noexcept
{
fatalOrError
(
PyExc_NotImplementedError
,
"unimplemented"
);
return
nullptr
;
try
{
return
unaryop
(
o
,
AST_TYPE
::
Invert
);
}
catch
(
ExcInfo
e
)
{
setCAPIException
(
e
);
return
nullptr
;
}
}
extern
"C"
PyObject
*
PyNumber_Lshift
(
PyObject
*
lhs
,
PyObject
*
rhs
)
noexcept
{
...
...
src/capi/types.h
View file @
063f08fe
...
...
@@ -89,6 +89,14 @@ public:
return
rtn
;
}
static
Box
*
getname
(
Box
*
b
,
void
*
)
{
RELEASE_ASSERT
(
b
->
cls
==
capifunc_cls
,
""
);
const
char
*
s
=
static_cast
<
BoxedCApiFunction
*>
(
b
)
->
name
;
if
(
s
)
return
boxStrConstant
(
s
);
return
None
;
}
static
Box
*
callInternal
(
BoxedFunctionBase
*
func
,
CallRewriteArgs
*
rewrite_args
,
ArgPassSpec
argspec
,
Box
*
arg1
,
Box
*
arg2
,
Box
*
arg3
,
Box
**
args
,
const
std
::
vector
<
const
std
::
string
*>*
keyword_names
);
};
...
...
src/runtime/capi.cpp
View file @
063f08fe
...
...
@@ -1392,6 +1392,8 @@ void setupCAPI() {
auto
capi_call
=
new
BoxedFunction
(
boxRTFunction
((
void
*
)
BoxedCApiFunction
::
__call__
,
UNKNOWN
,
1
,
0
,
true
,
true
));
capi_call
->
f
->
internal_callable
=
BoxedCApiFunction
::
callInternal
;
capifunc_cls
->
giveAttr
(
"__call__"
,
capi_call
);
capifunc_cls
->
giveAttr
(
"__name__"
,
new
(
pyston_getset_cls
)
BoxedGetsetDescriptor
(
BoxedCApiFunction
::
getname
,
NULL
,
NULL
));
capifunc_cls
->
freeze
();
...
...
test/tests/math_test.py
View file @
063f08fe
...
...
@@ -18,3 +18,5 @@ print min(range(5))
for
x
in
[
float
(
"inf"
),
math
.
pi
]:
print
x
,
math
.
isinf
(
x
),
math
.
fabs
(
x
),
math
.
ceil
(
x
),
math
.
log
(
x
),
math
.
log10
(
x
)
print
math
.
sqrt
.
__name__
test/tests/operator__name__.py
deleted
100644 → 0
View file @
358610b9
# expected: fail
import
operator
for
op
in
sorted
(
dir
(
operator
)):
if
op
.
startswith
(
"_"
):
continue
print
getattr
(
operator
,
op
).
__name__
test/tests/operator_test.py
View file @
063f08fe
...
...
@@ -16,3 +16,7 @@ f = operator.attrgetter("count")
print
f
([
"a"
,
"a"
])(
"a"
)
print
f
(
"ababa"
)(
"a"
)
for
op
in
sorted
(
dir
(
operator
)):
if
op
.
startswith
(
"_"
):
continue
print
getattr
(
operator
,
op
).
__name__
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