homepage

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: Recursive call causes core dump in assertRaises
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: duplicate
Dependencies: Superseder: <unittest> AssertRaises() causes core dump in handling recursion
View: 43185
Assigned To: Nosy List: CharlesFengY
Priority: normal Keywords:

Created on 2021年02月10日 09:14 by CharlesFengY, last changed 2022年04月11日 14:59 by admin. This issue is now closed.

Messages (1)
msg386764 - (view) Author: Yang Feng (CharlesFengY) Date: 2021年02月10日 09:14
In following teststr.py, class MyString is nestedly instanced in method __getattr__(). This script will lead to a "core dump" in Python interpreter. My Python version is 3.9.1 and my operating system is Ubuntu 16.04. 
teststr.py
+++++++++++++++++++++++++++++++++++++++++++
class StrError(str):
 pass
class MyString:
 def __init__(self, istr):
 self.__mystr__ = istr
 def __getattr__(self, content):
 with self:
 return MyString(getattr(self.__mystr__, content))
 def __setattr__(self, content, sstr):
 setattr(self.__mystr__, content)
 def __enter__(self):
 return self
 def __exit__(self, exc_type, exc_val, exc_tb):
 raise StrError(self.__mystr__) 
 return True
MyString("hello")
+++++++++++++++++++++++++++++++++++++++++
History
Date User Action Args
2022年04月11日 14:59:41adminsetgithub: 87352
2021年02月13日 04:53:58terry.reedysetsuperseder: Recursive call causes core dump in assertRaises -> <unittest> AssertRaises() causes core dump in handling recursion
2021年02月13日 04:53:58terry.reedyunlinkissue43186 superseder
2021年02月13日 04:52:47terry.reedysetstatus: open -> closed
superseder: Recursive call causes core dump in assertRaises
resolution: duplicate
stage: resolved
2021年02月13日 04:52:47terry.reedylinkissue43186 superseder
2021年02月10日 09:14:27CharlesFengYcreate

AltStyle によって変換されたページ (->オリジナル) /