Skip to content

Commit 86b2fb9

Browse files
committed
Merged revisions 64623,64640,64665,64687,64689-64690,64719,64721,64735,64742,64744-64746,64756-64761,64767-64769,64771-64772,64774-64775,64788,64793,64835-64836 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64623 | benjamin.peterson | 2008-07-01 21:51:54 +0200 (Tue, 01 Jul 2008) | 1 line write a short little section for multiprocessing; it still needs help ........ r64640 | georg.brandl | 2008-07-01 22:56:03 +0200 (Tue, 01 Jul 2008) | 2 lines Add a comment about incref'ing w. ........ r64665 | jesse.noller | 2008-07-02 18:56:51 +0200 (Wed, 02 Jul 2008) | 1 line Add #!/usr/bin/env python for ben ........ r64687 | andrew.kuchling | 2008-07-03 14:50:03 +0200 (Thu, 03 Jul 2008) | 1 line Tweak wording ........ r64689 | benjamin.peterson | 2008-07-03 14:57:35 +0200 (Thu, 03 Jul 2008) | 1 line lowercase glossary term ........ r64690 | benjamin.peterson | 2008-07-03 15:01:17 +0200 (Thu, 03 Jul 2008) | 1 line let the term be linked ........ r64719 | raymond.hettinger | 2008-07-05 04:11:55 +0200 (Sat, 05 Jul 2008) | 1 line Update comment on prediction macros. ........ r64721 | georg.brandl | 2008-07-05 12:07:18 +0200 (Sat, 05 Jul 2008) | 2 lines Fix tabs. ........ r64735 | mark.dickinson | 2008-07-05 17:25:48 +0200 (Sat, 05 Jul 2008) | 3 lines Minor rewrite of cmath_log to work around a Sun compiler bug. See issue python#3168. ........ r64742 | benjamin.peterson | 2008-07-05 18:29:38 +0200 (Sat, 05 Jul 2008) | 1 line make regrtest aware of the lib2to3 resource ........ r64744 | georg.brandl | 2008-07-05 18:43:45 +0200 (Sat, 05 Jul 2008) | 2 lines Keep below 80 chars. ........ r64745 | facundo.batista | 2008-07-05 21:19:50 +0200 (Sat, 05 Jul 2008) | 3 lines Issue 3289. Removed two lines that ended doing nothing. ........ r64746 | facundo.batista | 2008-07-05 22:39:59 +0200 (Sat, 05 Jul 2008) | 4 lines Issue python#3239. Differentiate the ascii call from the curses one and the builtin one. ........ r64756 | gregory.p.smith | 2008-07-06 09:16:40 +0200 (Sun, 06 Jul 2008) | 3 lines - Issue python#2113: Fix error in subprocess.Popen if the select system call is interrupted by a signal. ........ r64757 | benjamin.peterson | 2008-07-06 14:39:09 +0200 (Sun, 06 Jul 2008) | 1 line remove test_compact_freelists from test_sys ........ r64758 | gregory.p.smith | 2008-07-06 19:06:29 +0200 (Sun, 06 Jul 2008) | 2 lines fix issue3304 - remove an incorrect PyMem_Free in fileio_init ........ r64759 | georg.brandl | 2008-07-06 19:36:20 +0200 (Sun, 06 Jul 2008) | 2 lines Fix opensearch template. ........ r64760 | andrew.kuchling | 2008-07-06 19:43:16 +0200 (Sun, 06 Jul 2008) | 1 line Wording fix ........ r64761 | andrew.kuchling | 2008-07-06 19:44:17 +0200 (Sun, 06 Jul 2008) | 1 line Add two items; rewrap paragraph ........ r64767 | gregory.p.smith | 2008-07-07 06:31:58 +0200 (Mon, 07 Jul 2008) | 4 lines - Issue python#3309: Fix bz2.BZFile itererator to release its internal lock properly when raising an exception due to the bz2file being closed. Prevents a deadlock. ........ r64768 | josiah.carlson | 2008-07-07 06:51:46 +0200 (Mon, 07 Jul 2008) | 2 lines Fixed bugs 760475, 953599, and 1519. ........ r64769 | gregory.p.smith | 2008-07-07 06:54:31 +0200 (Mon, 07 Jul 2008) | 2 lines Add commented out #_sha256 and #_sha512 lines per issue 3183. ........ r64771 | gregory.p.smith | 2008-07-07 07:09:12 +0200 (Mon, 07 Jul 2008) | 4 lines - Issue python#3094: httplib.HTTPSConnection Host: headers no longer include the redundant ":443" port number designation when the connection is using the default https port (443). ........ r64772 | skip.montanaro | 2008-07-07 13:16:14 +0200 (Mon, 07 Jul 2008) | 2 lines Correct grammar. ........ r64774 | andrew.kuchling | 2008-07-07 18:51:09 +0200 (Mon, 07 Jul 2008) | 1 line Fix example to match text ........ r64775 | facundo.batista | 2008-07-07 19:02:59 +0200 (Mon, 07 Jul 2008) | 3 lines Issue 3306. Better control for a lenght in findmax() function. ........ r64788 | georg.brandl | 2008-07-08 09:05:23 +0200 (Tue, 08 Jul 2008) | 2 lines Add missing ABCs to list. ........ r64793 | nick.coghlan | 2008-07-08 16:21:42 +0200 (Tue, 08 Jul 2008) | 1 line Add missing NEWS and ACK entries for r64791 ........ r64835 | raymond.hettinger | 2008-07-10 11:31:08 +0200 (Thu, 10 Jul 2008) | 1 line Issue 3287: Raise correct exception for float inputs. ........ r64836 | raymond.hettinger | 2008-07-10 12:28:41 +0200 (Thu, 10 Jul 2008) | 1 line Use operator.index() instead of n.__index__(). ........
1 parent 3ccb787 commit 86b2fb9

