Issue #28428: Rename _futures module to _asyncio. (merge from 3.6)

It will have more speedup functions or classes other than asyncio.Future.
This commit is contained in:
INADA Naoki 2016-10-15 15:41:05 +09:00
commit fa8b8847e2
6 changed files with 29 additions and 29 deletions

View File

@ -432,18 +432,18 @@ def _copy_future_state(source, dest):
try: try:
import _futures import _asyncio
except ImportError: except ImportError:
pass pass
else: else:
_futures._init_module( _asyncio._init_module(
traceback.extract_stack, traceback.extract_stack,
events.get_event_loop, events.get_event_loop,
_future_repr_info, _future_repr_info,
InvalidStateError, InvalidStateError,
CancelledError) CancelledError)
Future = _futures.Future Future = _asyncio.Future
def _chain_future(source, destination): def _chain_future(source, destination):

View File

@ -181,7 +181,7 @@ _symtable symtablemodule.c
#_datetime _datetimemodule.c # datetime accelerator #_datetime _datetimemodule.c # datetime accelerator
#_bisect _bisectmodule.c # Bisection algorithms #_bisect _bisectmodule.c # Bisection algorithms
#_heapq _heapqmodule.c # Heap queue algorithm #_heapq _heapqmodule.c # Heap queue algorithm
#_futures _futuresmodule.c # Fast asyncio Future #_asyncio _asynciomodule.c # Fast asyncio Future
#unicodedata unicodedata.c # static Unicode character database #unicodedata unicodedata.c # static Unicode character database

View File

