[Checkins] [zopefoundation/zope.publisher] 147b96: Avoid using urllib.parse.splitport()

Marius Gedminas noreply at github.com
Wed Aug 7 14:48:28 CEST 2019


  Branch: refs/heads/fix-deprecation-warning-in-3.8
  Home:   https://github.com/zopefoundation/zope.publisher
  Commit: 147b96ad430a21b1d926b35573e09a4d3e4f0965
      https://github.com/zopefoundation/zope.publisher/commit/147b96ad430a21b1d926b35573e09a4d3e4f0965
  Author: Marius Gedminas <marius at gedmin.as>
  Date:   2019-08-07 (Wed, 07 Aug 2019)

  Changed paths:
    M src/zope/publisher/http.py
    M src/zope/publisher/tests/test_http.py

  Log Message:
  -----------
  Avoid using urllib.parse.splitport()

The function is an undocumented internal helper and emits a deprecation
warning in Python 3.8.

The suggested replacement is urllib.parse.urlparse(), but it's awkward
for our use case (you have to add a scheme so it doesn't treat the
argument as a relative URL, and it unwraps IPv6 addresses that we'd have
to wrap right back into [], and it converts the port to an int whereas
we expect it to be a string) so let's just reimplement the function
using a regexp (which is what the stdlib did anyway).

Fixes #38.




More information about the checkins mailing list