27 files changed

+200
-143
lines changed

Doc/glossary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Glossary
1616
The typical Python prompt of the interactive shell when entering code for
1717
an indented code block.
1818

19-
Abstract Base Class
19+
abstract base class
2020
Abstract Base Classes (abbreviated ABCs) complement :term:`duck-typing` by
2121
providing a way to define interfaces when other techniques like :func:`hasattr`
2222
would be clumsy. Python comes with many builtin ABCs for data structures

Doc/library/abc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
.. sectionauthor:: Georg Brandl
99
.. much of the content adapted from docstrings
1010
11-
This module provides the infrastructure for defining :term:`abstract base
12-
classes` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this
11+
This module provides the infrastructure for defining an :term:`abstract base
12+
class` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this
1313
was added to Python. (See also :pep:`3141` and the :mod:`numbers` module
1414
regarding a type hierarchy for numbers based on ABCs.)
1515

Doc/library/collections.rst

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,42 +37,50 @@ ABCs - abstract base classes
3737

3838
The collections module offers the following ABCs:
3939

40-
========================= ==================== ====================== ====================================================
41-
ABC Inherits Abstract Methods Mixin Methods
42-
========================= ==================== ====================== ====================================================
43-
:class:`Container` ``__contains__``
44-
:class:`Hashable` ``__hash__``
45-
:class:`Iterable` ``__iter__``
46-
:class:`Iterator` :class:`Iterable` ``__next__`` ``__iter__``
47-
:class:`Sized` ``__len__``
48-
49-
:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``,
50-
:class:`Iterable`, ``__len__``. and ``get``, ``__eq__``, and ``__ne__``
51-
:class:`Container` ``__iter__``
52-
53-
:class:`MutableMapping` :class:`Mapping` ``__getitem__`` Inherited Mapping methods and
54-
``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``,
55-
``__delitem__``, and ``setdefault``
56-
``__iter__``, and
57-
``__len__``
58-
59-
:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``. ``__iter__``, ``__reversed__``.
60-
:class:`Iterable`, and ``__len__`` ``index``, and ``count``
61-
:class:`Container`
62-
63-
:class:`MutableSequnce` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and
64-
``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``,
65-
``insert``, ``remove``, and ``__iadd__``
66-
and ``__len__``
67-
68-
:class:`Set` :class:`Sized`, ``__len__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``,
69-
:class:`Iterable`, ``__iter__``, and ``__gt__``, ``__ge__``, ``__and__``, ``__or__``
70-
:class:`Container` ``__contains__`` ``__sub__``, ``__xor__``, and ``isdisjoint``
71-
72-
:class:`MutableSet` :class:`Set` ``add`` and Inherited Set methods and
73-
``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``,
74-
``__iand__``, ``__ixor__``, and ``__isub__``
75-
========================= ==================== ====================== ====================================================
40+
========================= ===================== ====================== ====================================================
41+
ABC Inherits Abstract Methods Mixin Methods
42+
========================= ===================== ====================== ====================================================
43+
:class:`Container` ``__contains__``
44+
:class:`Hashable` ``__hash__``
45+
:class:`Iterable` ``__iter__``
46+
:class:`Iterator` :class:`Iterable` ``__next__`` ``__iter__``
47+
:class:`Sized` ``__len__``
48+
:class:`Callable` ``__call__``
49+
50+
:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``. ``__iter__``, ``__reversed__``.
51+
:class:`Iterable`, and ``__len__`` ``index``, and ``count``
52+
:class:`Container`
53+
54+
:class:`MutableSequnce` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and
55+
``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``,
56+
``insert``, ``remove``, and ``__iadd__``
57+
and ``__len__``
58+
59+
:class:`Set` :class:`Sized`, ``__len__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``,
60+
:class:`Iterable`, ``__iter__``, and ``__gt__``, ``__ge__``, ``__and__``, ``__or__``
61+
:class:`Container` ``__contains__`` ``__sub__``, ``__xor__``, and ``isdisjoint``
62+
63+
:class:`MutableSet` :class:`Set` ``add`` and Inherited Set methods and
64+
``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``,
65+
``__iand__``, ``__ixor__``, and ``__isub__``
66+
67+
:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``,
68+
:class:`Iterable`, ``__len__``. and ``get``, ``__eq__``, and ``__ne__``
69+
:class:`Container` ``__iter__``
70+
71+
:class:`MutableMapping` :class:`Mapping` ``__getitem__`` Inherited Mapping methods and
72+
``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``,
73+
``__delitem__``, and ``setdefault``
74+
``__iter__``, and
75+
``__len__``
76+
77+
:class:`MappingView` :class:`Sized` ``__len__``
78+
:class:`KeysView` :class:`MappingView`, ``__contains__``,
79+
:class:`Set` ``__iter__``
80+
:class:`ItemsView` :class:`MappingView`, ``__contains__``,
81+
:class:`Set` ``__iter__``
82+
:class:`ValuesView` :class:`MappingView` ``__contains__``, ``__iter__``
83+
========================= ===================== ====================== ====================================================
7684