@ -6,8 +6,8 @@
_Py_IDENTIFIER(call_soon); _Py_IDENTIFIER(call_soon);
/* State of the _futures module */ /* State of the _asyncio module */
static int _futuremod_ready; static int _asynciomod_ready;
static PyObject *traceback_extract_stack; static PyObject *traceback_extract_stack;
static PyObject *asyncio_get_event_loop; static PyObject *asyncio_get_event_loop;
static PyObject *asyncio_repr_info_func; static PyObject *asyncio_repr_info_func;
@ -21,11 +21,11 @@ static PyObject* new_future_iter(PyObject *fut);
/* make sure module state is initialized and ready to be used. */ /* make sure module state is initialized and ready to be used. */
static int static int
_FuturesMod_EnsureState(void) _AsyncioMod_EnsureState(void)
{ {
if (!_futuremod_ready) { if (!_asynciomod_ready) {
PyErr_SetString(PyExc_RuntimeError, PyErr_SetString(PyExc_RuntimeError,
"_futures module wasn't properly initialized"); "_asyncio module wasn't properly initialized");
return -1; return -1;
} }
return 0; return 0;
@ -108,7 +108,7 @@ FutureObj_init(FutureObj *fut, PyObject *args, PyObject *kwds)
PyObject *res = NULL; PyObject *res = NULL;
_Py_IDENTIFIER(get_debug); _Py_IDENTIFIER(get_debug);
if (_FuturesMod_EnsureState()) { if (_AsyncioMod_EnsureState()) {
return -1; return -1;
} }
@ -218,7 +218,7 @@ PyDoc_STRVAR(pydoc_exception,
static PyObject * static PyObject *
FutureObj_exception(FutureObj *fut, PyObject *arg) FutureObj_exception(FutureObj *fut, PyObject *arg)
{ {
if (_FuturesMod_EnsureState()) { if (_AsyncioMod_EnsureState()) {
return NULL; return NULL;
} }
@ -251,7 +251,7 @@ PyDoc_STRVAR(pydoc_set_result,
static PyObject * static PyObject *
FutureObj_set_result(FutureObj *fut, PyObject *res) FutureObj_set_result(FutureObj *fut, PyObject *res)
{ {
if (_FuturesMod_EnsureState()) { if (_AsyncioMod_EnsureState()) {
return NULL; return NULL;
} }
@ -282,7 +282,7 @@ FutureObj_set_exception(FutureObj *fut, PyObject *exc)
{ {
PyObject *exc_val = NULL; PyObject *exc_val = NULL;
if (_FuturesMod_EnsureState()) { if (_AsyncioMod_EnsureState()) {
return NULL; return NULL;
} }
@ -735,7 +735,7 @@ static void FutureObj_dealloc(PyObject *self);
static PyTypeObject FutureType = { static PyTypeObject FutureType = {
PyVarObject_HEAD_INIT(0, 0) PyVarObject_HEAD_INIT(0, 0)
"_futures.Future", "_asyncio.Future",
sizeof(FutureObj), /* tp_basicsize */ sizeof(FutureObj), /* tp_basicsize */
.tp_dealloc = FutureObj_dealloc, .tp_dealloc = FutureObj_dealloc,
.tp_as_async = &FutureType_as_async, .tp_as_async = &FutureType_as_async,
@ -898,7 +898,7 @@ static PyMethodDef FutureIter_methods[] = {
static PyTypeObject FutureIterType = { static PyTypeObject FutureIterType = {
PyVarObject_HEAD_INIT(0, 0) PyVarObject_HEAD_INIT(0, 0)
"_futures.FutureIter", "_asyncio.FutureIter",
sizeof(futureiterobject), /* tp_basicsize */ sizeof(futureiterobject), /* tp_basicsize */
0, /* tp_itemsize */ 0, /* tp_itemsize */
(destructor)FutureIter_dealloc, /* tp_dealloc */ (destructor)FutureIter_dealloc, /* tp_dealloc */
@ -949,7 +949,7 @@ new_future_iter(PyObject *fut)
/*********************** Module **************************/ /*********************** Module **************************/
PyDoc_STRVAR(module_doc, "Fast asyncio.Future implementation.\n"); PyDoc_STRVAR(module_doc, "asyncio speedups.\n");
PyObject * PyObject *
_init_module(PyObject *self, PyObject *args) _init_module(PyObject *self, PyObject *args)
@ -984,24 +984,24 @@ _init_module(PyObject *self, PyObject *args)
Py_INCREF(cancelledError); Py_INCREF(cancelledError);
Py_XSETREF(asyncio_CancelledError, cancelledError); Py_XSETREF(asyncio_CancelledError, cancelledError);
_futuremod_ready = 1; _asynciomod_ready = 1;
Py_RETURN_NONE; Py_RETURN_NONE;
} }
static struct PyMethodDef futuresmod_methods[] = { static struct PyMethodDef asynciomod_methods[] = {
{"_init_module", _init_module, METH_VARARGS, NULL}, {"_init_module", _init_module, METH_VARARGS, NULL},
{NULL, NULL} {NULL, NULL}
}; };
static struct PyModuleDef _futuresmodule = { static struct PyModuleDef _asynciomodule = {
PyModuleDef_HEAD_INIT, /* m_base */ PyModuleDef_HEAD_INIT, /* m_base */
"_futures", /* m_name */ "_asyncio", /* m_name */
module_doc, /* m_doc */ module_doc, /* m_doc */
-1, /* m_size */ -1, /* m_size */
futuresmod_methods, /* m_methods */ asynciomod_methods, /* m_methods */
NULL, /* m_slots */ NULL, /* m_slots */
NULL, /* m_traverse */ NULL, /* m_traverse */
NULL, /* m_clear */ NULL, /* m_clear */
@ -1010,7 +1010,7 @@ static struct PyModuleDef _futuresmodule = {
PyMODINIT_FUNC PyMODINIT_FUNC
PyInit__futures(void) PyInit__asyncio(void)
{ {
if (PyType_Ready(&FutureType) < 0) { if (PyType_Ready(&FutureType) < 0) {
return NULL; return NULL;
@ -1019,7 +1019,7 @@ PyInit__futures(void)
return NULL; return NULL;
} }
PyObject *m = PyModule_Create(&_futuresmodule); PyObject *m = PyModule_Create(&_asynciomodule);
if (m == NULL) { if (m == NULL) {
return NULL; return NULL;
} }

View File

@ -213,6 +213,7 @@
<ClInclude Include="..\Python\wordcode_helpers.h" /> <ClInclude Include="..\Python\wordcode_helpers.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\Modules\_asynciomodule.c" />
<ClCompile Include="..\Modules\_bisectmodule.c" /> <ClCompile Include="..\Modules\_bisectmodule.c" />
<ClCompile Include="..\Modules\_blake2\blake2module.c" /> <ClCompile Include="..\Modules\_blake2\blake2module.c" />
<ClCompile Include="..\Modules\_blake2\blake2b_impl.c" /> <ClCompile Include="..\Modules\_blake2\blake2b_impl.c" />
@ -221,7 +222,6 @@
<ClCompile Include="..\Modules\_collectionsmodule.c" /> <ClCompile Include="..\Modules\_collectionsmodule.c" />
<ClCompile Include="..\Modules\_csv.c" /> <ClCompile Include="..\Modules\_csv.c" />
<ClCompile Include="..\Modules\_functoolsmodule.c" /> <ClCompile Include="..\Modules\_functoolsmodule.c" />
<ClCompile Include="..\Modules\_futuresmodule.c" />
<ClCompile Include="..\Modules\_heapqmodule.c" /> <ClCompile Include="..\Modules\_heapqmodule.c" />
<ClCompile Include="..\Modules\_json.c" /> <ClCompile Include="..\Modules\_json.c" />
<ClCompile Include="..\Modules\_localemodule.c" /> <ClCompile Include="..\Modules\_localemodule.c" />

View File

@ -446,6 +446,9 @@
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\Modules\_asynciomodule.c">
<Filter>Modules</Filter>
</ClCompile>
<ClCompile Include="..\Modules\_bisectmodule.c"> <ClCompile Include="..\Modules\_bisectmodule.c">
<Filter>Modules</Filter> <Filter>Modules</Filter>
</ClCompile> </ClCompile>
@ -470,9 +473,6 @@
<ClCompile Include="..\Modules\_functoolsmodule.c"> <ClCompile Include="..\Modules\_functoolsmodule.c">
<Filter>Modules</Filter> <Filter>Modules</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\Modules\_futuresmodule.c">
<Filter>Modules</Filter>
</ClCompile>
<ClCompile Include="..\Modules\_heapqmodule.c"> <ClCompile Include="..\Modules\_heapqmodule.c">
<Filter>Modules</Filter> <Filter>Modules</Filter>
</ClCompile> </ClCompile>

View File

@ -657,8 +657,8 @@ class PyBuildExt(build_ext):
depends=['unicodedata_db.h', 'unicodename_db.h']) ) depends=['unicodedata_db.h', 'unicodename_db.h']) )
# _opcode module # _opcode module
exts.append( Extension('_opcode', ['_opcode.c']) ) exts.append( Extension('_opcode', ['_opcode.c']) )
# Fast asyncio Future implementation # asyncio speedups
exts.append( Extension("_futures", ["_futuresmodule.c"]) ) exts.append( Extension("_asyncio", ["_asynciomodule.c"]) )
# Modules with some UNIX dependencies -- on by default: # Modules with some UNIX dependencies -- on by default:
# (If you have a really backward UNIX, select and socket may not be # (If you have a really backward UNIX, select and socket may not be