Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
gevent
Commits
59f1e9c2
Commit
59f1e9c2
authored
May 13, 2020
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename C accelerator modules to avoid clashes.
Fixes #1480.
parent
66d56aba
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
87 additions
and
67 deletions
+87
-67
docs/changes/1480.bugfix
docs/changes/1480.bugfix
+2
-0
setup.py
setup.py
+37
-29
src/gevent/_gevent_c_abstract_linkable.pxd
src/gevent/_gevent_c_abstract_linkable.pxd
+2
-2
src/gevent/_gevent_c_greenlet_primitives.pxd
src/gevent/_gevent_c_greenlet_primitives.pxd
+0
-0
src/gevent/_gevent_c_hub_local.pxd
src/gevent/_gevent_c_hub_local.pxd
+1
-1
src/gevent/_gevent_c_hub_primitives.pxd
src/gevent/_gevent_c_hub_primitives.pxd
+4
-4
src/gevent/_gevent_c_ident.pxd
src/gevent/_gevent_c_ident.pxd
+0
-0
src/gevent/_gevent_c_imap.pxd
src/gevent/_gevent_c_imap.pxd
+3
-3
src/gevent/_gevent_c_semaphore.pxd
src/gevent/_gevent_c_semaphore.pxd
+1
-1
src/gevent/_gevent_c_tracer.pxd
src/gevent/_gevent_c_tracer.pxd
+0
-0
src/gevent/_gevent_c_waiter.pxd
src/gevent/_gevent_c_waiter.pxd
+2
-2
src/gevent/_gevent_cevent.pxd
src/gevent/_gevent_cevent.pxd
+2
-2
src/gevent/_gevent_cgreenlet.pxd
src/gevent/_gevent_cgreenlet.pxd
+4
-4
src/gevent/_gevent_clocal.pxd
src/gevent/_gevent_clocal.pxd
+1
-1
src/gevent/_gevent_cqueue.pxd
src/gevent/_gevent_cqueue.pxd
+3
-3
src/gevent/_util.py
src/gevent/_util.py
+11
-1
src/gevent/libev/corecext.pyx
src/gevent/libev/corecext.pyx
+9
-9
src/gevent/tests/test___ident.py
src/gevent/tests/test___ident.py
+1
-1
src/gevent/tests/test__greenlet.py
src/gevent/tests/test__greenlet.py
+2
-2
src/gevent/tests/test__local.py
src/gevent/tests/test__local.py
+1
-1
src/gevent/tests/test__semaphore.py
src/gevent/tests/test__semaphore.py
+1
-1
No files found.
docs/changes/1480.bugfix
0 → 100644
View file @
59f1e9c2
Rename gevent's C accelerator extension modules using a prefix to
avoid clashing with other C extensions.
setup.py
View file @
59f1e9c2
...
...
@@ -48,81 +48,89 @@ from _setupares import ARES
CORE
=
cythonize1
(
build_libev_extension
())
# Get access to the greenlet header file.
SEMAPHORE
=
Extension
(
name
=
"gevent.__semaphore"
,
# Modules that we cythonize for performance.
# Be careful not to use simple names for these modules,
# as the non-static symbols cython generates do not include
# the module name. Thus an extension of 'gevent._queue'
# results in symbols like 'PyInit__queue', which is the same
# symbol used by the standard library _queue accelerator module.
# The name of the .pxd file must match the local name of the accelerator
# extension; however, sadly, the generated .c and .html files will
# still use the same name as the .py source.
SEMAPHORE
=
Extension
(
name
=
"gevent._gevent_c_semaphore"
,
sources
=
[
"src/gevent/_semaphore.py"
],
depends
=
[
'src/gevent/__semaphore.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
_semaphore.pxd'
],
include_dirs
=
get_include_dirs
())
LOCAL
=
Extension
(
name
=
"gevent._local"
,
LOCAL
=
Extension
(
name
=
"gevent._
gevent_c
local"
,
sources
=
[
"src/gevent/local.py"
],
depends
=
[
'src/gevent/_local.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
local.pxd'
],
include_dirs
=
get_include_dirs
())
GREENLET
=
Extension
(
name
=
"gevent._greenlet"
,
GREENLET
=
Extension
(
name
=
"gevent._g
event_cg
reenlet"
,
sources
=
[
"src/gevent/greenlet.py"
,
],
depends
=
[
'src/gevent/_greenlet.pxd'
,
'src/gevent/__ident.pxd'
,
'src/gevent/_g
event_cg
reenlet.pxd'
,
'src/gevent/_
gevent_c
_ident.pxd'
,
'src/gevent/_ident.py'
],
include_dirs
=
get_include_dirs
())
ABSTRACT_LINKABLE
=
Extension
(
name
=
"gevent.__abstract_linkable"
,
ABSTRACT_LINKABLE
=
Extension
(
name
=
"gevent._
gevent_c
_abstract_linkable"
,
sources
=
[
"src/gevent/_abstract_linkable.py"
],
depends
=
[
'src/gevent/__abstract_linkable.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
_abstract_linkable.pxd'
],
include_dirs
=
get_include_dirs
())
IDENT
=
Extension
(
name
=
"gevent.__ident"
,
IDENT
=
Extension
(
name
=
"gevent._
gevent_c
_ident"
,
sources
=
[
"src/gevent/_ident.py"
],
depends
=
[
'src/gevent/__ident.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
_ident.pxd'
],
include_dirs
=
get_include_dirs
())
IMAP
=
Extension
(
name
=
"gevent.__imap"
,
IMAP
=
Extension
(
name
=
"gevent._
gevent_c
_imap"
,
sources
=
[
"src/gevent/_imap.py"
],
depends
=
[
'src/gevent/__imap.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
_imap.pxd'
],
include_dirs
=
get_include_dirs
())
EVENT
=
Extension
(
name
=
"gevent._event"
,
EVENT
=
Extension
(
name
=
"gevent._
gevent_c
event"
,
sources
=
[
"src/gevent/event.py"
],
depends
=
[
'src/gevent/_event.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
event.pxd'
],
include_dirs
=
get_include_dirs
())
QUEUE
=
Extension
(
name
=
"gevent._queue"
,
QUEUE
=
Extension
(
name
=
"gevent._
gevent_c
queue"
,
sources
=
[
"src/gevent/queue.py"
],
depends
=
[
'src/gevent/_queue.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
queue.pxd'
],
include_dirs
=
get_include_dirs
())
HUB_LOCAL
=
Extension
(
name
=
"gevent.__hub_local"
,
HUB_LOCAL
=
Extension
(
name
=
"gevent._
gevent_c
_hub_local"
,
sources
=
[
"src/gevent/_hub_local.py"
],
depends
=
[
'src/gevent/__hub_local.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
_hub_local.pxd'
],
include_dirs
=
get_include_dirs
())
WAITER
=
Extension
(
name
=
"gevent.__waiter"
,
WAITER
=
Extension
(
name
=
"gevent._
gevent_c
_waiter"
,
sources
=
[
"src/gevent/_waiter.py"
],
depends
=
[
'src/gevent/__waiter.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
_waiter.pxd'
],
include_dirs
=
get_include_dirs
())
HUB_PRIMITIVES
=
Extension
(
name
=
"gevent.__hub_primitives"
,
HUB_PRIMITIVES
=
Extension
(
name
=
"gevent._
gevent_c
_hub_primitives"
,
sources
=
[
"src/gevent/_hub_primitives.py"
],
depends
=
[
'src/gevent/__hub_primitives.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
_hub_primitives.pxd'
],
include_dirs
=
get_include_dirs
())
GLT_PRIMITIVES
=
Extension
(
name
=
"gevent.__greenlet_primitives"
,
GLT_PRIMITIVES
=
Extension
(
name
=
"gevent._
gevent_c
_greenlet_primitives"
,
sources
=
[
"src/gevent/_greenlet_primitives.py"
],
depends
=
[
'src/gevent/__greenlet_primitives.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
_greenlet_primitives.pxd'
],
include_dirs
=
get_include_dirs
())
TRACER
=
Extension
(
name
=
"gevent.__tracer"
,
TRACER
=
Extension
(
name
=
"gevent._
gevent_c
_tracer"
,
sources
=
[
"src/gevent/_tracer.py"
],
depends
=
[
'src/gevent/__tracer.pxd'
],
depends
=
[
'src/gevent/_
gevent_c
_tracer.pxd'
],
include_dirs
=
get_include_dirs
())
...
...
src/gevent/__abstract_linkable.pxd
→
src/gevent/_
gevent_c
_abstract_linkable.pxd
View file @
59f1e9c2
cimport
cython
from
gevent.__greenlet_primitives
cimport
SwitchOutGreenletWithLoop
from
gevent.__hub_local
cimport
get_hub_noargs
as
get_hub
from
gevent._
gevent_c
_greenlet_primitives
cimport
SwitchOutGreenletWithLoop
from
gevent._
gevent_c
_hub_local
cimport
get_hub_noargs
as
get_hub
cdef
InvalidSwitchError
cdef
Timeout
...
...
src/gevent/__greenlet_primitives.pxd
→
src/gevent/_
gevent_c
_greenlet_primitives.pxd
View file @
59f1e9c2
File moved
src/gevent/__hub_local.pxd
→
src/gevent/_
gevent_c
_hub_local.pxd
View file @
59f1e9c2
from
gevent.__greenlet_primitives
cimport
SwitchOutGreenletWithLoop
from
gevent._
gevent_c
_greenlet_primitives
cimport
SwitchOutGreenletWithLoop
cdef
_threadlocal
...
...
src/gevent/__hub_primitives.pxd
→
src/gevent/_
gevent_c
_hub_primitives.pxd
View file @
59f1e9c2
cimport
cython
from
gevent.__greenlet_primitives
cimport
SwitchOutGreenletWithLoop
from
gevent.__hub_local
cimport
get_hub_noargs
as
get_hub
from
gevent._
gevent_c
_greenlet_primitives
cimport
SwitchOutGreenletWithLoop
from
gevent._
gevent_c
_hub_local
cimport
get_hub_noargs
as
get_hub
from
gevent.__waiter
cimport
Waiter
from
gevent.__waiter
cimport
MultipleWaiter
from
gevent._
gevent_c
_waiter
cimport
Waiter
from
gevent._
gevent_c
_waiter
cimport
MultipleWaiter
cdef
InvalidSwitchError
cdef
_waiter
...
...
src/gevent/__ident.pxd
→
src/gevent/_
gevent_c
_ident.pxd
View file @
59f1e9c2
File moved
src/gevent/__imap.pxd
→
src/gevent/_
gevent_c
_imap.pxd
View file @
59f1e9c2
cimport
cython
from
gevent._greenlet
cimport
Greenlet
from
gevent.__semaphore
cimport
Semaphore
from
gevent._queue
cimport
UnboundQueue
from
gevent._g
event_cg
reenlet
cimport
Greenlet
from
gevent._
gevent_c
_semaphore
cimport
Semaphore
from
gevent._
gevent_c
queue
cimport
UnboundQueue
@
cython
.
freelist
(
100
)
@
cython
.
internal
...
...
src/gevent/__semaphore.pxd
→
src/gevent/_
gevent_c
_semaphore.pxd
View file @
59f1e9c2
cimport
cython
from
gevent.__abstract_linkable
cimport
AbstractLinkable
from
gevent._
gevent_c
_abstract_linkable
cimport
AbstractLinkable
cdef
Timeout
...
...
src/gevent/__tracer.pxd
→
src/gevent/_
gevent_c
_tracer.pxd
View file @
59f1e9c2
File moved
src/gevent/__waiter.pxd
→
src/gevent/_
gevent_c
_waiter.pxd
View file @
59f1e9c2
cimport
cython
from
gevent.__greenlet_primitives
cimport
SwitchOutGreenletWithLoop
from
gevent.__hub_local
cimport
get_hub_noargs
as
get_hub
from
gevent._
gevent_c
_greenlet_primitives
cimport
SwitchOutGreenletWithLoop
from
gevent._
gevent_c
_hub_local
cimport
get_hub_noargs
as
get_hub
cdef
sys
cdef
ConcurrentObjectUseError
...
...
src/gevent/_event.pxd
→
src/gevent/_
gevent_c
event.pxd
View file @
59f1e9c2
cimport
cython
from
gevent.__hub_local
cimport
get_hub_noargs
as
get_hub
from
gevent.__abstract_linkable
cimport
AbstractLinkable
from
gevent._
gevent_c
_hub_local
cimport
get_hub_noargs
as
get_hub
from
gevent._
gevent_c
_abstract_linkable
cimport
AbstractLinkable
cdef
_None
cdef
reraise
...
...
src/gevent/_greenlet.pxd
→
src/gevent/_g
event_cg
reenlet.pxd
View file @
59f1e9c2
# cython: auto_pickle=False
cimport
cython
from
gevent.__ident
cimport
IdentRegistry
from
gevent.__hub_local
cimport
get_hub_noargs
as
get_hub
from
gevent.__waiter
cimport
Waiter
from
gevent.__greenlet_primitives
cimport
SwitchOutGreenletWithLoop
from
gevent._
gevent_c
_ident
cimport
IdentRegistry
from
gevent._
gevent_c
_hub_local
cimport
get_hub_noargs
as
get_hub
from
gevent._
gevent_c
_waiter
cimport
Waiter
from
gevent._
gevent_c
_greenlet_primitives
cimport
SwitchOutGreenletWithLoop
cdef
bint
_PYPY
cdef
sys_getframe
...
...
src/gevent/_local.pxd
→
src/gevent/_
gevent_c
local.pxd
View file @
59f1e9c2
# cython: auto_pickle=False
cimport
cython
from
gevent._greenlet
cimport
Greenlet
from
gevent._g
event_cg
reenlet
cimport
Greenlet
cdef
bint
_PYPY
cdef
ref
...
...
src/gevent/_queue.pxd
→
src/gevent/_
gevent_c
queue.pxd
View file @
59f1e9c2
cimport
cython
from
gevent.__waiter
cimport
Waiter
from
gevent._event
cimport
Event
from
gevent.__hub_local
cimport
get_hub_noargs
as
get_hub
from
gevent._
gevent_c
_waiter
cimport
Waiter
from
gevent._
gevent_c
event
cimport
Event
from
gevent._
gevent_c
_hub_local
cimport
get_hub_noargs
as
get_hub
cdef
bint
_greenlet_imported
cdef
_heappush
...
...
src/gevent/_util.py
View file @
59f1e9c2
...
...
@@ -75,9 +75,19 @@ def copy_globals(source,
def
import_c_accel
(
globs
,
cname
):
"""
Import the C-accelerator for the
__name__
Import the C-accelerator for the
*cname*
and copy its globals.
The *cname* should be hardcoded to match the expected
C accelerator module.
Unless PURE_PYTHON is set (in the environment or automatically
on PyPy), then the C-accelerator is required.
"""
if
not
cname
.
startswith
(
'gevent._gevent_c'
):
# Old module code that hasn't been updated yet.
cname
=
cname
.
replace
(
'gevent._'
,
'gevent._gevent_c'
)
name
=
globs
.
get
(
'__name__'
)
...
...
src/gevent/libev/corecext.pyx
View file @
59f1e9c2
...
...
@@ -8,7 +8,7 @@
# that's a new feature that we don't need or want to allow in a gevent
# point release.
# cython: emit_code_comments=False, auto_pickle=False
# cython: emit_code_comments=False, auto_pickle=False
, language_level=3str
# NOTE: We generally cannot use the Cython IF directive as documented
# at
...
...
@@ -19,6 +19,9 @@
# C file for all platforms so that end users that don't use a binary
# wheel don't have to sit through cythonpp and other steps the Makefile does.
# See https://github.com/gevent/gevent/issues/1076
# We compile in 3str mode, which should mean we get absolute import
# by default.
from
__future__
import
absolute_import
cimport
cython
cimport
libev
...
...
@@ -33,14 +36,11 @@ cdef extern from "Python.h":
int
Py_ReprEnter
(
object
)
void
Py_ReprLeave
(
object
)
# Work around lack of absolute_import in Cython
# Note for PY3: not doing so will leave reference to locals() on import
# (reproducible under Python 3.3, not under Python 3.4; see test__refcount_core.py)
sys
=
__import__
(
'sys'
,
level
=
0
)
os
=
__import__
(
'os'
,
level
=
0
)
traceback
=
__import__
(
'traceback'
,
level
=
0
)
signalmodule
=
__import__
(
'signal'
,
level
=
0
)
getswitchinterval
=
__import__
(
'gevent'
,
level
=
0
).
getswitchinterval
import
sys
import
os
import
traceback
import
signal
as
signalmodule
from
gevent
import
getswitchinterval
__all__
=
[
'get_version'
,
...
...
src/gevent/tests/test___ident.py
View file @
59f1e9c2
...
...
@@ -71,7 +71,7 @@ class TestCExt(greentest.TestCase):
def
test_c_extension
(
self
):
self
.
assertEqual
(
IdentRegistry
.
__module__
,
'gevent.__ident'
)
'gevent._
gevent_c
_ident'
)
...
...
src/gevent/tests/test__greenlet.py
View file @
59f1e9c2
...
...
@@ -828,9 +828,9 @@ class TestCExt(greentest.TestCase): # pragma: no cover (we only do coverage on p
def
test_c_extension
(
self
):
self
.
assertEqual
(
greenlet
.
Greenlet
.
__module__
,
'gevent._greenlet'
)
'gevent._g
event_cg
reenlet'
)
self
.
assertEqual
(
greenlet
.
SpawnedLink
.
__module__
,
'gevent._greenlet'
)
'gevent._g
event_cg
reenlet'
)
@
greentest
.
skipWithCExtensions
(
"Needs pure python"
)
class
TestPure
(
greentest
.
TestCase
):
...
...
src/gevent/tests/test__local.py
View file @
59f1e9c2
...
...
@@ -414,7 +414,7 @@ class TestCExt(greentest.TestCase): # pragma: no cover
def
test_c_extension
(
self
):
self
.
assertEqual
(
local
.
__module__
,
'gevent._local'
)
'gevent._
gevent_c
local'
)
@
greentest
.
skipWithCExtensions
(
"Needs pure-python"
)
class
TestPure
(
greentest
.
TestCase
):
...
...
src/gevent/tests/test__semaphore.py
View file @
59f1e9c2
...
...
@@ -91,7 +91,7 @@ class TestCExt(greentest.TestCase):
def
test_c_extension
(
self
):
self
.
assertEqual
(
Semaphore
.
__module__
,
'gevent.__semaphore'
)
'gevent._
gevent_c
_semaphore'
)
class
SwitchWithFixedHash
(
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