7785
These ABCs allow us to ask classes or instances if they provide
7886
particular functionality, for example::

Doc/library/shutil.rst

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,39 @@ copying and removal. For operations on individual files, see also the
7878
Unix command :program:`cp -p`.
7979

8080

81-
.. function:: copytree(src, dst[, symlinks])
81+
.. function:: ignore_patterns(\*patterns)
82+
83+
This factory function creates a function that can be used as a callable for
84+
:func:`copytree`\'s *ignore* argument, ignoring files and directories that
85+
match one of the glob-style *patterns* provided. See the example below.
86+
87+
88+
.. function:: copytree(src, dst[, symlinks=False[, ignore=None]])
8289

8390
Recursively copy an entire directory tree rooted at *src*. The destination
84-
directory, named by *dst*, must not already exist; it will be created as well as
85-
missing parent directories. Permissions and times of directories are copied with
86-
:func:`copystat`, individual files are copied using :func:`copy2`. If
87-
*symlinks* is true, symbolic links in the source tree are represented as
88-
symbolic links in the new tree; if false or omitted, the contents of the linked
89-
files are copied to the new tree. If exception(s) occur, an :exc:`Error` is
90-
raised with a list of reasons.
91-
92-
The source code for this should be considered an example rather than a tool.
91+
directory, named by *dst*, must not already exist; it will be created as well
92+
as missing parent directories. Permissions and times of directories are
93+
copied with :func:`copystat`, individual files are copied using
94+
:func:`copy2`.
95+
96+
If *symlinks* is true, symbolic links in the source tree are represented as
97+
symbolic links in the new tree; if false or omitted, the contents of the
98+
linked files are copied to the new tree.
99+
100+
If *ignore* is given, it must be a callable that will receive as its
101+
arguments the directory being visited by :func:`copytree`, and a list of its
102+
contents, as returned by :func:`os.listdir`. Since :func:`copytree` is
103+
called recursively, the *ignore* callable will be called once for each
104+
directory that is copied. The callable must return a sequence of directory
105+
and file names relative to the current directory (i.e. a subset of the items
106+
in its second argument); these names will then be ignored in the copy
107+
process. :func:`ignore_patterns` can be used to create such a callable that
108+
ignores names based on glob-style patterns.
109+
110+
If exception(s) occur, an :exc:`Error` is raised with a list of reasons.
111+
112+
The source code for this should be considered an example rather than the
113+
ultimate tool.
93114

