jsumners / jsumners/feedparser

Parsing from string not works anymore

Open
#332 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-migrated
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

What steps will reproduce the problem?
2. feedparser.parse(response.content)

What version of the product are you using? On what operating system?
5.1, python 2.5.2, Google App Engine

Please provide any additional information below.
You have bug in code which not allow to parse string to feed - :

Stack:

1. def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, 
referrer=None, handlers=None, request_headers=None, response_headers=None):
...
        f = _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers)
...

2. def _open_resource(url_file_stream_or_string, etag, modified, agent, 
referrer, handlers, request_headers):
...
# HERE IS BUG! (Unhandled exception)
    try:
        return open(url_file_stream_or_string, 'rb')
    except IOError:
        pass

...

It not throws IOError - you should validate parameters not use exceptions to 
validate since it not designed for validation - it is quick risky way but 
slowing development:

{'bozo': 1,
 'bozo_exception': TypeError('_getfullpathname() argument 1 must be (buffer overflow), not str',),
 'entries': [],
 'feed': {}}

Original issue reported on code.google.com by Cezary.W...@gmail.com on 25 Feb 2012 at 8:33

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing feedparser.parse(response.content) with the reported Python 2.5.2 and Google App Engine context. Read parse and _open_resource, especially the open(url_file_stream_or_string, 'rb') path. Done means a string feed is parsed without the reported TypeError and without an empty result caused by that exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.