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
a3d1cbb3
Commit
a3d1cbb3
authored
Jan 12, 2016
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't abort when generating a call of a known type which is not callable.
fixes #1046
parent
5fd4fe6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
8 deletions
+40
-8
src/codegen/compvars.h
src/codegen/compvars.h
+19
-8
test/tests/type_errors.py
test/tests/type_errors.py
+21
-0
No files found.
src/codegen/compvars.h
View file @
a3d1cbb3
...
...
@@ -141,10 +141,7 @@ public:
}
virtual
CompilerVariable
*
call
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
BoxedString
*>*
keyword_names
)
{
printf
(
"call not defined for %s
\n
"
,
debugName
().
c_str
());
abort
();
}
const
std
::
vector
<
BoxedString
*>*
keyword_names
);
virtual
CompilerVariable
*
len
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
)
{
printf
(
"len not defined for %s
\n
"
,
debugName
().
c_str
());
abort
();
...
...
@@ -172,10 +169,7 @@ public:
abort
();
}
CompilerType
*
callType
(
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerType
*>&
arg_types
,
const
std
::
vector
<
llvm
::
StringRef
>*
keyword_names
)
override
{
printf
(
"callType not defined for %s
\n
"
,
debugName
().
c_str
());
abort
();
}
const
std
::
vector
<
llvm
::
StringRef
>*
keyword_names
)
override
;
BoxedClass
*
guaranteedClass
()
override
{
ASSERT
((
CompilerType
*
)
getConcreteType
()
!=
this
,
"%s"
,
debugName
().
c_str
());
return
getConcreteType
()
->
guaranteedClass
();
...
...
@@ -490,6 +484,23 @@ std::vector<CompilerVariable*> _ValuedCompilerType<V>::unpack(IREmitter& emitter
return
r
;
}
template
<
typename
V
>
CompilerType
*
_ValuedCompilerType
<
V
>::
callType
(
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerType
*>&
arg_types
,
const
std
::
vector
<
llvm
::
StringRef
>*
keyword_names
)
{
return
UNKNOWN
;
}
template
<
typename
V
>
CompilerVariable
*
_ValuedCompilerType
<
V
>::
call
(
IREmitter
&
emitter
,
const
OpInfo
&
info
,
VAR
*
var
,
struct
ArgPassSpec
argspec
,
const
std
::
vector
<
CompilerVariable
*>&
args
,
const
std
::
vector
<
BoxedString
*>*
keyword_names
)
{
assert
((
CompilerType
*
)
this
!=
UNKNOWN
);
ConcreteCompilerVariable
*
converted
=
makeConverted
(
emitter
,
var
,
UNKNOWN
);
auto
r
=
UNKNOWN
->
call
(
emitter
,
info
,
converted
,
argspec
,
args
,
keyword_names
);
converted
->
decvref
(
emitter
);
return
r
;
}
}
// namespace pyston
#endif
test/tests/type_errors.py
View file @
a3d1cbb3
...
...
@@ -42,3 +42,24 @@ def f2():
for
i
in
xrange
(
100
):
f2
()
# make sure we don't abort when calling a type which is not callable
def
f
(
call
):
i
=
1
f
=
1.0
l
=
1
l
s
=
"str"
t
=
(
1
,)
if
call
:
i
()
f
()
l
()
s
()
t
()
try
:
for
i
in
range
(
10000
):
f
(
i
==
9999
)
except
TypeError
,
e
:
print
e
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