This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients eric.araujo, eric.smith, ncoghlan, orsenthil, pitrou, r.david.murray, sjt, vstinner
Date 2010-10-24.13:42:44
SpamBayes Score 1.2467393e-08
Marked as misclassified No
Message-id <1287927772.79.0.561294114733.issue9873@psf.upfronthosting.co.za>
In-reply-to
Content
Attached a second version of the patch. Notable features:
- uses a coercion-to-str-and-back strategy (using ascii-strict)
- a significantly more comprehensive pass through the urlparse test suite. I'm happy that the test suite mods are complete with this pass.

The actual coercion-to-str technique I used standardises the type consistency check for the attributes and also returns a callable that handles the necessary coercion of any results. The parsed/split result objects gain encode/decode methods to allow that all to be handled polymorphically (although I think the decode methods may actually be redundant in practice).

There's a deliberate loophole in the type consistency checking to allow the empty string to be type-neutral. Without that, the scheme='' default argument to urlsplit and urlparse becomes painful (as do the urljoin shortcuts for base or url being the empty string).

Implementing this was night and day when compared to the initial attempt that tried to actually manipulate bytes input as bytes. With that patch, it took me multiple runs of the test suite to get everything working. This time, the only things I had to fix were typos and bugs in the additional test suite enhancements. The actual code logic for the type coercions worked first time.
History
Date User Action Args
2010-10-24 13:42:52ncoghlansetrecipients: + ncoghlan, orsenthil, pitrou, vstinner, eric.smith, eric.araujo, r.david.murray, sjt
2010-10-24 13:42:52ncoghlansetmessageid: <1287927772.79.0.561294114733.issue9873@psf.upfronthosting.co.za>
2010-10-24 13:42:51ncoghlanlinkissue9873 messages
2010-10-24 13:42:50ncoghlancreate