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.

classification
Title: devious code can crash structseqs
Type: Stage:
Components: Interpreter Core Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mwh Nosy List: mwh
Priority: high Keywords:

Created on 2002-03-05 18:06 by mwh, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (2)
msg9522 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2002-03-05 18:06
Some days you feel that whenever you look closely at
something, you find bugs in it.

>>> import time
>>> class C:
...  def __getitem__(self, i):
...   raise IndexError
...  def __len__(self):
...   return 9
...
>>> time.struct_time(C())
Segmentation fault (core dumped)

This isn't hard to fix (use the PySequence_Fast API),
but I have all sorts of changes in my copy of
Objects/structseq.c and I don't want to forget this.
msg9523 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2002-03-06 17:18
Logged In: YES 
user_id=6656

Fixed in revision 1.5 of Objects/structseq.c.
Test in revision 1.3 of Lib/test/test_structseq.py.
History
Date User Action Args
2022-04-10 16:05:04adminsetgithub: 36204
2002-03-05 18:06:22mwhcreate