Opened 10 years ago

Closed 9 years ago

#1046 closed defect (fixed)

[patch]syndication_feeds's bug for TypeError

Reported by: junzhang.jn@… Owned by: adrian
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: UI/UX:

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 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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