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
Kirill Smelkov
cython
Commits
f0eaa48e
Commit
f0eaa48e
authored
Sep 28, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
automatically register with "backports_abc" module if available
parent
93db5844
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
13 deletions
+37
-13
CHANGES.rst
CHANGES.rst
+7
-0
Cython/Utility/Coroutine.c
Cython/Utility/Coroutine.c
+30
-13
No files found.
CHANGES.rst
View file @
f0eaa48e
...
...
@@ -17,6 +17,13 @@ Bugs fixed
* Large folded or inserted integer constants could use too small C
integer types and thus trigger a value wrap-around.
Other changes
-------------
* The coroutine and generator types of Cython now also register directly
with the ``Coroutine`` and ``Generator`` ABCs in the ``backports_abc``
module if it can be imported.
0.23.2 (2015-09-11)
===================
...
...
Cython/Utility/Coroutine.c
View file @
f0eaa48e
...
...
@@ -1479,13 +1479,32 @@ ignore:
//////////////////// PatchGeneratorABC.proto ////////////////////
//
patch 'collections.abc' if it lacks generator support
//
register with Generator/Coroutine ABCs in 'collections.abc'
// see https://bugs.python.org/issue24018
static
int
__Pyx_patch_abc
(
void
);
/*proto*/
//////////////////// PatchGeneratorABC ////////////////////
//@requires: PatchModuleWithCoroutine
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static
PyObject
*
__Pyx_patch_abc_module
(
PyObject
*
module
);
/*proto*/
static
PyObject
*
__Pyx_patch_abc_module
(
PyObject
*
module
)
{
module
=
__Pyx_Coroutine_patch_module
(
module
,
CSTRING
(
"""\
if _cython_generator_type is not None:
try: Generator = _module.Generator
except AttributeError: pass
else: Generator.register(_cython_generator_type)
if _cython_coroutine_type is not None:
try: Coroutine = _module.Coroutine
except AttributeError: pass
else: Coroutine.register(_cython_coroutine_type)
"""
)
);
return
module
;
}
#endif
static
int
__Pyx_patch_abc
(
void
)
{
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static
int
abc_patched
=
0
;
...
...
@@ -1501,23 +1520,21 @@ static int __Pyx_patch_abc(void) {
return
-
1
;
}
}
else
{
module
=
__Pyx_Coroutine_patch_module
(
module
,
CSTRING
(
"""\
if _cython_generator_type is not None:
try: Generator = _module.Generator
except AttributeError: pass
else: Generator.register(_cython_generator_type)
if _cython_coroutine_type is not None:
try: Coroutine = _module.Coroutine
except AttributeError: pass
else: Coroutine.register(_cython_coroutine_type)
"""
)
);
module
=
__Pyx_patch_abc_module
(
module
);
abc_patched
=
1
;
if
(
unlikely
(
!
module
))
return
-
1
;
Py_DECREF
(
module
);
}
// also register with "backports_abc" module if available, just in case
module
=
PyImport_ImportModule
(
"backports_abc"
);
if
(
module
)
{
module
=
__Pyx_patch_abc_module
(
module
);
Py_XDECREF
(
module
);
}
if
(
!
module
)
{
PyErr_Clear
();
}
}
#else
// avoid "unused" warning for __Pyx_Coroutine_patch_module()
...
...
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