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年09月19日 18:03 by lanhel, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| CoreDump.txt | lanhel, 2012年09月19日 18:03 | MacOS X crash log | ||
| issue15973.diff | belopolsky, 2012年09月20日 14:53 | review | ||
| Messages (21) | |||
|---|---|---|---|
| msg170732 - (view) | Author: Lance Helsten (lanhel) | Date: 2012年09月19日 18:03 | |
In the 3.2.3 interpreter execute the following line: `None == datetime.timezone(datetime.timedelta())` The interpreter will crash with a `Segmentation fault: 11`. |
|||
| msg170734 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2012年09月19日 18:15 | |
Reproducible also on Linux with Python 3.3. |
|||
| msg170736 - (view) | Author: John Taylor (jftuga) * | Date: 2012年09月19日 18:23 | |
Crashes Python 3.2.3 and Python 3.3.0rc2 on Windows 7 as well. |
|||
| msg170741 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2012年09月19日 18:45 | |
I cannot reproduce on a Mac with py3k tip. Python 3.3.0rc2+ (default:19c74cadea95, Sep 19 2012, 14:39:07) [GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.61)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> None == datetime.timezone(datetime.timedelta()) False Can anyone reproduce in a debug build and post a stack trace? |
|||
| msg170756 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2012年09月19日 19:26 | |
The segfault does not occur in a debug build. The stack trace suggests that timezone_richcompare() accesses other->offset of the None object: (gdb) f 2 #2 0x000000000041d4e9 in do_richcompare (v=None, w=<datetime.timezone at remote 0x7ffff6688ab0>, op=<value optimized out>) at Objects/object.c:563 563 res = (*f)(w, v, _Py_SwappedOp[op]); (gdb) f 1 #1 timezone_richcompare (self=0x7ffff6688ab0, other=<value optimized out>, op=2) at /home/stefan/pydev/cpython-commit/Modules/_datetimemodule.c:3218 3218 return delta_richcompare(self->offset, other->offset, op); (gdb) l 3213 timezone_richcompare(PyDateTime_TimeZone *self, 3214 PyDateTime_TimeZone *other, int op) 3215 { 3216 if (op != Py_EQ && op != Py_NE) 3217 Py_RETURN_NOTIMPLEMENTED; 3218 return delta_richcompare(self->offset, other->offset, op); 3219 } 3220 3221 static Py_hash_t 3222 timezone_hash(PyDateTime_TimeZone *self) (gdb) f 0 #0 0x00007ffff5d850cf in delta_richcompare (self=0x7ffff6688ab0, other=<value optimized out>, op=2) at /home/stefan/pydev/cpython-commit/Modules/_datetimemodule.c:1823 1823 if (PyDelta_Check(other)) { |
|||
| msg170757 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年09月19日 19:30 | |
On linux it segfaults for me in the debug interpreter. On default tip. |
|||
| msg170780 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2012年09月20日 01:48 | |
I think the following simple patch should do the trick. I'll add some tests and commit. Should this get in 3.3.0? diff -r 19c74cadea95 Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c Wed Sep 19 08:25:01 2012 +0300 +++ b/Modules/_datetimemodule.c Wed Sep 19 21:42:51 2012 -0400 @@ -3215,6 +3215,11 @@ { if (op != Py_EQ && op != Py_NE) Py_RETURN_NOTIMPLEMENTED; + if (Py_TYPE(other) != &PyDateTime_TimeZoneType) + if (op == Py_EQ) + Py_RETURN_FALSE; + else + Py_RETURN_TRUE; return delta_richcompare(self->offset, other->offset, op); } |
|||
| msg170781 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2012年09月20日 01:49 | |
Hopefully, there will be some more braces, though. :) |
|||
| msg170783 - (view) | Author: Jesús Cea Avión (jcea) * (Python committer) | Date: 2012年09月20日 03:07 | |
What about datetime subclasses? |
|||
| msg170784 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2012年09月20日 03:21 | |
> What about datetime subclasses? Do you mean timezone subclasses? Timezone type is not subclassable, but we should probably support comparison with any tzinfo subclass. I'll add this logic, but arguably that would be a new feature. |
|||
| msg170803 - (view) | Author: Jesús Cea Avión (jcea) * (Python committer) | Date: 2012年09月20日 12:07 | |
Alexander, did you send a contributor agreement?. I don't see it in the tracker :-?? |
|||
| msg170815 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2012年09月20日 14:53 | |
> Alexander, did you send a contributor agreement? At least twice. :-) |
|||
| msg170833 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2012年09月20日 19:05 | |
Looks good. It would be nice to have this in 3.3.0. There are a couple of blockers open, so perhaps this could go in, too. Georg, are we going to have an rc3 anyway? |
|||
| msg170848 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年09月20日 20:50 | |
New changeset 9fba12ceb2fd by Alexander Belopolsky in branch '3.2': Issue #15973: Fixed segmentation fault on timezone comparison to other types. http://hg.python.org/cpython/rev/9fba12ceb2fd |
|||
| msg170849 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2012年09月20日 20:53 | |
Leeaving the issue open in case it will go to 3.3.0. Reassigning to the RM. |
|||
| msg170851 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2012年09月20日 21:16 | |
Your change does not compile on Windows: _datetimemodule.c ..\Modules\_datetimemodule.c(3247) : error C2065: 'Py_RETURN_NOTIMPLEMENTED' : undeclared identifier http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.2/builds/194/steps/compile/logs/stdio |
|||
| msg170852 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年09月20日 21:25 | |
New changeset f17f67f0ec4b by Alexander Belopolsky in branch '3.2': Issue #15973: fixed 3.2 backport. http://hg.python.org/cpython/rev/f17f67f0ec4b |
|||
| msg170959 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2012年09月22日 06:54 | |
Which commit(s) do I have to pick? |
|||
| msg170962 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2012年09月22日 07:07 | |
This one: 63cb0a642c84 |
|||
| msg170963 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2012年09月22日 07:23 | |
Done as ec77f8fb9958. |
|||
| msg171099 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年09月24日 05:46 | |
New changeset ec77f8fb9958 by Georg Brandl in branch 'default': Closes #15973: fix a segmentation fault when comparing timezone objects. http://hg.python.org/cpython/rev/ec77f8fb9958 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:36 | admin | set | github: 60177 |
| 2012年09月24日 05:46:49 | python-dev | set | messages: + msg171099 |
| 2012年09月22日 07:23:21 | georg.brandl | set | status: open -> closed messages: + msg170963 |
| 2012年09月22日 07:07:01 | skrah | set | messages: + msg170962 |
| 2012年09月22日 06:54:24 | georg.brandl | set | messages: + msg170959 |
| 2012年09月20日 21:25:38 | python-dev | set | messages: + msg170852 |
| 2012年09月20日 21:16:07 | vstinner | set | nosy:
+ vstinner messages: + msg170851 |
| 2012年09月20日 20:53:20 | belopolsky | set | assignee: belopolsky -> georg.brandl resolution: fixed messages: + msg170849 stage: commit review -> resolved |
| 2012年09月20日 20:50:20 | python-dev | set | nosy:
+ python-dev messages: + msg170848 |
| 2012年09月20日 19:05:07 | skrah | set | nosy:
+ georg.brandl messages: + msg170833 |
| 2012年09月20日 14:53:43 | belopolsky | set | files:
+ issue15973.diff priority: normal -> high messages: + msg170815 keywords: + patch stage: needs patch -> commit review |
| 2012年09月20日 12:07:55 | jcea | set | messages: + msg170803 |
| 2012年09月20日 03:21:58 | belopolsky | set | messages: + msg170784 |
| 2012年09月20日 03:07:48 | jcea | set | messages: + msg170783 |
| 2012年09月20日 03:00:24 | jcea | set | nosy:
+ jcea |
| 2012年09月20日 01:49:06 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg170781 |
| 2012年09月20日 01:48:08 | belopolsky | set | messages: + msg170780 |
| 2012年09月19日 19:30:24 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg170757 |
| 2012年09月19日 19:26:45 | skrah | set | messages: + msg170756 |
| 2012年09月19日 18:45:34 | belopolsky | set | messages: + msg170741 |
| 2012年09月19日 18:23:18 | jftuga | set | nosy:
+ jftuga messages: + msg170736 |
| 2012年09月19日 18:20:21 | belopolsky | set | assignee: ronaldoussoren -> belopolsky |
| 2012年09月19日 18:15:43 | skrah | set | versions:
+ Python 3.3 nosy: + skrah, belopolsky messages: + msg170734 components: + Extension Modules, - macOS stage: needs patch |
| 2012年09月19日 18:03:16 | lanhel | create | |