This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年01月07日 13:50 by amaury.forgeotdarc, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| timedelta_macros.patch | amaury.forgeotdarc, 2012年01月07日 13:50 | |||
| Messages (5) | |||
|---|---|---|---|
| msg150796 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2012年01月07日 13:50 | |
All objects of the datetime module have macros to access their properties, except timedelta. This simple patch adds the macros PyDateTime_DELTA_GET_DAYS, PyDateTime_DELTA_GET_SECONDS, PyDateTime_DELTA_GET_MICROSECONDS; module developers are encouraged to use these instead of obj->seconds for example. Motivation: PyPy cannot easily expose PyDateTime_Delta fields because datetime is implemented as a pure Python module and it's difficult to rebuild a C structure from a heap type. In PyPy these macros are actually functions, which do something similar to PyLong_AsLong(PyObject_GetAttrString(obj, "seconds")): https://bitbucket.org/pypy/pypy/src/b67e65d709e1/pypy/module/cpyext/cdatetime.py#cl-235 |
|||
| msg151410 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年01月16日 21:40 | |
The macros should be named PyDelta_XXX, as PyDelta_Check and friend. Otherwise, makes sense. |
|||
| msg151411 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2012年01月16日 21:43 | |
I named them following the other accessor macros: PyDateTime_TIME_GET_HOUR(), even though the check function is named PyTime_Check(). Which inconsistency do you prefer? :) |
|||
| msg151412 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年01月16日 21:51 | |
Ow. Then I don't mind :) |
|||
| msg151486 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年01月17日 20:39 | |
New changeset 463acb73fd79 by Amaury Forgeot d'Arc in branch 'default': Issue #13727: Add 3 macros to access PyDateTime_Delta members: http://hg.python.org/cpython/rev/463acb73fd79 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:25 | admin | set | github: 57936 |
| 2012年01月17日 20:40:18 | amaury.forgeotdarc | set | status: open -> closed resolution: fixed |
| 2012年01月17日 20:39:44 | python-dev | set | nosy:
+ python-dev messages: + msg151486 |
| 2012年01月16日 21:51:39 | pitrou | set | messages: + msg151412 |
| 2012年01月16日 21:43:32 | amaury.forgeotdarc | set | messages: + msg151411 |
| 2012年01月16日 21:40:45 | pitrou | set | nosy:
+ pitrou messages: + msg151410 |
| 2012年01月07日 13:50:35 | amaury.forgeotdarc | create | |