[Feature Request] Throw a warning if kwarg "_class=..." is given

Bug #2025089 reported by Thelma Runyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Fix Committed
Undecided
Unassigned

Bug Description

When you only use bs4 occassionally, it's easy to forgot if the correct filter for functions like `soup.filter(...)` is `class_=...` or `_class=...`. If you provide `_class=...` instead of `class_=...`, then no results are returned and it's a serious hassle to debug.

Can BS4 throw a warning if someone tries to provide a `soup.filter(..., _class='some-class')` arg?

Revision history for this message
Leonard Richardson (leonardr) wrote :

I am OK with issuing a SyntaxWarning in this situation and otherwise maintaining the current behavior.

Changed in beautifulsoup:
status: New → Confirmed
Revision history for this message
Chris Papademetrious (chrispitude) wrote :

This one bit me too, including the part about being difficult to debug because there's no obvious failure.

Revision history for this message
Leonard Richardson (leonardr) wrote :

Fixed in revision 1b679b7 on the 4.13 branch.

Changed in beautifulsoup:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.