[issue17272] request.full_url: unexpected results on assignment

Demian Brecht report at bugs.python.org
Mon Mar 18 16:28:17 CET 2013


Demian Brecht added the comment:

No worries.

The change is not backwards incompatible. test_urllib2 test pass without any modification (I'm getting a segfault in test_heapq atm so can't run the full suite). I've simply moved the side effects cause by __init__ to a setter so that full_url may be set after instantiation and will still incur the same results as after initial creation.

The biggest problem with this particular attribute and the way that it's currently handled is inconsistent with the rest of the class. The only other attribute that incurs side effects when set (data) is implemented with @property getter and setters. When set, it incurs side effects on the headers (removing Content-Length). Unless I'm missing something, other attributes are directly mutable and do not incur side effects on instance state when set.

In my mind, if full_url is publicly accessible, then it should be publicly accessible /and/ settable. It currently is not without causing invalid state within a given Request instance.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17272>
_______________________________________


More information about the Python-bugs-list mailing list