Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError '__deepcopy__' #128

Open
decaz opened this issue Apr 9, 2018 · 2 comments
Open

KeyError '__deepcopy__' #128

decaz opened this issue Apr 9, 2018 · 2 comments

Comments

@decaz
Copy link

decaz commented Apr 9, 2018

There are several places where deepcopy is used with FeedParserDict instance. It raises KeyError since there is a row copier = getattr(x, "__deepcopy__", None) within copy.deepcopy function:

KeyError: '__deepcopy__'
  File "site-packages/feedparser.py", line 398, in __getattr__
    return self.__getitem__(key)
  File "site-packages/feedparser.py", line 356, in __getitem__
    return dict.__getitem__(self, key)

I have found the old commit ba2e85e but now there is no any check to prevent such a case.

@kurtmckee
Copy link
Owner

Thanks for reporting this! I'd like to confirm the behavior: is the KeyError happening in code that you've written? Or is it happening while parsing a specific feed? Finally, what version of Python are you using?

@decaz
Copy link
Author

decaz commented May 9, 2018

@kurtmckee the KeyError happens while parsing some feeds and unfortunately it's hard to catch it - it's very rare. Sentry says the error is raising at https://github.com/kurtmckee/feedparser/blob/develop/feedparser/util.py#L97 with the following locals:

key = '__deepcopy__'
realkey = '__deepcopy__'
self = {
    'base': '', 
    'language': None, 
    'type': 'text/plain'
}

I use Python 3.6.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants