mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
Issue #7989: Added pure python implementation of the datetime module.
This commit is contained in:
parent
c2721b0cd0
commit
cf86e368eb
9 changed files with 5813 additions and 3670 deletions
2087
Lib/datetime.py
Normal file
2087
Lib/datetime.py
Normal file
File diff suppressed because it is too large
Load diff
3674
Lib/test/datetimetester.py
Normal file
3674
Lib/test/datetimetester.py
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -473,6 +473,14 @@ C-API
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #7989: Added pure python implementation of the `datetime`
|
||||||
|
module. The C module is renamed to `_datetime` and if available,
|
||||||
|
overrides all classes defined in datetime with fast C impementation.
|
||||||
|
Python implementation is based on the original python prototype for
|
||||||
|
the datetime module by Tim Peters with minor modifications by the
|
||||||
|
PyPy project. The test suite now tests `datetime` module with and
|
||||||
|
without `_datetime` acceleration using the same test cases.
|
||||||
|
|
||||||
- Issue #7895: platform.mac_ver() no longer crashes after calling os.fork()
|
- Issue #7895: platform.mac_ver() no longer crashes after calling os.fork()
|
||||||
|
|
||||||
- Issue #9323: Fixed a bug in trace.py that resulted in loosing the
|
- Issue #9323: Fixed a bug in trace.py that resulted in loosing the
|
||||||
|
|
|
@ -170,7 +170,7 @@ _symtable symtablemodule.c
|
||||||
#atexit atexitmodule.c # Register functions to be run at interpreter-shutdown
|
#atexit atexitmodule.c # Register functions to be run at interpreter-shutdown
|
||||||
#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator
|
#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator
|
||||||
#_pickle _pickle.c # pickle accelerator
|
#_pickle _pickle.c # pickle accelerator
|
||||||
#datetime datetimemodule.c # date/time type
|
#_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
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* final result fits in a C int (this can be an issue on 64-bit boxes).
|
* final result fits in a C int (this can be an issue on 64-bit boxes).
|
||||||
*/
|
*/
|
||||||
#if SIZEOF_INT < 4
|
#if SIZEOF_INT < 4
|
||||||
# error "datetime.c requires that C int have at least 32 bits"
|
# error "_datetime.c requires that C int have at least 32 bits"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MINYEAR 1
|
#define MINYEAR 1
|
||||||
|
@ -5086,7 +5086,7 @@ static PyDateTime_CAPI CAPI = {
|
||||||
|
|
||||||
static struct PyModuleDef datetimemodule = {
|
static struct PyModuleDef datetimemodule = {
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
"datetime",
|
"_datetime",
|
||||||
"Fast implementation of the datetime type.",
|
"Fast implementation of the datetime type.",
|
||||||
-1,
|
-1,
|
||||||
module_methods,
|
module_methods,
|
||||||
|
@ -5097,7 +5097,7 @@ static struct PyModuleDef datetimemodule = {
|
||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
PyInit_datetime(void)
|
PyInit__datetime(void)
|
||||||
{
|
{
|
||||||
PyObject *m; /* a module object */
|
PyObject *m; /* a module object */
|
||||||
PyObject *d; /* its dict */
|
PyObject *d; /* its dict */
|
|
@ -43,7 +43,7 @@ extern PyObject* PyInit__sre(void);
|
||||||
extern PyObject* PyInit_parser(void);
|
extern PyObject* PyInit_parser(void);
|
||||||
extern PyObject* PyInit_winreg(void);
|
extern PyObject* PyInit_winreg(void);
|
||||||
extern PyObject* PyInit__struct(void);
|
extern PyObject* PyInit__struct(void);
|
||||||
extern PyObject* PyInit_datetime(void);
|
extern PyObject* PyInit__datetime(void);
|
||||||
extern PyObject* PyInit__functools(void);
|
extern PyObject* PyInit__functools(void);
|
||||||
extern PyObject* PyInit__json(void);
|
extern PyObject* PyInit__json(void);
|
||||||
extern PyObject* PyInit_zlib(void);
|
extern PyObject* PyInit_zlib(void);
|
||||||
|
@ -116,7 +116,7 @@ struct _inittab _PyImport_Inittab[] = {
|
||||||
{"parser", PyInit_parser},
|
{"parser", PyInit_parser},
|
||||||
{"winreg", PyInit_winreg},
|
{"winreg", PyInit_winreg},
|
||||||
{"_struct", PyInit__struct},
|
{"_struct", PyInit__struct},
|
||||||
{"datetime", PyInit_datetime},
|
{"_datetime", PyInit__datetime},
|
||||||
{"_functools", PyInit__functools},
|
{"_functools", PyInit__functools},
|
||||||
{"_json", PyInit__json},
|
{"_json", PyInit__json},
|
||||||
|
|
||||||
|
|
|
@ -1068,7 +1068,7 @@
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\Modules\datetimemodule.c"
|
RelativePath="..\Modules\_datetimemodule.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -452,7 +452,7 @@ class PyBuildExt(build_ext):
|
||||||
# time operations and variables
|
# time operations and variables
|
||||||
exts.append( Extension('time', ['timemodule.c', '_time.c'],
|
exts.append( Extension('time', ['timemodule.c', '_time.c'],
|
||||||
libraries=math_libs) )
|
libraries=math_libs) )
|
||||||
exts.append( Extension('datetime', ['datetimemodule.c', '_time.c'],
|
exts.append( Extension('_datetime', ['_datetimemodule.c', '_time.c'],
|
||||||
libraries=math_libs) )
|
libraries=math_libs) )
|
||||||
# fast iterator tools implemented in C
|
# fast iterator tools implemented in C
|
||||||
exts.append( Extension("itertools", ["itertoolsmodule.c"]) )
|
exts.append( Extension("itertools", ["itertoolsmodule.c"]) )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue