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.

Author CharlesFengY
Recipients CharlesFengY
Date 2021年02月10日.09:14:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612948467.97.0.883928038728.issue43186@roundup.psfhosted.org>
In-reply-to
Content
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
2021年02月10日 09:14:28CharlesFengYsetrecipients: + CharlesFengY
2021年02月10日 09:14:27CharlesFengYsetmessageid: <1612948467.97.0.883928038728.issue43186@roundup.psfhosted.org>
2021年02月10日 09:14:27CharlesFengYlinkissue43186 messages
2021年02月10日 09:14:27CharlesFengYcreate

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