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 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:41 | admin | set | github: 87352 |
| 2021年02月13日 04:53:58 | terry.reedy | set | superseder: Recursive call causes core dump in assertRaises -> <unittest> AssertRaises() causes core dump in handling recursion |
| 2021年02月13日 04:53:58 | terry.reedy | unlink | issue43186 superseder |
| 2021年02月13日 04:52:47 | terry.reedy | set | status: open -> closed superseder: Recursive call causes core dump in assertRaises resolution: duplicate stage: resolved |
| 2021年02月13日 04:52:47 | terry.reedy | link | issue43186 superseder |
| 2021年02月10日 09:14:27 | CharlesFengY | create | |