Commit 57a7c077 authored by Jason Madden's avatar Jason Madden

make os, select and signal export the stdlib symbols, just like socket and ssl.

parent 7e11a123
...@@ -28,7 +28,11 @@ ...@@ -28,7 +28,11 @@
a :exc:`ValueError` if they do. See :issue:`775`. a :exc:`ValueError` if they do. See :issue:`775`.
- Python 3: Add support for :meth:`socket.socket.sendmsg`, - Python 3: Add support for :meth:`socket.socket.sendmsg`,
:meth:`socket.socket.recvmsg` and :meth:`socket.socket.recvmsg_into` :meth:`socket.socket.recvmsg` and :meth:`socket.socket.recvmsg_into`
on platforms where they are defined. Initial :pr:`773` by Jakub Klama. on platforms where they are defined. Initial :pr:`773` by Jakub
Klama.
- The modules :mod:`gevent.os`, :mod:`gevent.signal` and
:mod:`gevent.select` export all the attributes from their
corresponding standard library counterpart.
1.1.0 (Mar 5, 2016) 1.1.0 (Mar 5, 2016)
=================== ===================
......
...@@ -47,6 +47,7 @@ import os ...@@ -47,6 +47,7 @@ import os
import sys import sys
from gevent.hub import get_hub, reinit from gevent.hub import get_hub, reinit
from gevent._compat import PY3 from gevent._compat import PY3
from gevent._util import copy_globals
import errno import errno
EAGAIN = getattr(errno, 'EAGAIN', 11) EAGAIN = getattr(errno, 'EAGAIN', 11)
...@@ -430,5 +431,8 @@ if hasattr(os, 'fork'): ...@@ -430,5 +431,8 @@ if hasattr(os, 'fork'):
else: else:
__implements__.remove('fork') __implements__.remove('fork')
__imports__ = copy_globals(os, globals(),
names_to_ignore=__implements__ + __extensions__,
dunder_names_to_keep=())
__all__ = __implements__ + __extensions__ __all__ = list(set(__implements__ + __extensions__))
...@@ -6,6 +6,7 @@ from __future__ import absolute_import ...@@ -6,6 +6,7 @@ from __future__ import absolute_import
from gevent.event import Event from gevent.event import Event
from gevent.hub import get_hub from gevent.hub import get_hub
from gevent._compat import integer_types from gevent._compat import integer_types
from gevent._util import copy_globals
try: try:
...@@ -22,6 +23,9 @@ import select as __select__ ...@@ -22,6 +23,9 @@ import select as __select__
error = __select__.error error = __select__.error
__imports__ = copy_globals(__select__, globals(),
names_to_ignore=__all__,
dunder_names_to_keep=())
def get_fileno(obj): def get_fileno(obj):
try: try:
......
...@@ -15,6 +15,8 @@ information on configuring this not to be the case for advanced uses. ...@@ -15,6 +15,8 @@ information on configuring this not to be the case for advanced uses.
""" """
from __future__ import absolute_import from __future__ import absolute_import
from gevent._util import _NONE as _INITIAL
from gevent._util import copy_globals
import signal as _signal import signal as _signal
...@@ -22,8 +24,6 @@ __implements__ = [] ...@@ -22,8 +24,6 @@ __implements__ = []
__extensions__ = [] __extensions__ = []
_INITIAL = object()
_child_handler = _INITIAL _child_handler = _INITIAL
_signal_signal = _signal.signal _signal_signal = _signal.signal
...@@ -116,4 +116,8 @@ else: ...@@ -116,4 +116,8 @@ else:
__extensions__.append("signal") __extensions__.append("signal")
__extensions__.append("getsignal") __extensions__.append("getsignal")
__imports__ = copy_globals(_signal, globals(),
names_to_ignore=__implements__ + __extensions__,
dunder_names_to_keep=())
__all__ = __implements__ + __extensions__ __all__ = __implements__ + __extensions__
...@@ -61,6 +61,13 @@ if sys.platform.startswith('win'): ...@@ -61,6 +61,13 @@ if sys.platform.startswith('win'):
class Test(unittest.TestCase): class Test(unittest.TestCase):
stdlib_has_all = False
stdlib_all = ()
stdlib_name = None
stdlib_module = None
module = None
__implements__ = __extensions__ = __imports__ = ()
def check_all(self): def check_all(self):
"Check that __all__ is present and does not contain invalid entries" "Check that __all__ is present and does not contain invalid entries"
if not hasattr(self.module, '__all__'): if not hasattr(self.module, '__all__'):
...@@ -145,9 +152,13 @@ class Test(unittest.TestCase): ...@@ -145,9 +152,13 @@ class Test(unittest.TestCase):
not_implemented = NOT_IMPLEMENTED.get(self.stdlib_name) not_implemented = NOT_IMPLEMENTED.get(self.stdlib_name)
if not_implemented is not None: if not_implemented is not None:
result = [] result = []
for name in missed[:]: for name in missed:
if name in not_implemented: if name in not_implemented:
print('IncompleteImplWarning: %s.%s' % (self.modname, name)) # We often don't want __all__ to be set because we wind up
# documenting things that we just copy in from the stdlib.
# But if we implement it, don't print a warning
if getattr(self.module, name, self) is self:
print('IncompleteImplWarning: %s.%s' % (self.modname, name))
else: else:
result.append(name) result.append(name)
missed = result missed = result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment