Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
a19500d3
Commit
a19500d3
authored
Apr 25, 2007
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments, builtin objects
parent
33b0863c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+3
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+25
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
a19500d3
...
...
@@ -345,6 +345,8 @@ class CIntType(CNumericType):
class
CBIntType
(
CIntType
):
# TODO: this should be a macro "(__ ? Py_True : Py_False)"
# and no error checking should be needed (just an incref).
to_py_function
=
"PyBool_FromLong"
from_py_function
=
"PyObject_IsTrue"
...
...
Cython/Compiler/Symtab.py
View file @
a19500d3
...
...
@@ -455,6 +455,9 @@ class BuiltinScope(Scope):
cname
,
type
,
arg_types
,
exception_value
,
exception_check
=
definition
function
=
CFuncType
(
type
,
[
CFuncTypeArg
(
""
,
t
,
None
)
for
t
in
arg_types
],
False
,
exception_value
,
exception_check
)
self
.
add_cfunction
(
name
,
function
,
None
,
cname
,
False
)
for
name
,
definition
in
self
.
builtin_entries
.
iteritems
():
cname
,
type
=
definition
self
.
declare_var
(
name
,
type
,
None
,
cname
)
self
.
cached_entries
=
[]
self
.
undeclared_cached_entries
=
[]
...
...
@@ -474,6 +477,7 @@ class BuiltinScope(Scope):
return
self
# TODO: built in functions conflict with built in types of same name...
# TODO: perhapse these should all be declared in some universal .pxi file?
builtin_functions
=
{
"hasattr"
:
[
"PyObject_HasAttrString"
,
c_bint_type
,
(
py_object_type
,
c_char_ptr_type
)],
...
...
@@ -500,6 +504,27 @@ class BuiltinScope(Scope):
}
builtin_entries
=
{
"int"
:
[
"PyInt_Type"
,
py_object_type
],
"long"
:
[
"PyLong_Type"
,
py_object_type
],
"float"
:
[
"PyFloat_Type"
,
py_object_type
],
"str"
:
[
"PyString_Type"
,
py_object_type
],
"tuple"
:
[
"PyTuple_Type"
,
py_object_type
],
"list"
:
[
"PyList_Type"
,
py_object_type
],
"dict"
:
[
"PyDict_Type"
,
py_object_type
],
"set"
:
[
"PySet_Type"
,
py_object_type
],
"frozenset"
:
[
"PyFrozenSet_Type"
,
py_object_type
],
"type"
:
[
"PyType_Type"
,
py_object_type
],
"slice"
:
[
"PySlice_Type"
,
py_object_type
],
"file"
:
[
"PyFile_Type"
,
py_object_type
],
"None"
:
[
"Py_None"
,
py_object_type
],
"False"
:
[
"Py_False"
,
py_object_type
],
"True"
:
[
"Py_True"
,
py_object_type
],
}
class
ModuleScope
(
Scope
):
# module_name string Python name of the module
# module_cname string C name of Python module object
...
...
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