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 <>
In following, 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.
class StrError(str):

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

Date User Action Args
2021-02-10 09:14:28CharlesFengYsetrecipients: + CharlesFengY
2021-02-10 09:14:27CharlesFengYsetmessageid: <>
2021-02-10 09:14:27CharlesFengYlinkissue43186 messages
2021-02-10 09:14:27CharlesFengYcreate