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
5bfd8c82
Commit
5bfd8c82
authored
Sep 08, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable non-cypclass no-op templated overloads of cypclass refcounting macros
parent
277f0c23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
32 deletions
+7
-32
Cython/Compiler/Builtin.py
Cython/Compiler/Builtin.py
+4
-16
Cython/Utility/CyObjects.cpp
Cython/Utility/CyObjects.cpp
+3
-16
No files found.
Cython/Compiler/Builtin.py
View file @
5bfd8c82
...
...
@@ -652,24 +652,12 @@ def init_builtin_structs():
name
,
"struct"
,
scope
,
1
,
None
,
cname
=
cname
)
def
inject_cypclass_refcount_macros
():
template_placeholder_type
=
PyrexTypes
.
TemplatePlaceholderType
(
"T"
)
incref_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
template_placeholder_type
,
None
)],
nogil
=
1
,
templates
=
[
template_placeholder_type
]
)
incref_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
PyrexTypes
.
cy_object_type
,
None
)],
nogil
=
1
)
reference_to_template_type
=
PyrexTypes
.
CReferenceType
(
template_placeholder_type
)
decref_type
=
PyrexTypes
.
CFuncType
(
PyrexTypes
.
c_void_type
,
[
PyrexTypes
.
CFuncTypeArg
(
"obj"
,
reference_to_template_type
,
None
)],
nogil
=
1
,
templates
=
[
template_placeholder_type
]
)
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
)
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
.
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
)
...
...
Cython/Utility/CyObjects.cpp
View file @
5bfd8c82
...
...
@@ -357,26 +357,13 @@
};
/*
* Let Cy_INCREF, Cy_DECREF and Cy_XDECREF accept any argument type
* but only do the work when the argument is actually a CyObject
*/
template
<
typename
T
,
typename
std
::
enable_if
<!
std
::
is_convertible
<
T
,
CyObject
*
>
::
value
,
int
>::
type
=
0
>
static
inline
void
Cy_DECREF
(
T
)
{}
template
<
typename
T
,
typename
std
::
enable_if
<!
std
::
is_convertible
<
T
,
CyObject
*
>
::
value
,
int
>::
type
=
0
>
static
inline
void
Cy_XDECREF
(
T
)
{}
template
<
typename
T
,
typename
std
::
enable_if
<!
std
::
is_convertible
<
T
,
CyObject
*
>
::
value
,
int
>::
type
=
0
>
static
inline
void
Cy_INCREF
(
T
)
{}
template
<
typename
T
,
typename
std
::
enable_if
<
std
::
is_convertible
<
T
,
CyObject
*
>
::
value
,
int
>::
type
=
0
>
template
<
typename
T
>
static
inline
void
Cy_DECREF
(
T
&
ob
)
{
if
(
ob
->
CyObject_DECREF
())
ob
=
NULL
;
}
template
<
typename
T
,
typename
std
::
enable_if
<
std
::
is_convertible
<
T
,
CyObject
*
>
::
value
,
int
>::
type
=
0
>
template
<
typename
T
>
static
inline
void
Cy_XDECREF
(
T
&
ob
)
{
if
(
ob
!=
NULL
)
{
if
(
ob
->
CyObject_DECREF
())
...
...
@@ -384,7 +371,7 @@
}
}
template
<
typename
T
,
typename
std
::
enable_if
<
std
::
is_convertible
<
T
,
CyObject
*
>
::
value
,
int
>::
type
=
0
>
template
<
typename
T
>
static
inline
void
Cy_INCREF
(
T
ob
)
{
if
(
ob
!=
NULL
)
ob
->
CyObject_INCREF
();
...
...
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