Opened 19 years ago

Closed 19 years ago

#1046 closed defect (fixed)

[patch]syndication_feeds's bug for TypeError

Reported by: junzhang.jn@… Owned by: Adrian Holovaty
Component: contrib.syndication Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

at feeds.py's line 35:

if callable(attr):
    try:
        return attr(obj)
    except TypeError:
        return attr()

this code will hide TypeError that zhe 'attr(obj)' function throws.
so , i use below code to fix the little bug.

if callable(attr):
    if hasattr( attr , 'func_code' ):
        argcount = attr.func_code.co_argcount
    else:
        argcount = attr.__call__.func_code.co_argcount
    if argcount == 2:
        # one is self
        return attr(obj)
    else:
        return attr()

Change History (1)

comment:1 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

(In [2341]) Fixed #1046 -- Made syndication feed framework not swallow TypeErrors in functions. Thanks, junzhang.jn

Note: See TracTickets for help on using tickets.
Back to Top