94115

95116
.. function:: rmtree(path[, ignore_errors[, onerror]])

Doc/library/stdtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,7 @@ Files have the following methods:
20272027
files, like ttys, it makes sense to continue reading after an EOF is hit.) Note
20282028
that this method may call the underlying C function :cfunc:`fread` more than
20292029
once in an effort to acquire as close to *size* bytes as possible. Also note
2030-
that when in non-blocking mode, less data than what was requested may be
2030+
that when in non-blocking mode, less data than was requested may be
20312031
returned, even if no *size* parameter was given.
20322032

20332033

Doc/tools/sphinxext/opensearch.xml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
3-
<ShortName>Python Docs</ShortName>
4-
<LongName>Python Documentation</LongName>
5-
<Description>Search the Python documentation</Description>
6-
<InputEncoding>utf-8</InputEncoding>
7-
<Url type="text/html" method="get" template="{{ pathto('search') }}?">
8-
<Param name="q" value="{searchTerms}" />
9-
<Param name="check_keywords" value="yes" />
10-
<Param name="area" value="default" />
11-
</Url>
12-
<Image height="16" width="16" type="image/x-icon">http://www.python.org/images/favicon16x16.ico</Image>
13-
</OpenSearchDescription>
14-
1+
{% extends "!opensearch.xml" %}
2+
{% block extra -%}
3+
<Image height="16" width="16" type="image/x-icon">http://www.python.org/images/favicon16x16.ico</Image>
4+
{%- endblock %}

Doc/whatsnew/2.6.rst

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,6 +1681,11 @@ details.
16811681
available, instead of restricting itself to protocol 1.
16821682
(Contributed by W. Barnes; :issue:`1551443`.)
16831683

1684+
* The :mod:`cgi` module will now read variables from the query string of an
1685+
HTTP POST request. This makes it possible to use form actions with
1686+
URLs such as "/cgi-bin/add.py?category=1". (Contributed by
1687+
Alexandre Fiori and Nubis; :issue:`1817`.)
1688+
16841689
* The :mod:`cmath` module underwent an extensive set of revisions,
16851690
thanks to Mark Dickinson and Christian Heimes, that added some new
16861691
features and greatly improved the accuracy of the computations.
@@ -2137,6 +2142,24 @@ details.
21372142
* The :mod:`sets` module has been deprecated; it's better to
21382143
use the built-in :class:`set` and :class:`frozenset` types.
21392144

