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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
48aeaa3a
Commit
48aeaa3a
authored
Sep 30, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make cypclass builtin macros accept const arguments
parent
ac886ee9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
13 deletions
+37
-13
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+30
-6
Cython/Utility/CyObjects.cpp
Cython/Utility/CyObjects.cpp
+7
-7
No files found.
Cython/Compiler/Builtin.py
View file @
48aeaa3a
...
...
@@ -652,21 +652,45 @@ def init_builtin_structs():
name
,
"struct"
,
scope
,
1
,
None
,
cname
=
cname
)
def
inject_cypclass_refcount_macros
():
incref_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
cy_object_type
,
None
)],
nogil
=
1
)
incref_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
const_cy_object_type
,
None
)
],
nogil
=
1
)
reference_to_cy_object_type
=
PyrexTypes
.
CReferenceType
(
PyrexTypes
.
cy_object_type
)
decref_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
reference_to_cy_object_type
,
None
)],
nogil
=
1
)
decref_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
CReferenceType
(
PyrexTypes
.
const_cy_object_type
),
None
)
],
nogil
=
1
)
getref_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_int_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
cy_object_type
,
None
)],
nogil
=
1
)
getref_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_int_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
const_cy_object_type
,
None
)
],
nogil
=
1
)
for
macro
,
macro_type
in
[(
"Cy_INCREF"
,
incref_type
),
(
"Cy_DECREF"
,
decref_type
),
(
"Cy_XDECREF"
,
decref_type
),
(
"Cy_GETREF"
,
getref_type
)]:
builtin_scope
.
declare_builtin_cfunction
(
macro
,
macro_type
,
macro
)
def
inject_cypclass_lock_macros
():
blocking_macro_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
cy_object_type
,
None
)],
nogil
=
1
)
blocking_macro_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
const_cy_object_type
,
None
)
],
nogil
=
1
)
for
macro
in
(
"Cy_RLOCK"
,
"Cy_WLOCK"
,
"Cy_UNWLOCK"
,
"Cy_UNRLOCK"
):
builtin_scope
.
declare_builtin_cfunction
(
macro
,
blocking_macro_type
,
macro
)
nonblocking_macro_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_int_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
cy_object_type
,
None
)],
nogil
=
1
)
nonblocking_macro_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_int_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
const_cy_object_type
,
None
)
],
nogil
=
1
)
for
macro
in
(
"Cy_TRYRLOCK"
,
"Cy_TRYWLOCK"
):
builtin_scope
.
declare_builtin_cfunction
(
macro
,
nonblocking_macro_type
,
macro
)
...
...
Cython/Utility/CyObjects.cpp
View file @
48aeaa3a
...
...
@@ -399,11 +399,11 @@
ob
->
CyObject_INCREF
();
}
static
inline
int
_Cy_GETREF
(
CyObject
*
ob
)
{
static
inline
int
_Cy_GETREF
(
const
CyObject
*
ob
)
{
return
ob
->
CyObject_GETREF
();
}
static
inline
void
_Cy_RLOCK
(
CyObject
*
ob
,
const
char
*
context
)
{
static
inline
void
_Cy_RLOCK
(
const
CyObject
*
ob
,
const
char
*
context
)
{
if
(
ob
!=
NULL
)
{
ob
->
CyObject_RLOCK
(
context
);
}
...
...
@@ -412,7 +412,7 @@
}
}
static
inline
void
_Cy_WLOCK
(
CyObject
*
ob
,
const
char
*
context
)
{
static
inline
void
_Cy_WLOCK
(
const
CyObject
*
ob
,
const
char
*
context
)
{
if
(
ob
!=
NULL
)
{
ob
->
CyObject_WLOCK
(
context
);
}
...
...
@@ -421,7 +421,7 @@
}
}
static
inline
void
_Cy_UNRLOCK
(
CyObject
*
ob
)
{
static
inline
void
_Cy_UNRLOCK
(
const
CyObject
*
ob
)
{
if
(
ob
!=
NULL
)
{
ob
->
CyObject_UNRLOCK
();
}
...
...
@@ -430,7 +430,7 @@
}
}
static
inline
void
_Cy_UNWLOCK
(
CyObject
*
ob
)
{
static
inline
void
_Cy_UNWLOCK
(
const
CyObject
*
ob
)
{
if
(
ob
!=
NULL
)
{
ob
->
CyObject_UNWLOCK
();
}
...
...
@@ -439,11 +439,11 @@
}
}
static
inline
int
_Cy_TRYRLOCK
(
CyObject
*
ob
)
{
static
inline
int
_Cy_TRYRLOCK
(
const
CyObject
*
ob
)
{
return
ob
->
CyObject_TRYRLOCK
();
}
static
inline
int
_Cy_TRYWLOCK
(
CyObject
*
ob
)
{
static
inline
int
_Cy_TRYWLOCK
(
const
CyObject
*
ob
)
{
return
ob
->
CyObject_TRYWLOCK
();
}
...
...
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