2145+
* The :func:`shutil.copytree` function now has an optional **ignore** argument
2146+
that takes a callable object. This callable will receive each directory path
2147+
and a list of the directory's contents, and returns a list of names that
2148+
will be ignored, not copied.
2149+
2150+
The :mod:`shutil` module also provides an :func:`ignore_patterns`
2151+
function for use with this new parameter.
2152+
:func:`ignore_patterns` takes an arbitrary number of glob-style patterns
2153+
and will ignore any files and directories that match this pattern.
2154+
The following example copies a directory tree, but skip both SVN's internal
2155+
:file:`.svn` directories and Emacs backup
2156+
files, which have names ending with '~'::
2157+
2158+
shutil.copytree('Doc/library', '/tmp/library',
2159+
ignore=shutil.ignore_patterns('*~', '.svn'))
2160+
2161+
(Contributed by Tarek Ziadé; :issue:`2663`.)
2162+
21402163
* Integrating signal handling with GUI handling event loops
21412164
like those used by Tkinter or GTk+ has long been a problem; most
21422165
software ends up polling, waking up every fraction of a second.
@@ -2500,9 +2523,10 @@ handle it safely::
25002523
...
25012524
ValueError: malformed string
25022525

2503-
The module also includes
2504-
:class:`NodeVisitor` and :class:`NodeTransformer` classes
2505-
for traversing and modifying an AST, and functions for common transformations such as changing line numbers.
2526+
The module also includes :class:`NodeVisitor` and
2527+
:class:`NodeTransformer` classes for traversing and modifying an AST,
2528+
and functions for common transformations such as changing line
2529+
numbers.
25062530

25072531
.. ======================================================================
25082532

Lib/curses/textpad.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Simple textbox editing widget with Emacs-like keybindings."""
22

3-
import curses, ascii
3+
import curses
4+
import curses.ascii
45

56
def rectangle(win, uly, ulx, lry, lrx):
67
"""Draw a rectangle with corners at the provided upper-left
@@ -54,7 +55,7 @@ def _end_of_line(self, y):
5455
returning the index of the last non-blank character."""
5556
last = self.maxx
5657
while True:
57-
if ascii.ascii(self.win.inch(y, last)) != ascii.SP:
58+
if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP:
5859
last = min(self.maxx, last+1)
5960
break
6061
elif last == 0:
@@ -76,20 +77,20 @@ def _insert_printable_char(self, ch):
7677
pass
7778
if self.insert_mode:
7879
(backy, backx) = self.win.getyx()
79-
if ascii.isprint(oldch):
80+
if curses.ascii.isprint(oldch):
8081
self._insert_printable_char(oldch)
8182
self.win.move(backy, backx)
8283

8384
def do_command(self, ch):
8485
"Process a single editing command."
8586
(y, x) = self.win.getyx()
8687
self.lastcmd = ch
87-
if ascii.isprint(ch):
88+
if curses.ascii.isprint(ch):
8889
if y < self.maxy or x < self.maxx:
8990
self._insert_printable_char(ch)
90-
elif ch == ascii.SOH: # ^a
91+
elif ch == curses.ascii.SOH: # ^a
9192
self.win.move(y, 0)
92-
elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE):
93+
elif ch in (curses.ascii.STX,curses.KEY_LEFT, curses.ascii.BS,curses.KEY_BACKSPACE):
9394
if x > 0:
9495
self.win.move(y, x-1)
9596
elif y == 0:
@@ -98,46 +99,46 @@ def do_command(self, ch):
9899
self.win.move(y-1, self._end_of_line(y-1))
99100
else:
100101
self.win.move(y-1, self.maxx)
101-
if ch in (ascii.BS, curses.KEY_BACKSPACE):
102+
if ch in (curses.ascii.BS, curses.KEY_BACKSPACE):
102103
self.win.delch()
103-
elif ch == ascii.EOT: # ^d
104+
elif ch == curses.ascii.EOT: # ^d
104105
self.win.delch()
105-
elif ch == ascii.ENQ: # ^e
106+
elif ch == curses.ascii.ENQ: # ^e
106107
if self.stripspaces:
107108
self.win.move(y, self._end_of_line(y))
108109
else:
109110
self.win.move(y, self.maxx)
110-
elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f
111+
elif ch in (curses.ascii.ACK, curses.KEY_RIGHT): # ^f
111112
if x < self.maxx:
112113
self.win.move(y, x+1)
113114
elif y == self.maxy:
114115
pass
115116
else:
116117
self.win.move(y+1, 0)
117-
elif ch == ascii.BEL: # ^g
118+
elif ch == curses.ascii.BEL: # ^g
118119
return 0
119-
elif ch == ascii.NL: # ^j
120+
elif ch == curses.ascii.NL: # ^j
120121
if self.maxy == 0:
121122
return 0
122123
elif y < self.maxy:
123124
self.win.move(y+1, 0)
124-
elif ch == ascii.VT: # ^k
125+
elif ch == curses.ascii.VT: # ^k
125126
if x == 0 and self._end_of_line(y) == 0:
126127
self.win.deleteln()
127128
else:
128129
# first undo the effect of self._end_of_line
129130
self.win.move(y, x)
130131
self.win.clrtoeol()
131-
elif ch == ascii.FF: # ^l
132+
elif ch == curses.ascii.FF: # ^l
132133
self.win.refresh()
133-
elif ch in (ascii.SO, curses.KEY_DOWN): # ^n
134+
elif ch in (curses.ascii.SO, curses.KEY_DOWN): # ^n
134135
if y < self.maxy:
135136
self.win.move(y+1, x)
136137
if x > self._end_of_line(y+1):
137138
self.win.move(y+1, self._end_of_line(y+1))
138-
elif ch == ascii.SI: # ^o
139+
elif ch == curses.ascii.SI: # ^o
139140
self.win.insertln()
140-
elif ch in (ascii.DLE, curses.KEY_UP): # ^p
141+
elif ch in (curses.ascii.DLE, curses.KEY_UP): # ^p
141142
if y > 0:
142143
self.win.move(y-1, x)
143144
if x > self._end_of_line(y-1):
@@ -155,7 +156,7 @@ def gather(self):
155156
for x in range(self.maxx+1):
156157
if self.stripspaces and x > stop:
157158
break
158-
result = result + chr(ascii.ascii(self.win.inch(y, x)))
159+
result = result + chr(curses.ascii.ascii(self.win.inch(y, x)))
159160
if self.maxy > 0:
160161
result = result + "\n"
161162
return result

Lib/fractions.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ def __new__(cls, numerator=0, denominator=1):
9494

9595
if denominator == 0:
9696
raise ZeroDivisionError('Fraction(%s, 0)' % numerator)
97-
98-
numerator = numerator.__index__()
99-
denominator = denominator.__index__()
97+
numerator = operator.index(numerator)
98+
denominator = operator.index(denominator)
10099
g = gcd(numerator, denominator)
101100
self._numerator = numerator // g
102101
self._denominator = denominator // g

Lib/http/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
783783
host_enc = self.host.encode("ascii")
784784
except UnicodeEncodeError:
785785
host_enc = self.host.encode("idna")
786-
if self.port == HTTP_PORT:
786+
if self.port == self.default_port:
787787
self.putheader('Host', host_enc)
788788
else:
789789
host_enc = host_enc.decode("ascii")

0 commit comments

Comments
 (0)