Python-checkins
Threads by month
- ----- 2024 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
June 2020
- 1 participants
- 402 discussions
[3.6] bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface (GH-21033) (GH-21232)
by Tapas Kundu 01 Jul '20
by Tapas Kundu 01 Jul '20
01 Jul '20
https://github.com/python/cpython/commit/cfc7ff8d05f7a949a88b8a8dd506fb5c1c…
commit: cfc7ff8d05f7a949a88b8a8dd506fb5c1c30d3e9
branch: 3.6
author: Tapas Kundu <39723251+tapakund(a)users.noreply.github.com>
committer: GitHub <noreply(a)github.com>
date: 2020-06-30T15:30:22-04:00
summary:
[3.6] bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface (GH-21033) (GH-21232)
CVE-2020-14422
The __hash__() methods of classes IPv4Interface and IPv6Interface had issue
of generating constant hash values of 32 and 128 respectively causing hash collisions.
The fix uses the hash() function to generate hash values for the objects
instead of XOR operation
(cherry picked from commit b30ee26e366bf509b7538d79bfec6c6d38d53f28)
Co-authored-by: Ravi Teja P <rvteja92(a)gmail.com>
Signed-off-by: Tapas Kundu <tkundu(a)vmware.com>
files:
A Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst
M Lib/ipaddress.py
M Lib/test/test_ipaddress.py
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index 583f02ad54275..98492136ca5f4 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -1418,7 +1418,7 @@ def __lt__(self, other):
return False
def __hash__(self):
- return self._ip ^ self._prefixlen ^ int(self.network.network_address)
+ return hash((self._ip, self._prefixlen, int(self.network.network_address)))
__reduce__ = _IPAddressBase.__reduce__
@@ -2092,7 +2092,7 @@ def __lt__(self, other):
return False
def __hash__(self):
- return self._ip ^ self._prefixlen ^ int(self.network.network_address)
+ return hash((self._ip, self._prefixlen, int(self.network.network_address)))
__reduce__ = _IPAddressBase.__reduce__
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index 1cef4217bc883..7de444af4aa57 100644
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -1990,6 +1990,17 @@ def testsixtofour(self):
sixtofouraddr.sixtofour)
self.assertFalse(bad_addr.sixtofour)
+ # issue41004 Hash collisions in IPv4Interface and IPv6Interface
+ def testV4HashIsNotConstant(self):
+ ipv4_address1 = ipaddress.IPv4Interface("1.2.3.4")
+ ipv4_address2 = ipaddress.IPv4Interface("2.3.4.5")
+ self.assertNotEqual(ipv4_address1.__hash__(), ipv4_address2.__hash__())
+
+ # issue41004 Hash collisions in IPv4Interface and IPv6Interface
+ def testV6HashIsNotConstant(self):
+ ipv6_address1 = ipaddress.IPv6Interface("2001:658:22a:cafe:200:0:0:1")
+ ipv6_address2 = ipaddress.IPv6Interface("2001:658:22a:cafe:200:0:0:2")
+ self.assertNotEqual(ipv6_address1.__hash__(), ipv6_address2.__hash__())
if __name__ == '__main__':
unittest.main()
diff --git a/Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst b/Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst
new file mode 100644
index 0000000000000..f5a9db52fff52
--- /dev/null
+++ b/Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst
@@ -0,0 +1 @@
+CVE-2020-14422: The __hash__() methods of ipaddress.IPv4Interface and ipaddress.IPv6Interface incorrectly generated constant hash values of 32 and 128 respectively. This resulted in always causing hash collisions. The fix uses hash() to generate hash values for the tuple of (address, mask length, network address).
1
0
[3.7] bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface (GH-21033) (GH-21231)
by Tapas Kundu 01 Jul '20
by Tapas Kundu 01 Jul '20
01 Jul '20
https://github.com/python/cpython/commit/b98e7790c77a4378ec4b1c71b84138cb93…
commit: b98e7790c77a4378ec4b1c71b84138cb930b69b7
branch: 3.7
author: Tapas Kundu <39723251+tapakund(a)users.noreply.github.com>
committer: GitHub <noreply(a)github.com>
date: 2020-06-30T15:20:21-04:00
summary:
[3.7] bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface (GH-21033) (GH-21231)
CVE-2020-14422
The __hash__() methods of classes IPv4Interface and IPv6Interface had issue
of generating constant hash values of 32 and 128 respectively causing hash collisions.
The fix uses the hash() function to generate hash values for the objects
instead of XOR operation
(cherry picked from commit b30ee26e366bf509b7538d79bfec6c6d38d53f28)
Co-authored-by: Ravi Teja P <rvteja92(a)gmail.com>
Signed-off-by: Tapas Kundu <tkundu(a)vmware.com>
files:
A Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst
M Lib/ipaddress.py
M Lib/test/test_ipaddress.py
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index 80249288d73ab..54882934c3dc1 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -1442,7 +1442,7 @@ def __lt__(self, other):
return False
def __hash__(self):
- return self._ip ^ self._prefixlen ^ int(self.network.network_address)
+ return hash((self._ip, self._prefixlen, int(self.network.network_address)))
__reduce__ = _IPAddressBase.__reduce__
@@ -2088,7 +2088,7 @@ def __lt__(self, other):
return False
def __hash__(self):
- return self._ip ^ self._prefixlen ^ int(self.network.network_address)
+ return hash((self._ip, self._prefixlen, int(self.network.network_address)))
__reduce__ = _IPAddressBase.__reduce__
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index 455b893fb126f..1fb6a929dc2d9 100644
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -2091,6 +2091,17 @@ def testsixtofour(self):
sixtofouraddr.sixtofour)
self.assertFalse(bad_addr.sixtofour)
+ # issue41004 Hash collisions in IPv4Interface and IPv6Interface
+ def testV4HashIsNotConstant(self):
+ ipv4_address1 = ipaddress.IPv4Interface("1.2.3.4")
+ ipv4_address2 = ipaddress.IPv4Interface("2.3.4.5")
+ self.assertNotEqual(ipv4_address1.__hash__(), ipv4_address2.__hash__())
+
+ # issue41004 Hash collisions in IPv4Interface and IPv6Interface
+ def testV6HashIsNotConstant(self):
+ ipv6_address1 = ipaddress.IPv6Interface("2001:658:22a:cafe:200:0:0:1")
+ ipv6_address2 = ipaddress.IPv6Interface("2001:658:22a:cafe:200:0:0:2")
+ self.assertNotEqual(ipv6_address1.__hash__(), ipv6_address2.__hash__())
if __name__ == '__main__':
unittest.main()
diff --git a/Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst b/Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst
new file mode 100644
index 0000000000000..f5a9db52fff52
--- /dev/null
+++ b/Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst
@@ -0,0 +1 @@
+CVE-2020-14422: The __hash__() methods of ipaddress.IPv4Interface and ipaddress.IPv6Interface incorrectly generated constant hash values of 32 and 128 respectively. This resulted in always causing hash collisions. The fix uses hash() to generate hash values for the tuple of (address, mask length, network address).
1
0
https://github.com/python/cpython/commit/1648c99932f39f1c60972bb114e6a7bd65…
commit: 1648c99932f39f1c60972bb114e6a7bd65523818
branch: master
author: Stefan Krah <skrah(a)bytereef.org>
committer: GitHub <noreply(a)github.com>
date: 2020-06-30T20:58:57+02:00
summary:
bpo-41161 Add news entry for libmpdec-2.5.0 (GH-21243)
files:
A Misc/NEWS.d/next/Library/2020-06-30-20-50-51.bpo-41161.QTdJjz.rst
diff --git a/Misc/NEWS.d/next/Library/2020-06-30-20-50-51.bpo-41161.QTdJjz.rst b/Misc/NEWS.d/next/Library/2020-06-30-20-50-51.bpo-41161.QTdJjz.rst
new file mode 100644
index 0000000000000..0d8fb521bad50
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-06-30-20-50-51.bpo-41161.QTdJjz.rst
@@ -0,0 +1,2 @@
+The decimal module now requires libmpdec-2.5.0. Users of
+--with-system-libmpdec should update their system library.
1
0
To: python-checkins(a)python.org
Subject: Python 3.8.4rc1
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
https://github.com/python/cpython/commit/6c38841c08edd6b0727903ec3f1acd10dc…
66f6
commit: 6c38841c08edd6b0727903ec3f1acd10dc9766f6
branch: 3.8
author: =C5=81ukasz Langa <lukasz(a)langa.pl>
committer: =C5=81ukasz Langa <lukasz(a)langa.pl>
date: 2020-06-30T00:30:11+02:00
summary:
Python 3.8.4rc1
files:
A Misc/NEWS.d/3.8.4rc1.rst
D Misc/NEWS.d/next/Build/2020-05-17-03-33-00.bpo-40653.WI8UGn.rst
D Misc/NEWS.d/next/Build/2020-06-25-06-59-13.bpo-40204.GpD04D.rst
D Misc/NEWS.d/next/Core and Builtins/2020-05-17-20-38-12.bpo-40663.u2aiZf.rst
D Misc/NEWS.d/next/Core and Builtins/2020-05-30-14-37-18.bpo-40824.XR3V5s.rst
D Misc/NEWS.d/next/Core and Builtins/2020-06-01-20-31-07.bpo-40826.XCI4M2.rst
D Misc/NEWS.d/next/Core and Builtins/2020-06-05-12-48-28.bpo-40870.9cd2sk.rst
D Misc/NEWS.d/next/Core and Builtins/2020-06-12-12-21-54.bpo-40957.Z8n6I6.rst
D Misc/NEWS.d/next/Core and Builtins/2020-06-20-17-21-07.bpo-35975.UDHCHp.rst
D Misc/NEWS.d/next/Core and Builtins/2020-06-21-19-53-33.bpo-41056.IDu_EK.rst
D Misc/NEWS.d/next/Core and Builtins/2020-06-23-23-26-42.bpo-41094.zEIJse.rst
D Misc/NEWS.d/next/IDLE/2020-05-24-06-19-43.bpo-40723.AJLd4U.rst
D Misc/NEWS.d/next/IDLE/2020-05-29-18-21-58.bpo-39885.zB_-bN.rst
D Misc/NEWS.d/next/IDLE/2020-06-27-17-02-00.bpo-41144.JoFGIX.rst
D Misc/NEWS.d/next/Library/2018-07-29-12-14-54.bpo-34226.BE7zbu.rst
D Misc/NEWS.d/next/Library/2018-08-21-16-20-33.bpo-29620.xxx666.rst
D Misc/NEWS.d/next/Library/2019-03-17-19-01-53.bpo-36290.7VXo_K.rst
D Misc/NEWS.d/next/Library/2019-10-25-23-45-49.bpo-35714.fw3xb7.rst
D Misc/NEWS.d/next/Library/2019-12-15-18-47-20.bpo-39040.tKa0Qs.rst
D Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst
D Misc/NEWS.d/next/Library/2020-03-21-05-26-38.bpo-40025.DTLtyq.rst
D Misc/NEWS.d/next/Library/2020-03-23-05-21-13.bpo-39830.IkqU1Y.rst
D Misc/NEWS.d/next/Library/2020-05-02-17-17-37.bpo-40457.EXReI1.rst
D Misc/NEWS.d/next/Library/2020-05-06-02-01-25.bpo-13097.Wh5xSK.rst
D Misc/NEWS.d/next/Library/2020-05-06-13-51-19.bpo-40515.TUCvYB.rst
D Misc/NEWS.d/next/Library/2020-05-11-19-17-23.bpo-40597.4SGfgm.rst
D Misc/NEWS.d/next/Library/2020-05-14-13-25-36.bpo-25872.5D5538.rst
D Misc/NEWS.d/next/Library/2020-05-18-17-29-30.bpo-40626.NeZufF.rst
D Misc/NEWS.d/next/Library/2020-05-18-22-41-02.bpo-40614.8j3kmq.rst
D Misc/NEWS.d/next/Library/2020-05-25-22-18-38.bpo-30008.CKC3td.rst
D Misc/NEWS.d/next/Library/2020-05-27-17-00-18.bpo-40795.eZSnHA.rst
D Misc/NEWS.d/next/Library/2020-05-27-21-27-01.bpo-40767.L5MnVV.rst
D Misc/NEWS.d/next/Library/2020-05-28-16-51-00.bpo-38488.hFQNgA.rst
D Misc/NEWS.d/next/Library/2020-05-31-15-52-18.bpo-40834.MO9_hb.rst
D Misc/NEWS.d/next/Library/2020-06-04-16-25-15.bpo-40807.yYyLWx.rst
D Misc/NEWS.d/next/Library/2020-06-12-10-44-15.bpo-40855.jSot83.rst
D Misc/NEWS.d/next/Library/2020-06-15-12-22-53.bpo-40448.1dk8Bu.rst
D Misc/NEWS.d/next/Library/2020-06-20-10-16-57.bpo-41048.hEXB-B.rst
D Misc/NEWS.d/next/Library/2020-06-20-18-35-43.bpo-41056.Garcle.rst
D Misc/NEWS.d/next/Library/2020-06-20-21-03-55.bpo-41058.gztdZy.rst
D Misc/NEWS.d/next/Library/2020-06-22-10-25-39.bpo-41068._bX2BW.rst
D Misc/NEWS.d/next/Library/2020-06-22-20-08-40.bpo-31938.EVuko9.rst
D Misc/NEWS.d/next/Library/2020-06-27-13-51-36.bpo-41138.bIpf7g.rst
D Misc/NEWS.d/next/Security/2020-03-15-01-28-36.bpo-39073.6Szd3i.rst
D Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst
D Misc/NEWS.d/next/Tests/2018-08-20-09-38-52.bpo-34401.eGxMPm.rst
D Misc/NEWS.d/next/Tests/2020-05-15-01-21-44.bpo-40055.Xp4aP9.rst
D Misc/NEWS.d/next/Tests/2020-06-12-20-46-23.bpo-40964.OBzf2c.rst
D Misc/NEWS.d/next/Tests/2020-06-17-15-07-14.bpo-41003.tiH_Fy.rst
D Misc/NEWS.d/next/Tests/2020-06-17-17-27-07.bpo-41009.Rvn6OQ.rst
D Misc/NEWS.d/next/Tests/2020-06-17-18-00-21.bpo-38377.jfg4TH.rst
D Misc/NEWS.d/next/Tests/2020-06-23-12-02-45.bpo-41085.JZKsyz.rst
D Misc/NEWS.d/next/Tools-Demos/2020-04-03-08-32-31.bpo-40163.lX8K4B.rst
D Misc/NEWS.d/next/Tools-Demos/2020-05-15-17-48-25.bpo-40479.B1gBl-.rst
D Misc/NEWS.d/next/Windows/2020-03-23-19-07-55.bpo-39148.W1YJEb.rst
D Misc/NEWS.d/next/Windows/2020-05-17-00-08-13.bpo-40650.4euMtU.rst
D Misc/NEWS.d/next/Windows/2020-05-19-04-11-12.bpo-40677.qQbLW8.rst
D Misc/NEWS.d/next/Windows/2020-05-19-14-43-33.bpo-39631.Z5yXam.rst
D Misc/NEWS.d/next/Windows/2020-06-12-13-13-44.bpo-40164.SPrSn5.rst
D Misc/NEWS.d/next/Windows/2020-06-24-21-30-42.bpo-41074.gaQc3C.rst
D Misc/NEWS.d/next/macOS/2020-06-07-20-10-56.bpo-40741.80A2BW.rst
D Misc/NEWS.d/next/macOS/2020-06-17-13-45-15.bpo-41005.zZegdV.rst
D Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
D Misc/NEWS.d/next/macOS/2020-06-25-06-09-00.bpo-39580.N_vJ9h.rst
M Include/patchlevel.h
M Lib/pydoc_data/topics.py
M README.rst
diff --git a/Include/patchlevel.h b/Include/patchlevel.h
index e179252a35dce..ae867d4daf159 100644
--- a/Include/patchlevel.h
+++ b/Include/patchlevel.h
@@ -18,12 +18,12 @@
/*--start constants--*/
#define PY_MAJOR_VERSION 3
#define PY_MINOR_VERSION 8
-#define PY_MICRO_VERSION 3
-#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
-#define PY_RELEASE_SERIAL 0
+#define PY_MICRO_VERSION 4
+#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA
+#define PY_RELEASE_SERIAL 1
=20
/* Version as a string */
-#define PY_VERSION "3.8.3+"
+#define PY_VERSION "3.8.4rc1"
/*--end constants--*/
=20
/* Version as a single 4-byte hex number, e.g. 0x010502B2 =3D=3D 1.5.2b2.
diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py
index 06f0e781772f8..0320964e5cf5f 100644
--- a/Lib/pydoc_data/topics.py
+++ b/Lib/pydoc_data/topics.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Autogenerated by Sphinx on Wed May 13 19:29:27 2020
+# Autogenerated by Sphinx on Mon Jun 29 22:24:24 2020
topics =3D {'assert': 'The "assert" statement\n'
'**********************\n'
'\n'
@@ -4284,7 +4284,8 @@
' the current environment).\n'
'\n'
'retval\n'
- 'Print the return value for the last return of a function.\n'
+ '\n'
+ ' Print the return value for the last return of a function.\n'
'\n'
'-[ Footnotes ]-\n'
'\n'
@@ -6037,8 +6038,8 @@
'\n'
'A non-normative HTML file listing all valid identifier '
'characters for\n'
- 'Unicode 4.1 can be found at https://www.dcl.hpi.uni-\n'
- 'potsdam.de/home/loewis/table-3131.html.\n'
+ 'Unicode 4.1 can be found at\n'
+ 'https://www.unicode.org/Public/13.0.0/ucd/DerivedCoreProper=
ties.txt\n'
'\n'
'\n'
'Keywords\n'
diff --git a/Misc/NEWS.d/3.8.4rc1.rst b/Misc/NEWS.d/3.8.4rc1.rst
new file mode 100644
index 0000000000000..1f7cb9620040a
--- /dev/null
+++ b/Misc/NEWS.d/3.8.4rc1.rst
@@ -0,0 +1,637 @@
+.. bpo: 41004
+.. date: 2020-06-29-16-02-29
+.. nonce: ovF0KZ
+.. release date: 2020-06-29
+.. section: Security
+
+The __hash__() methods of ipaddress.IPv4Interface and
+ipaddress.IPv6Interface incorrectly generated constant hash values of 32 and
+128 respectively. This resulted in always causing hash collisions. The fix
+uses hash() to generate hash values for the tuple of (address, mask length,
+network address).
+
+..
+
+.. bpo: 39073
+.. date: 2020-03-15-01-28-36
+.. nonce: 6Szd3i
+.. section: Security
+
+Disallow CR or LF in email.headerregistry.Address arguments to guard against
+header injection attacks.
+
+..
+
+.. bpo: 41094
+.. date: 2020-06-23-23-26-42
+.. nonce: zEIJse
+.. section: Core and Builtins
+
+Fix decoding errors with audit when open files with non-ASCII names on
+non-UTF-8 locale.
+
+..
+
+.. bpo: 41056
+.. date: 2020-06-21-19-53-33
+.. nonce: IDu_EK
+.. section: Core and Builtins
+
+Fixes a reference to deallocated stack space during startup when
+constructing sys.path involving a relative symlink when code was supplied
+via -c. (discovered via Coverity)
+
+..
+
+.. bpo: 35975
+.. date: 2020-06-20-17-21-07
+.. nonce: UDHCHp
+.. section: Core and Builtins
+
+Stefan Behnel reported that cf_feature_version is used even when
+PyCF_ONLY_AST is not set. This is against the intention and against the
+documented behavior, so it's been fixed.
+
+..
+
+.. bpo: 40957
+.. date: 2020-06-12-12-21-54
+.. nonce: Z8n6I6
+.. section: Core and Builtins
+
+Fix refleak in _Py_fopen_obj() when PySys_Audit() fails
+
+..
+
+.. bpo: 40870
+.. date: 2020-06-05-12-48-28
+.. nonce: 9cd2sk
+.. section: Core and Builtins
+
+Raise :exc:`ValueError` when validating custom AST's where the constants
+``True``, ``False`` and ``None`` are used within a :class:`ast.Name` node.
+
+..
+
+.. bpo: 40826
+.. date: 2020-06-01-20-31-07
+.. nonce: XCI4M2
+.. section: Core and Builtins
+
+Fix GIL usage in :c:func:`PyOS_Readline`: lock the GIL to set an exception
+and pass the Python thread state when checking if there is a pending signal.
+
+..
+
+.. bpo: 40824
+.. date: 2020-05-30-14-37-18
+.. nonce: XR3V5s
+.. section: Core and Builtins
+
+Unexpected errors in calling the ``__iter__`` method are no longer masked by
+``TypeError`` in the :keyword:`in` operator and functions
+:func:`~operator.contains`, :func:`~operator.indexOf` and
+:func:`~operator.countOf` of the :mod:`operator` module.
+
+..
+
+.. bpo: 40663
+.. date: 2020-05-17-20-38-12
+.. nonce: u2aiZf
+.. section: Core and Builtins
+
+Correctly generate annotations where parentheses are omitted but required
+(e.g: ``Type[(str, int, *other))]``.
+
+..
+
+.. bpo: 41138
+.. date: 2020-06-27-13-51-36
+.. nonce: bIpf7g
+.. section: Library
+
+Fixed the :mod:`trace` module CLI for Python source files with non-UTF-8
+encoding.
+
+..
+
+.. bpo: 31938
+.. date: 2020-06-22-20-08-40
+.. nonce: EVuko9
+.. section: Library
+
+Fix default-value signatures of several functions in the :mod:`select`
+module - by Anthony Sottile.
+
+..
+
+.. bpo: 41068
+.. date: 2020-06-22-10-25-39
+.. nonce: _bX2BW
+.. section: Library
+
+Fixed reading files with non-ASCII names from ZIP archive directly after
+writing them.
+
+..
+
+.. bpo: 41058
+.. date: 2020-06-20-21-03-55
+.. nonce: gztdZy
+.. section: Library
+
+:func:`pdb.find_function` now correctly determines the source file encoding.
+
+..
+
+.. bpo: 41056
+.. date: 2020-06-20-18-35-43
+.. nonce: Garcle
+.. section: Library
+
+Fix a NULL pointer dereference within the ssl module during a MemoryError in
+the keylog callback. (discovered by Coverity)
+
+..
+
+.. bpo: 41048
+.. date: 2020-06-20-10-16-57
+.. nonce: hEXB-B
+.. section: Library
+
+:func:`mimetypes.read_mime_types` function reads the rule file using UTF-8
+encoding, not the locale encoding. Patch by Srinivas Reddy Thatiparthy.
+
+..
+
+.. bpo: 40448
+.. date: 2020-06-15-12-22-53
+.. nonce: 1dk8Bu
+.. section: Library
+
+:mod:`ensurepip` now disables the use of `pip` cache when installing the
+bundled versions of `pip` and `setuptools`. Patch by Krzysztof Konopko.
+
+..
+
+.. bpo: 40855
+.. date: 2020-06-12-10-44-15
+.. nonce: jSot83
+.. section: Library
+
+The standard deviation and variance functions in the statistics module were
+ignoring their mu and xbar arguments.
+
+..
+
+.. bpo: 40807
+.. date: 2020-06-04-16-25-15
+.. nonce: yYyLWx
+.. section: Library
+
+Stop codeop._maybe_compile, used by code.InteractiveInterpreter (and IDLE).
+from from emitting each warning three times.
+
+..
+
+.. bpo: 40834
+.. date: 2020-05-31-15-52-18
+.. nonce: MO9_hb
+.. section: Library
+
+Fix truncate when sending str object with_xxsubinterpreters.channel_send.
+
+..
+
+.. bpo: 38488
+.. date: 2020-05-28-16-51-00
+.. nonce: hFQNgA
+.. section: Library
+
+Update ensurepip to install pip 20.1.1 and setuptools 47.1.0.
+
+..
+
+.. bpo: 40767
+.. date: 2020-05-27-21-27-01
+.. nonce: L5MnVV
+.. section: Library
+
+:mod:`webbrowser` now properly finds the default browser in pure Wayland
+systems by checking the WAYLAND_DISPLAY environment variable. Patch
+contributed by J=C3=A9r=C3=A9my Attali.
+
+..
+
+.. bpo: 40795
+.. date: 2020-05-27-17-00-18
+.. nonce: eZSnHA
+.. section: Library
+
+:mod:`ctypes` module: If ctypes fails to convert the result of a callback or
+if a ctypes callback function raises an exception, sys.unraisablehook is now
+called with an exception set. Previously, the error was logged into stderr
+by :c:func:`PyErr_Print`.
+
+..
+
+.. bpo: 30008
+.. date: 2020-05-25-22-18-38
+.. nonce: CKC3td
+.. section: Library
+
+Fix :mod:`ssl` code to be compatible with OpenSSL 1.1.x builds that use
+``no-deprecated`` and ``--api=3D1.1.0``.
+
+..
+
+.. bpo: 40614
+.. date: 2020-05-18-22-41-02
+.. nonce: 8j3kmq
+.. section: Library
+
+:func:`ast.parse` will not parse self documenting expressions in f-strings
+when passed ``feature_version`` is less than ``(3, 8)``.
+
+..
+
+.. bpo: 40626
+.. date: 2020-05-18-17-29-30
+.. nonce: NeZufF
+.. section: Library
+
+Add h5 file extension as MIME Type application/x-hdf5, as per HDF Group
+recommendation for HDF5 formatted data files. Patch contributed by Mark
+Schwab.
+
+..
+
+.. bpo: 25872
+.. date: 2020-05-14-13-25-36
+.. nonce: 5D5538
+.. section: Library
+
+:mod:`linecache` could crash with a :exc:`KeyError` when accessed from
+multiple threads. Fix by Michael Graczyk.
+
+..
+
+.. bpo: 40597
+.. date: 2020-05-11-19-17-23
+.. nonce: 4SGfgm
+.. section: Library
+
+If text content lines are longer than policy.max_line_length, always use a
+content-encoding to make sure they are wrapped.
+
+..
+
+.. bpo: 40515
+.. date: 2020-05-06-13-51-19
+.. nonce: TUCvYB
+.. section: Library
+
+The :mod:`ssl` and :mod:`hashlib` modules now actively check that OpenSSL is
+build with thread support. Python 3.7.0 made thread support mandatory and no
+longer works safely with a no-thread builds.
+
+..
+
+.. bpo: 13097
+.. date: 2020-05-06-02-01-25
+.. nonce: Wh5xSK
+.. section: Library
+
+``ctypes`` now raises an ``ArgumentError`` when a callback is invoked with
+more than 1024 arguments.
+
+..
+
+.. bpo: 40457
+.. date: 2020-05-02-17-17-37
+.. nonce: EXReI1
+.. section: Library
+
+The ssl module now support OpenSSL builds without TLS 1.0 and 1.1 methods.
+
+..
+
+.. bpo: 39830
+.. date: 2020-03-23-05-21-13
+.. nonce: IkqU1Y
+.. section: Library
+
+Add :class:`zipfile.Path` to ``__all__`` in the :mod:`zipfile` module.
+
+..
+
+.. bpo: 40025
+.. date: 2020-03-21-05-26-38
+.. nonce: DTLtyq
+.. section: Library
+
+Raise TypeError when _generate_next_value_ is defined after members. Patch
+by Ethan Onstott.
+
+..
+
+.. bpo: 39244
+.. date: 2020-02-23-15-09-47
+.. nonce: aBK5IM
+.. section: Library
+
+Fixed :class:`multiprocessing.context.get_all_start_methods` to properly
+return the default method first on macOS.
+
+..
+
+.. bpo: 39040
+.. date: 2019-12-15-18-47-20
+.. nonce: tKa0Qs
+.. section: Library
+
+Fix parsing of invalid mime headers parameters by collapsing whitespace
+between encoded words in a bare-quote-string.
+
+..
+
+.. bpo: 35714
+.. date: 2019-10-25-23-45-49
+.. nonce: fw3xb7
+.. section: Library
+
+:exc:`struct.error` is now raised if there is a null character in a
+:mod:`struct` format string.
+
+..
+
+.. bpo: 36290
+.. date: 2019-03-17-19-01-53
+.. nonce: 7VXo_K
+.. section: Library
+
+AST nodes are now raising :exc:`TypeError` on conflicting keyword arguments.
+Patch contributed by R=C3=A9mi Lapeyre.
+
+..
+
+.. bpo: 29620
+.. date: 2018-08-21-16-20-33
+.. nonce: xxx666
+.. section: Library
+
+:func:`~unittest.TestCase.assertWarns` no longer raises a
+``RuntimeException`` when accessing a module's ``__warningregistry__``
+causes importation of a new module, or when a new module is imported in
+another thread. Patch by Kernc.
+
+..
+
+.. bpo: 34226
+.. date: 2018-07-29-12-14-54
+.. nonce: BE7zbu
+.. section: Library
+
+Fix `cgi.parse_multipart` without content_length. Patch by Roger Duran
+
+..
+
+.. bpo: 41085
+.. date: 2020-06-23-12-02-45
+.. nonce: JZKsyz
+.. section: Tests
+
+Fix integer overflow in the :meth:`array.array.index` method on 64-bit
+Windows for index larger than ``2**31``.
+
+..
+
+.. bpo: 38377
+.. date: 2020-06-17-18-00-21
+.. nonce: jfg4TH
+.. section: Tests
+
+On Linux, skip tests using multiprocessing if the current user cannot create
+a file in ``/dev/shm/`` directory. Add the
+:func:`~test.support.skip_if_broken_multiprocessing_synchronize` function to
+the :mod:`test.support` module.
+
+..
+
+.. bpo: 41009
+.. date: 2020-06-17-17-27-07
+.. nonce: Rvn6OQ
+.. section: Tests
+
+Fix use of ``support.require_{linux|mac|freebsd}_version()`` decorators as
+class decorator.
+
+..
+
+.. bpo: 41003
+.. date: 2020-06-17-15-07-14
+.. nonce: tiH_Fy
+.. section: Tests
+
+Fix ``test_copyreg`` when ``numpy`` is installed: ``test.pickletester`` now
+saves/restores warnings filters when importing ``numpy``, to ignore filters
+installed by ``numpy``.
+
+..
+
+.. bpo: 40964
+.. date: 2020-06-12-20-46-23
+.. nonce: OBzf2c
+.. section: Tests
+
+Disable remote :mod:`imaplib` tests, host cyrus.andrew.cmu.edu is blocking
+incoming connections.
+
+..
+
+.. bpo: 40055
+.. date: 2020-05-15-01-21-44
+.. nonce: Xp4aP9
+.. section: Tests
+
+distutils.tests now saves/restores warnings filters to leave them unchanged.
+Importing tests imports docutils which imports pkg_resources which adds a
+warnings filter.
+
+..
+
+.. bpo: 34401
+.. date: 2018-08-20-09-38-52
+.. nonce: eGxMPm
+.. section: Tests
+
+Make test_gdb properly run on HP-UX. Patch by Michael Osipov.
+
+..
+
+.. bpo: 40204
+.. date: 2020-06-25-06-59-13
+.. nonce: GpD04D
+.. section: Build
+
+Pin Sphinx version to 2.3.1 in ``Doc/Makefile``.
+
+..
+
+.. bpo: 40653
+.. date: 2020-05-17-03-33-00
+.. nonce: WI8UGn
+.. section: Build
+
+Move _dirnameW out of HAVE_SYMLINK to fix a potential compiling issue.
+
+..
+
+.. bpo: 41074
+.. date: 2020-06-24-21-30-42
+.. nonce: gaQc3C
+.. section: Windows
+
+Fixed support of non-ASCII names in functions :func:`msilib.OpenDatabase`
+and :func:`msilib.init_database` and non-ASCII SQL in method
+:meth:`msilib.Database.OpenView`.
+
+..
+
+.. bpo: 40164
+.. date: 2020-06-12-13-13-44
+.. nonce: SPrSn5
+.. section: Windows
+
+Updates Windows OpenSSL to 1.1.1g
+
+..
+
+.. bpo: 39631
+.. date: 2020-05-19-14-43-33
+.. nonce: Z5yXam
+.. section: Windows
+
+Changes the registered MIME type for ``.py`` files on Windows to
+``text/x-python`` instead of ``text/plain``.
+
+..
+
+.. bpo: 40677
+.. date: 2020-05-19-04-11-12
+.. nonce: qQbLW8
+.. section: Windows
+
+Manually define IO_REPARSE_TAG_APPEXECLINK in case some old Windows SDK
+doesn't have it.
+
+..
+
+.. bpo: 40650
+.. date: 2020-05-17-00-08-13
+.. nonce: 4euMtU
+.. section: Windows
+
+Include winsock2.h in pytime.c for timeval.
+
+..
+
+.. bpo: 39148
+.. date: 2020-03-23-19-07-55
+.. nonce: W1YJEb
+.. section: Windows
+
+Add IPv6 support to :mod:`asyncio` datagram endpoints in ProactorEventLoop.
+Change the raised exception for unknown address families to ValueError as
+it's not coming from Windows API.
+
+..
+
+.. bpo: 39580
+.. date: 2020-06-25-06-09-00
+.. nonce: N_vJ9h
+.. section: macOS
+
+Avoid opening Finder window if running installer from the command line.
+Patch contributed by Rick Heil.
+
+..
+
+.. bpo: 41100
+.. date: 2020-06-24-13-51-57
+.. nonce: mcHdc5
+.. section: macOS
+
+Fix configure error when building on macOS 11. Note that the current Python
+release was released shortly after the first developer preview of macOS 11
+(Big Sur); there are other known issues with building and running on the
+developer preview. Big Sur is expected to be fully supported in a future
+bugfix release of Python 3.8.x and with 3.9.0.
+
+..
+
+.. bpo: 41005
+.. date: 2020-06-17-13-45-15
+.. nonce: zZegdV
+.. section: macOS
+
+fixed an XDG settings issue not allowing macos to open browser in
+webbrowser.py
+
+..
+
+.. bpo: 40741
+.. date: 2020-06-07-20-10-56
+.. nonce: 80A2BW
+.. section: macOS
+
+Update macOS installer to use SQLite 3.32.2.
+
+..
+
+.. bpo: 41144
+.. date: 2020-06-27-17-02-00
+.. nonce: JoFGIX
+.. section: IDLE
+
+Make Open Module open a special module such as os.path.
+
+..
+
+.. bpo: 39885
+.. date: 2020-05-29-18-21-58
+.. nonce: zB_-bN
+.. section: IDLE
+
+Make context menu Cut and Copy work again when right-clicking within a
+selection.
+
+..
+
+.. bpo: 40723
+.. date: 2020-05-24-06-19-43
+.. nonce: AJLd4U
+.. section: IDLE
+
+Make test_idle pass when run after import.
+
+..
+
+.. bpo: 40479
+.. date: 2020-05-15-17-48-25
+.. nonce: B1gBl-
+.. section: Tools/Demos
+
+Update multissltest helper to test with latest OpenSSL 1.0.2, 1.1.0, 1.1.1,
+and 3.0.0-alpha.
+
+..
+
+.. bpo: 40163
+.. date: 2020-04-03-08-32-31
+.. nonce: lX8K4B
+.. section: Tools/Demos
+
+Fix multissltest tool. OpenSSL has changed download URL for old releases.
+The multissltest tool now tries to download from current and old download
+URLs.
diff --git a/Misc/NEWS.d/next/Build/2020-05-17-03-33-00.bpo-40653.WI8UGn.rst =
b/Misc/NEWS.d/next/Build/2020-05-17-03-33-00.bpo-40653.WI8UGn.rst
deleted file mode 100644
index 1e6c5cb32b722..0000000000000
--- a/Misc/NEWS.d/next/Build/2020-05-17-03-33-00.bpo-40653.WI8UGn.rst
+++ /dev/null
@@ -1 +0,0 @@
-Move _dirnameW out of HAVE_SYMLINK to fix a potential compiling issue.
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Build/2020-06-25-06-59-13.bpo-40204.GpD04D.rst =
b/Misc/NEWS.d/next/Build/2020-06-25-06-59-13.bpo-40204.GpD04D.rst
deleted file mode 100644
index 25a6d751e5f45..0000000000000
--- a/Misc/NEWS.d/next/Build/2020-06-25-06-59-13.bpo-40204.GpD04D.rst
+++ /dev/null
@@ -1 +0,0 @@
-Pin Sphinx version to 2.3.1 in ``Doc/Makefile``.
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-17-20-38-12.bpo-40663=
.u2aiZf.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-17-20-38-12.bpo-4066=
3.u2aiZf.rst
deleted file mode 100644
index 5041abc7e3eaa..0000000000000
--- a/Misc/NEWS.d/next/Core and Builtins/2020-05-17-20-38-12.bpo-40663.u2aiZf=
.rst=09
+++ /dev/null
@@ -1,2 +0,0 @@
-Correctly generate annotations where parentheses are omitted but required
-(e.g: ``Type[(str, int, *other))]``.
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-30-14-37-18.bpo-40824=
.XR3V5s.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-30-14-37-18.bpo-4082=
4.XR3V5s.rst
deleted file mode 100644
index 73c593c04a0da..0000000000000
--- a/Misc/NEWS.d/next/Core and Builtins/2020-05-30-14-37-18.bpo-40824.XR3V5s=
.rst=09
+++ /dev/null
@@ -1,4 +0,0 @@
-Unexpected errors in calling the ``__iter__`` method are no longer masked by
-``TypeError`` in the :keyword:`in` operator and functions
-:func:`~operator.contains`, :func:`~operator.indexOf` and
-:func:`~operator.countOf` of the :mod:`operator` module.
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-01-20-31-07.bpo-40826=
.XCI4M2.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-01-20-31-07.bpo-4082=
6.XCI4M2.rst
deleted file mode 100644
index a03ed180eb952..0000000000000
--- a/Misc/NEWS.d/next/Core and Builtins/2020-06-01-20-31-07.bpo-40826.XCI4M2=
.rst=09
+++ /dev/null
@@ -1,2 +0,0 @@
-Fix GIL usage in :c:func:`PyOS_Readline`: lock the GIL to set an exception
-and pass the Python thread state when checking if there is a pending signal.
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-05-12-48-28.bpo-40870=
.9cd2sk.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-05-12-48-28.bpo-4087=
0.9cd2sk.rst
deleted file mode 100644
index 8e943a29f337f..0000000000000
--- a/Misc/NEWS.d/next/Core and Builtins/2020-06-05-12-48-28.bpo-40870.9cd2sk=
.rst=09
+++ /dev/null
@@ -1,2 +0,0 @@
-Raise :exc:`ValueError` when validating custom AST's where the constants
-``True``, ``False`` and ``None`` are used within a :class:`ast.Name` node.
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-12-12-21-54.bpo-40957=
.Z8n6I6.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-12-12-21-54.bpo-4095=
7.Z8n6I6.rst
deleted file mode 100644
index f99c374f94aac..0000000000000
--- a/Misc/NEWS.d/next/Core and Builtins/2020-06-12-12-21-54.bpo-40957.Z8n6I6=
.rst=09
+++ /dev/null
@@ -1 +0,0 @@
-Fix refleak in _Py_fopen_obj() when PySys_Audit() fails
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-20-17-21-07.bpo-35975=
.UDHCHp.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-20-17-21-07.bpo-3597=
5.UDHCHp.rst
deleted file mode 100644
index 73f4a6da2e5c0..0000000000000
--- a/Misc/NEWS.d/next/Core and Builtins/2020-06-20-17-21-07.bpo-35975.UDHCHp=
.rst=09
+++ /dev/null
@@ -1,3 +0,0 @@
-Stefan Behnel reported that cf_feature_version is used even when
-PyCF_ONLY_AST is not set. This is against the intention and against the
-documented behavior, so it's been fixed.
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-21-19-53-33.bpo-41056=
.IDu_EK.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-21-19-53-33.bpo-4105=
6.IDu_EK.rst
deleted file mode 100644
index 25f93c9da3105..0000000000000
--- a/Misc/NEWS.d/next/Core and Builtins/2020-06-21-19-53-33.bpo-41056.IDu_EK=
.rst=09
+++ /dev/null
@@ -1 +0,0 @@
-Fixes a reference to deallocated stack space during startup when constructin=
g sys.path involving a relative symlink when code was supplied via -c. (disc=
overed via Coverity)
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-23-23-26-42.bpo-41094=
.zEIJse.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-23-23-26-42.bpo-4109=
4.zEIJse.rst
deleted file mode 100644
index 6dd45e21d1758..0000000000000
--- a/Misc/NEWS.d/next/Core and Builtins/2020-06-23-23-26-42.bpo-41094.zEIJse=
.rst=09
+++ /dev/null
@@ -1,2 +0,0 @@
-Fix decoding errors with audit when open files with non-ASCII names on non-U=
TF-8
-locale.
diff --git a/Misc/NEWS.d/next/IDLE/2020-05-24-06-19-43.bpo-40723.AJLd4U.rst b=
/Misc/NEWS.d/next/IDLE/2020-05-24-06-19-43.bpo-40723.AJLd4U.rst
deleted file mode 100644
index e0de2f9d83668..0000000000000
--- a/Misc/NEWS.d/next/IDLE/2020-05-24-06-19-43.bpo-40723.AJLd4U.rst
+++ /dev/null
@@ -1 +0,0 @@
-Make test_idle pass when run after import.
diff --git a/Misc/NEWS.d/next/IDLE/2020-05-29-18-21-58.bpo-39885.zB_-bN.rst b=
/Misc/NEWS.d/next/IDLE/2020-05-29-18-21-58.bpo-39885.zB_-bN.rst
deleted file mode 100644
index a847b75997117..0000000000000
--- a/Misc/NEWS.d/next/IDLE/2020-05-29-18-21-58.bpo-39885.zB_-bN.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Make context menu Cut and Copy work again when right-clicking within a
-selection.
diff --git a/Misc/NEWS.d/next/IDLE/2020-06-27-17-02-00.bpo-41144.JoFGIX.rst b=
/Misc/NEWS.d/next/IDLE/2020-06-27-17-02-00.bpo-41144.JoFGIX.rst
deleted file mode 100644
index ed558d3e7ded1..0000000000000
--- a/Misc/NEWS.d/next/IDLE/2020-06-27-17-02-00.bpo-41144.JoFGIX.rst
+++ /dev/null
@@ -1 +0,0 @@
-Make Open Module open a special module such as os.path.
diff --git a/Misc/NEWS.d/next/Library/2018-07-29-12-14-54.bpo-34226.BE7zbu.rs=
t b/Misc/NEWS.d/next/Library/2018-07-29-12-14-54.bpo-34226.BE7zbu.rst
deleted file mode 100644
index 2656b4bf22ae4..0000000000000
--- a/Misc/NEWS.d/next/Library/2018-07-29-12-14-54.bpo-34226.BE7zbu.rst
+++ /dev/null
@@ -1 +0,0 @@
-Fix `cgi.parse_multipart` without content_length. Patch by Roger Duran
diff --git a/Misc/NEWS.d/next/Library/2018-08-21-16-20-33.bpo-29620.xxx666.rs=
t b/Misc/NEWS.d/next/Library/2018-08-21-16-20-33.bpo-29620.xxx666.rst
deleted file mode 100644
index d781919504e68..0000000000000
--- a/Misc/NEWS.d/next/Library/2018-08-21-16-20-33.bpo-29620.xxx666.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-:func:`~unittest.TestCase.assertWarns` no longer raises a ``RuntimeException=
``
-when accessing a module's ``__warningregistry__`` causes importation of a new
-module, or when a new module is imported in another thread. Patch by Kernc.
diff --git a/Misc/NEWS.d/next/Library/2019-03-17-19-01-53.bpo-36290.7VXo_K.rs=
t b/Misc/NEWS.d/next/Library/2019-03-17-19-01-53.bpo-36290.7VXo_K.rst
deleted file mode 100644
index a9afe62b0c46e..0000000000000
--- a/Misc/NEWS.d/next/Library/2019-03-17-19-01-53.bpo-36290.7VXo_K.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-AST nodes are now raising :exc:`TypeError` on conflicting keyword arguments.
-Patch contributed by R=C3=A9mi Lapeyre.
diff --git a/Misc/NEWS.d/next/Library/2019-10-25-23-45-49.bpo-35714.fw3xb7.rs=
t b/Misc/NEWS.d/next/Library/2019-10-25-23-45-49.bpo-35714.fw3xb7.rst
deleted file mode 100644
index 39102065ca7b5..0000000000000
--- a/Misc/NEWS.d/next/Library/2019-10-25-23-45-49.bpo-35714.fw3xb7.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-:exc:`struct.error` is now raised if there is a null character in a
-:mod:`struct` format string.
diff --git a/Misc/NEWS.d/next/Library/2019-12-15-18-47-20.bpo-39040.tKa0Qs.rs=
t b/Misc/NEWS.d/next/Library/2019-12-15-18-47-20.bpo-39040.tKa0Qs.rst
deleted file mode 100644
index 078bce22be30f..0000000000000
--- a/Misc/NEWS.d/next/Library/2019-12-15-18-47-20.bpo-39040.tKa0Qs.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Fix parsing of invalid mime headers parameters by collapsing whitespace betw=
een
-encoded words in a bare-quote-string.
diff --git a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rs=
t b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst
deleted file mode 100644
index c7d8e0de676b5..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Fixed :class:`multiprocessing.context.get_all_start_methods`
-to properly return the default method first on macOS.
diff --git a/Misc/NEWS.d/next/Library/2020-03-21-05-26-38.bpo-40025.DTLtyq.rs=
t b/Misc/NEWS.d/next/Library/2020-03-21-05-26-38.bpo-40025.DTLtyq.rst
deleted file mode 100644
index 7b699de4e0726..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-03-21-05-26-38.bpo-40025.DTLtyq.rst
+++ /dev/null
@@ -1 +0,0 @@
-Raise TypeError when _generate_next_value_ is defined after members. Patch b=
y Ethan Onstott.
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Library/2020-03-23-05-21-13.bpo-39830.IkqU1Y.rs=
t b/Misc/NEWS.d/next/Library/2020-03-23-05-21-13.bpo-39830.IkqU1Y.rst
deleted file mode 100644
index fc9c650cc39f2..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-03-23-05-21-13.bpo-39830.IkqU1Y.rst
+++ /dev/null
@@ -1 +0,0 @@
-Add :class:`zipfile.Path` to ``__all__`` in the :mod:`zipfile` module.
diff --git a/Misc/NEWS.d/next/Library/2020-05-02-17-17-37.bpo-40457.EXReI1.rs=
t b/Misc/NEWS.d/next/Library/2020-05-02-17-17-37.bpo-40457.EXReI1.rst
deleted file mode 100644
index 19b6dd685cd8c..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-02-17-17-37.bpo-40457.EXReI1.rst
+++ /dev/null
@@ -1 +0,0 @@
-The ssl module now support OpenSSL builds without TLS 1.0 and 1.1 methods.
diff --git a/Misc/NEWS.d/next/Library/2020-05-06-02-01-25.bpo-13097.Wh5xSK.rs=
t b/Misc/NEWS.d/next/Library/2020-05-06-02-01-25.bpo-13097.Wh5xSK.rst
deleted file mode 100644
index a7f5f58828917..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-06-02-01-25.bpo-13097.Wh5xSK.rst
+++ /dev/null
@@ -1 +0,0 @@
-``ctypes`` now raises an ``ArgumentError`` when a callback is invoked with m=
ore than 1024 arguments.
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Library/2020-05-06-13-51-19.bpo-40515.TUCvYB.rs=
t b/Misc/NEWS.d/next/Library/2020-05-06-13-51-19.bpo-40515.TUCvYB.rst
deleted file mode 100644
index af77a57fe7237..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-06-13-51-19.bpo-40515.TUCvYB.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-The :mod:`ssl` and :mod:`hashlib` modules now actively check that OpenSSL is
-build with thread support. Python 3.7.0 made thread support mandatory and no
-longer works safely with a no-thread builds.
diff --git a/Misc/NEWS.d/next/Library/2020-05-11-19-17-23.bpo-40597.4SGfgm.rs=
t b/Misc/NEWS.d/next/Library/2020-05-11-19-17-23.bpo-40597.4SGfgm.rst
deleted file mode 100644
index 1b9fe609c25b7..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-11-19-17-23.bpo-40597.4SGfgm.rst
+++ /dev/null
@@ -1 +0,0 @@
-If text content lines are longer than policy.max_line_length, always use a c=
ontent-encoding to make sure they are wrapped.
diff --git a/Misc/NEWS.d/next/Library/2020-05-14-13-25-36.bpo-25872.5D5538.rs=
t b/Misc/NEWS.d/next/Library/2020-05-14-13-25-36.bpo-25872.5D5538.rst
deleted file mode 100644
index 3fd8bac73edbe..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-14-13-25-36.bpo-25872.5D5538.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-:mod:`linecache` could crash with a :exc:`KeyError` when accessed from multi=
ple threads.
-Fix by Michael Graczyk.
diff --git a/Misc/NEWS.d/next/Library/2020-05-18-17-29-30.bpo-40626.NeZufF.rs=
t b/Misc/NEWS.d/next/Library/2020-05-18-17-29-30.bpo-40626.NeZufF.rst
deleted file mode 100644
index fe652cd7ee39d..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-18-17-29-30.bpo-40626.NeZufF.rst
+++ /dev/null
@@ -1 +0,0 @@
-Add h5 file extension as MIME Type application/x-hdf5, as per HDF Group reco=
mmendation for HDF5 formatted data files. Patch contributed by Mark Schwab.
diff --git a/Misc/NEWS.d/next/Library/2020-05-18-22-41-02.bpo-40614.8j3kmq.rs=
t b/Misc/NEWS.d/next/Library/2020-05-18-22-41-02.bpo-40614.8j3kmq.rst
deleted file mode 100644
index 238b98c14a326..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-18-22-41-02.bpo-40614.8j3kmq.rst
+++ /dev/null
@@ -1 +0,0 @@
-:func:`ast.parse` will not parse self documenting expressions in f-strings w=
hen passed ``feature_version`` is less than ``(3, 8)``.
diff --git a/Misc/NEWS.d/next/Library/2020-05-25-22-18-38.bpo-30008.CKC3td.rs=
t b/Misc/NEWS.d/next/Library/2020-05-25-22-18-38.bpo-30008.CKC3td.rst
deleted file mode 100644
index c4cfa56ce02c5..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-25-22-18-38.bpo-30008.CKC3td.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Fix :mod:`ssl` code to be compatible with OpenSSL 1.1.x builds that use
-``no-deprecated`` and ``--api=3D1.1.0``.
diff --git a/Misc/NEWS.d/next/Library/2020-05-27-17-00-18.bpo-40795.eZSnHA.rs=
t b/Misc/NEWS.d/next/Library/2020-05-27-17-00-18.bpo-40795.eZSnHA.rst
deleted file mode 100644
index dd02fb05cab5e..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-27-17-00-18.bpo-40795.eZSnHA.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-:mod:`ctypes` module: If ctypes fails to convert the result of a callback or
-if a ctypes callback function raises an exception, sys.unraisablehook is now
-called with an exception set. Previously, the error was logged into stderr
-by :c:func:`PyErr_Print`.
diff --git a/Misc/NEWS.d/next/Library/2020-05-27-21-27-01.bpo-40767.L5MnVV.rs=
t b/Misc/NEWS.d/next/Library/2020-05-27-21-27-01.bpo-40767.L5MnVV.rst
deleted file mode 100644
index 4bebb311b4d54..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-27-21-27-01.bpo-40767.L5MnVV.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-:mod:`webbrowser` now properly finds the default browser in pure Wayland
-systems by checking the WAYLAND_DISPLAY environment variable. Patch
-contributed by J=C3=A9r=C3=A9my Attali.
diff --git a/Misc/NEWS.d/next/Library/2020-05-28-16-51-00.bpo-38488.hFQNgA.rs=
t b/Misc/NEWS.d/next/Library/2020-05-28-16-51-00.bpo-38488.hFQNgA.rst
deleted file mode 100644
index c44da9fecb605..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-28-16-51-00.bpo-38488.hFQNgA.rst
+++ /dev/null
@@ -1 +0,0 @@
-Update ensurepip to install pip 20.1.1 and setuptools 47.1.0.
diff --git a/Misc/NEWS.d/next/Library/2020-05-31-15-52-18.bpo-40834.MO9_hb.rs=
t b/Misc/NEWS.d/next/Library/2020-05-31-15-52-18.bpo-40834.MO9_hb.rst
deleted file mode 100644
index 272783773ff94..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-05-31-15-52-18.bpo-40834.MO9_hb.rst
+++ /dev/null
@@ -1 +0,0 @@
-Fix truncate when sending str object with_xxsubinterpreters.channel_send.
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Library/2020-06-04-16-25-15.bpo-40807.yYyLWx.rs=
t b/Misc/NEWS.d/next/Library/2020-06-04-16-25-15.bpo-40807.yYyLWx.rst
deleted file mode 100644
index 532b809b77eed..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-06-04-16-25-15.bpo-40807.yYyLWx.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Stop codeop._maybe_compile, used by code.InteractiveInterpreter (and IDLE).
-from from emitting each warning three times.
diff --git a/Misc/NEWS.d/next/Library/2020-06-12-10-44-15.bpo-40855.jSot83.rs=
t b/Misc/NEWS.d/next/Library/2020-06-12-10-44-15.bpo-40855.jSot83.rst
deleted file mode 100644
index 201d510327a47..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-06-12-10-44-15.bpo-40855.jSot83.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-The standard deviation and variance functions in the statistics module were
-ignoring their mu and xbar arguments.
diff --git a/Misc/NEWS.d/next/Library/2020-06-15-12-22-53.bpo-40448.1dk8Bu.rs=
t b/Misc/NEWS.d/next/Library/2020-06-15-12-22-53.bpo-40448.1dk8Bu.rst
deleted file mode 100644
index a755c5faa671c..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-06-15-12-22-53.bpo-40448.1dk8Bu.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-:mod:`ensurepip` now disables the use of `pip` cache when installing the
-bundled versions of `pip` and `setuptools`. Patch by Krzysztof Konopko.
diff --git a/Misc/NEWS.d/next/Library/2020-06-20-10-16-57.bpo-41048.hEXB-B.rs=
t b/Misc/NEWS.d/next/Library/2020-06-20-10-16-57.bpo-41048.hEXB-B.rst
deleted file mode 100644
index 2595900137d69..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-06-20-10-16-57.bpo-41048.hEXB-B.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-:func:`mimetypes.read_mime_types` function reads the rule file using UTF-8 e=
ncoding, not the locale encoding.
-Patch by Srinivas Reddy Thatiparthy.
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Library/2020-06-20-18-35-43.bpo-41056.Garcle.rs=
t b/Misc/NEWS.d/next/Library/2020-06-20-18-35-43.bpo-41056.Garcle.rst
deleted file mode 100644
index 1776f0d1cf8a3..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-06-20-18-35-43.bpo-41056.Garcle.rst
+++ /dev/null
@@ -1 +0,0 @@
-Fix a NULL pointer dereference within the ssl module during a MemoryError in=
the keylog callback. (discovered by Coverity)
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Library/2020-06-20-21-03-55.bpo-41058.gztdZy.rs=
t b/Misc/NEWS.d/next/Library/2020-06-20-21-03-55.bpo-41058.gztdZy.rst
deleted file mode 100644
index 6ac90098aa52b..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-06-20-21-03-55.bpo-41058.gztdZy.rst
+++ /dev/null
@@ -1 +0,0 @@
-:func:`pdb.find_function` now correctly determines the source file encoding.
diff --git a/Misc/NEWS.d/next/Library/2020-06-22-10-25-39.bpo-41068._bX2BW.rs=
t b/Misc/NEWS.d/next/Library/2020-06-22-10-25-39.bpo-41068._bX2BW.rst
deleted file mode 100644
index 20580c7886fac..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-06-22-10-25-39.bpo-41068._bX2BW.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Fixed reading files with non-ASCII names from ZIP archive directly after
-writing them.
diff --git a/Misc/NEWS.d/next/Library/2020-06-22-20-08-40.bpo-31938.EVuko9.rs=
t b/Misc/NEWS.d/next/Library/2020-06-22-20-08-40.bpo-31938.EVuko9.rst
deleted file mode 100644
index 0488e94d42e8c..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-06-22-20-08-40.bpo-31938.EVuko9.rst
+++ /dev/null
@@ -1 +0,0 @@
-Fix default-value signatures of several functions in the :mod:`select` modul=
e - by Anthony Sottile.
diff --git a/Misc/NEWS.d/next/Library/2020-06-27-13-51-36.bpo-41138.bIpf7g.rs=
t b/Misc/NEWS.d/next/Library/2020-06-27-13-51-36.bpo-41138.bIpf7g.rst
deleted file mode 100644
index 839d430e89b66..0000000000000
--- a/Misc/NEWS.d/next/Library/2020-06-27-13-51-36.bpo-41138.bIpf7g.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Fixed the :mod:`trace` module CLI for Python source files with non-UTF-8
-encoding.
diff --git a/Misc/NEWS.d/next/Security/2020-03-15-01-28-36.bpo-39073.6Szd3i.r=
st b/Misc/NEWS.d/next/Security/2020-03-15-01-28-36.bpo-39073.6Szd3i.rst
deleted file mode 100644
index 6c9447b897bf6..0000000000000
--- a/Misc/NEWS.d/next/Security/2020-03-15-01-28-36.bpo-39073.6Szd3i.rst
+++ /dev/null
@@ -1 +0,0 @@
-Disallow CR or LF in email.headerregistry.Address arguments to guard against=
header injection attacks.
diff --git a/Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.r=
st b/Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst
deleted file mode 100644
index 1380b31fbe9f4..0000000000000
--- a/Misc/NEWS.d/next/Security/2020-06-29-16-02-29.bpo-41004.ovF0KZ.rst
+++ /dev/null
@@ -1 +0,0 @@
-The __hash__() methods of ipaddress.IPv4Interface and ipaddress.IPv6Interfa=
ce incorrectly generated constant hash values of 32 and 128 respectively. Thi=
s resulted in always causing hash collisions. The fix uses hash() to generate=
hash values for the tuple of (address, mask length, network address).
diff --git a/Misc/NEWS.d/next/Tests/2018-08-20-09-38-52.bpo-34401.eGxMPm.rst =
b/Misc/NEWS.d/next/Tests/2018-08-20-09-38-52.bpo-34401.eGxMPm.rst
deleted file mode 100644
index 1b28d94c056d4..0000000000000
--- a/Misc/NEWS.d/next/Tests/2018-08-20-09-38-52.bpo-34401.eGxMPm.rst
+++ /dev/null
@@ -1 +0,0 @@
-Make test_gdb properly run on HP-UX. Patch by Michael Osipov.
diff --git a/Misc/NEWS.d/next/Tests/2020-05-15-01-21-44.bpo-40055.Xp4aP9.rst =
b/Misc/NEWS.d/next/Tests/2020-05-15-01-21-44.bpo-40055.Xp4aP9.rst
deleted file mode 100644
index edb01182c3a5c..0000000000000
--- a/Misc/NEWS.d/next/Tests/2020-05-15-01-21-44.bpo-40055.Xp4aP9.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-distutils.tests now saves/restores warnings filters to leave them unchanged.
-Importing tests imports docutils which imports pkg_resources which adds a
-warnings filter.
diff --git a/Misc/NEWS.d/next/Tests/2020-06-12-20-46-23.bpo-40964.OBzf2c.rst =
b/Misc/NEWS.d/next/Tests/2020-06-12-20-46-23.bpo-40964.OBzf2c.rst
deleted file mode 100644
index abfe4f0da4351..0000000000000
--- a/Misc/NEWS.d/next/Tests/2020-06-12-20-46-23.bpo-40964.OBzf2c.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Disable remote :mod:`imaplib` tests, host cyrus.andrew.cmu.edu is blocking
-incoming connections.
diff --git a/Misc/NEWS.d/next/Tests/2020-06-17-15-07-14.bpo-41003.tiH_Fy.rst =
b/Misc/NEWS.d/next/Tests/2020-06-17-15-07-14.bpo-41003.tiH_Fy.rst
deleted file mode 100644
index 6f908d99feaf7..0000000000000
--- a/Misc/NEWS.d/next/Tests/2020-06-17-15-07-14.bpo-41003.tiH_Fy.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-Fix ``test_copyreg`` when ``numpy`` is installed: ``test.pickletester`` now
-saves/restores warnings filters when importing ``numpy``, to ignore filters
-installed by ``numpy``.
diff --git a/Misc/NEWS.d/next/Tests/2020-06-17-17-27-07.bpo-41009.Rvn6OQ.rst =
b/Misc/NEWS.d/next/Tests/2020-06-17-17-27-07.bpo-41009.Rvn6OQ.rst
deleted file mode 100644
index 1208c119a3556..0000000000000
--- a/Misc/NEWS.d/next/Tests/2020-06-17-17-27-07.bpo-41009.Rvn6OQ.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Fix use of ``support.require_{linux|mac|freebsd}_version()`` decorators as
-class decorator.
diff --git a/Misc/NEWS.d/next/Tests/2020-06-17-18-00-21.bpo-38377.jfg4TH.rst =
b/Misc/NEWS.d/next/Tests/2020-06-17-18-00-21.bpo-38377.jfg4TH.rst
deleted file mode 100644
index 11a30761d36c9..0000000000000
--- a/Misc/NEWS.d/next/Tests/2020-06-17-18-00-21.bpo-38377.jfg4TH.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-On Linux, skip tests using multiprocessing if the current user cannot create
-a file in ``/dev/shm/`` directory. Add the
-:func:`~test.support.skip_if_broken_multiprocessing_synchronize` function to
-the :mod:`test.support` module.
diff --git a/Misc/NEWS.d/next/Tests/2020-06-23-12-02-45.bpo-41085.JZKsyz.rst =
b/Misc/NEWS.d/next/Tests/2020-06-23-12-02-45.bpo-41085.JZKsyz.rst
deleted file mode 100644
index 463dffdd653ee..0000000000000
--- a/Misc/NEWS.d/next/Tests/2020-06-23-12-02-45.bpo-41085.JZKsyz.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windo=
ws
-for index larger than ``2**31``.
diff --git a/Misc/NEWS.d/next/Tools-Demos/2020-04-03-08-32-31.bpo-40163.lX8K4=
B.rst b/Misc/NEWS.d/next/Tools-Demos/2020-04-03-08-32-31.bpo-40163.lX8K4B.rst
deleted file mode 100644
index fc0a22a0a953e..0000000000000
--- a/Misc/NEWS.d/next/Tools-Demos/2020-04-03-08-32-31.bpo-40163.lX8K4B.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-Fix multissltest tool. OpenSSL has changed download URL for old releases.
-The multissltest tool now tries to download from current and old download
-URLs.
diff --git a/Misc/NEWS.d/next/Tools-Demos/2020-05-15-17-48-25.bpo-40479.B1gBl=
-.rst b/Misc/NEWS.d/next/Tools-Demos/2020-05-15-17-48-25.bpo-40479.B1gBl-.rst
deleted file mode 100644
index b59035971d7b0..0000000000000
--- a/Misc/NEWS.d/next/Tools-Demos/2020-05-15-17-48-25.bpo-40479.B1gBl-.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Update multissltest helper to test with latest OpenSSL 1.0.2, 1.1.0, 1.1.1,
-and 3.0.0-alpha.
diff --git a/Misc/NEWS.d/next/Windows/2020-03-23-19-07-55.bpo-39148.W1YJEb.rs=
t b/Misc/NEWS.d/next/Windows/2020-03-23-19-07-55.bpo-39148.W1YJEb.rst
deleted file mode 100644
index 7c70dce1e7333..0000000000000
--- a/Misc/NEWS.d/next/Windows/2020-03-23-19-07-55.bpo-39148.W1YJEb.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-Add IPv6 support to :mod:`asyncio` datagram endpoints in ProactorEventLoop.
-Change the raised exception for unknown address families to ValueError
-as it's not coming from Windows API.
diff --git a/Misc/NEWS.d/next/Windows/2020-05-17-00-08-13.bpo-40650.4euMtU.rs=
t b/Misc/NEWS.d/next/Windows/2020-05-17-00-08-13.bpo-40650.4euMtU.rst
deleted file mode 100644
index db13e58b14a79..0000000000000
--- a/Misc/NEWS.d/next/Windows/2020-05-17-00-08-13.bpo-40650.4euMtU.rst
+++ /dev/null
@@ -1 +0,0 @@
-Include winsock2.h in pytime.c for timeval.
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Windows/2020-05-19-04-11-12.bpo-40677.qQbLW8.rs=
t b/Misc/NEWS.d/next/Windows/2020-05-19-04-11-12.bpo-40677.qQbLW8.rst
deleted file mode 100644
index a09cb243aba31..0000000000000
--- a/Misc/NEWS.d/next/Windows/2020-05-19-04-11-12.bpo-40677.qQbLW8.rst
+++ /dev/null
@@ -1 +0,0 @@
-Manually define IO_REPARSE_TAG_APPEXECLINK in case some old Windows SDK does=
n't have it.
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Windows/2020-05-19-14-43-33.bpo-39631.Z5yXam.rs=
t b/Misc/NEWS.d/next/Windows/2020-05-19-14-43-33.bpo-39631.Z5yXam.rst
deleted file mode 100644
index 38db4b431b6af..0000000000000
--- a/Misc/NEWS.d/next/Windows/2020-05-19-14-43-33.bpo-39631.Z5yXam.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Changes the registered MIME type for ``.py`` files on Windows to
-``text/x-python`` instead of ``text/plain``.
diff --git a/Misc/NEWS.d/next/Windows/2020-06-12-13-13-44.bpo-40164.SPrSn5.rs=
t b/Misc/NEWS.d/next/Windows/2020-06-12-13-13-44.bpo-40164.SPrSn5.rst
deleted file mode 100644
index 6390de717d71f..0000000000000
--- a/Misc/NEWS.d/next/Windows/2020-06-12-13-13-44.bpo-40164.SPrSn5.rst
+++ /dev/null
@@ -1 +0,0 @@
-Updates Windows OpenSSL to 1.1.1g
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/Windows/2020-06-24-21-30-42.bpo-41074.gaQc3C.rs=
t b/Misc/NEWS.d/next/Windows/2020-06-24-21-30-42.bpo-41074.gaQc3C.rst
deleted file mode 100644
index ec91fd361c3de..0000000000000
--- a/Misc/NEWS.d/next/Windows/2020-06-24-21-30-42.bpo-41074.gaQc3C.rst
+++ /dev/null
@@ -1,3 +0,0 @@
-Fixed support of non-ASCII names in functions :func:`msilib.OpenDatabase`
-and :func:`msilib.init_database` and non-ASCII SQL in method
-:meth:`msilib.Database.OpenView`.
diff --git a/Misc/NEWS.d/next/macOS/2020-06-07-20-10-56.bpo-40741.80A2BW.rst =
b/Misc/NEWS.d/next/macOS/2020-06-07-20-10-56.bpo-40741.80A2BW.rst
deleted file mode 100644
index 6ff7b9a805b95..0000000000000
--- a/Misc/NEWS.d/next/macOS/2020-06-07-20-10-56.bpo-40741.80A2BW.rst
+++ /dev/null
@@ -1 +0,0 @@
-Update macOS installer to use SQLite 3.32.2.
diff --git a/Misc/NEWS.d/next/macOS/2020-06-17-13-45-15.bpo-41005.zZegdV.rst =
b/Misc/NEWS.d/next/macOS/2020-06-17-13-45-15.bpo-41005.zZegdV.rst
deleted file mode 100644
index 3b5f3f23a12f5..0000000000000
--- a/Misc/NEWS.d/next/macOS/2020-06-17-13-45-15.bpo-41005.zZegdV.rst
+++ /dev/null
@@ -1 +0,0 @@
-fixed an XDG settings issue not allowing macos to open browser in webbrowser=
.py
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst =
b/Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
deleted file mode 100644
index d6bb616136690..0000000000000
--- a/Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-Fix configure error when building on macOS 11.
-Note that the current Python release was released
-shortly after the first developer preview of macOS
-11 (Big Sur); there are other known issues with
-building and running on the developer preview.
-Big Sur is expected to be fully supported in a
-future bugfix release of Python 3.8.x and with 3.9.0.
\ No newline at end of file
diff --git a/Misc/NEWS.d/next/macOS/2020-06-25-06-09-00.bpo-39580.N_vJ9h.rst =
b/Misc/NEWS.d/next/macOS/2020-06-25-06-09-00.bpo-39580.N_vJ9h.rst
deleted file mode 100644
index 95d65359804d0..0000000000000
--- a/Misc/NEWS.d/next/macOS/2020-06-25-06-09-00.bpo-39580.N_vJ9h.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-Avoid opening Finder window if running installer from the command line.
-Patch contributed by Rick Heil.
diff --git a/README.rst b/README.rst
index ae71b671111de..a64d80f4c8e3d 100644
--- a/README.rst
+++ b/README.rst
@@ -1,5 +1,5 @@
-This is Python version 3.8.3
-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
+This is Python version 3.8.4rc1
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D
=20
.. image:: https://travis-ci.org/python/cpython.svg?branch=3D3.8
:alt: CPython build status on Travis CI
1
0
To: python-checkins(a)python.org
Subject: bpo-39314: Closes parenthesis when autocompleting for functions that
take no arguments (GH-20562)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
https://github.com/python/cpython/commit/bd4a3f21454a6012f4353e2255837561fc…
0e6a
commit: bd4a3f21454a6012f4353e2255837561fc9f0e6a
branch: master
author: R=C3=A9mi Lapeyre <remi.lapeyre(a)lenstra.fr>
committer: GitHub <noreply(a)github.com>
date: 2020-06-30T22:48:15+09:00
summary:
bpo-39314: Closes parenthesis when autocompleting for functions that take no =
arguments (GH-20562)
files:
A Misc/NEWS.d/next/Library/2020-06-01-02-16-29.bpo-39314.0T9hlA.rst
M Lib/rlcompleter.py
M Lib/test/test_rlcompleter.py
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py
index bca4a7bc5218a..c06388e8d9c2d 100644
--- a/Lib/rlcompleter.py
+++ b/Lib/rlcompleter.py
@@ -31,6 +31,7 @@
=20
import atexit
import builtins
+import inspect
import __main__
=20
__all__ =3D ["Completer"]
@@ -96,7 +97,13 @@ def complete(self, text, state):
=20
def _callable_postfix(self, val, word):
if callable(val):
- word =3D word + "("
+ word +=3D "("
+ try:
+ if not inspect.signature(val).parameters:
+ word +=3D ")"
+ except ValueError:
+ pass
+
return word
=20
def global_matches(self, text):
diff --git a/Lib/test/test_rlcompleter.py b/Lib/test/test_rlcompleter.py
index 0dc1080ca3209..ee3019d8782d1 100644
--- a/Lib/test/test_rlcompleter.py
+++ b/Lib/test/test_rlcompleter.py
@@ -40,12 +40,12 @@ def test_global_matches(self):
=20
# test with a customized namespace
self.assertEqual(self.completer.global_matches('CompleteM'),
- ['CompleteMe('])
+ ['CompleteMe()'])
self.assertEqual(self.completer.global_matches('eg'),
['egg('])
# XXX: see issue5256
self.assertEqual(self.completer.global_matches('CompleteM'),
- ['CompleteMe('])
+ ['CompleteMe()'])
=20
def test_attr_matches(self):
# test with builtins namespace
@@ -64,7 +64,7 @@ def test_attr_matches(self):
['CompleteMe.spam'])
self.assertEqual(self.completer.attr_matches('Completeme.egg'), [])
self.assertEqual(self.completer.attr_matches('CompleteMe.'),
- ['CompleteMe.mro(', 'CompleteMe.spam'])
+ ['CompleteMe.mro()', 'CompleteMe.spam'])
self.assertEqual(self.completer.attr_matches('CompleteMe._'),
['CompleteMe._ham'])
matches =3D self.completer.attr_matches('CompleteMe.__')
@@ -134,7 +134,7 @@ def test_duplicate_globals(self):
# No opening bracket "(" because we overrode the built-in class
self.assertEqual(completer.complete('memoryview', 0), 'memoryview')
self.assertIsNone(completer.complete('memoryview', 1))
- self.assertEqual(completer.complete('Ellipsis', 0), 'Ellipsis(')
+ self.assertEqual(completer.complete('Ellipsis', 0), 'Ellipsis()')
self.assertIsNone(completer.complete('Ellipsis', 1))
=20
if __name__ =3D=3D '__main__':
diff --git a/Misc/NEWS.d/next/Library/2020-06-01-02-16-29.bpo-39314.0T9hlA.rs=
t b/Misc/NEWS.d/next/Library/2020-06-01-02-16-29.bpo-39314.0T9hlA.rst
new file mode 100644
index 0000000000000..e805332efb626
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-06-01-02-16-29.bpo-39314.0T9hlA.rst
@@ -0,0 +1,3 @@
+:class:`rlcompleter.Completer` and the standard Python shell now close the
+parenthesis for functions that take no arguments. Patch contributed by R=C3=
=A9mi
+Lapeyre.
1
0
30 Jun '20
https://github.com/python/cpython/commit/0c4f0f3b29d84063700217dcf90ad6860e…
commit: 0c4f0f3b29d84063700217dcf90ad6860ed71c70
branch: master
author: Hai Shi <shihai1992(a)gmail.com>
committer: GitHub <noreply(a)github.com>
date: 2020-06-30T15:46:31+02:00
summary:
bpo-40275: Use new test.support helper submodules in tests (GH-21169)
files:
M Lib/test/_test_multiprocessing.py
M Lib/test/test_base64.py
M Lib/test/test_bool.py
M Lib/test/test_dict_version.py
M Lib/test/test_grammar.py
M Lib/test/test_iter.py
M Lib/test/test_lzma.py
M Lib/test/test_mailcap.py
M Lib/test/test_memoryview.py
M Lib/test/test_os.py
M Lib/test/test_shutil.py
M Lib/test/test_subprocess.py
M Lib/test/test_support.py
M Lib/test/test_tempfile.py
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 5f65d966d62ee..6b4679f82da73 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -27,12 +27,13 @@
import test.support.script_helper
from test import support
from test.support import hashlib_helper
+from test.support import import_helper
from test.support import socket_helper
from test.support import threading_helper
# Skip tests if _multiprocessing wasn't built.
-_multiprocessing = test.support.import_module('_multiprocessing')
+_multiprocessing = import_helper.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
support.skip_if_broken_multiprocessing_synchronize()
import threading
diff --git a/Lib/test/test_base64.py b/Lib/test/test_base64.py
index 1dbeac41dc0dd..1f67e46cd2267 100644
--- a/Lib/test/test_base64.py
+++ b/Lib/test/test_base64.py
@@ -1,9 +1,9 @@
import unittest
-from test import support
import base64
import binascii
import os
from array import array
+from test.support import os_helper
from test.support import script_helper
@@ -647,8 +647,8 @@ def test_ErrorHeritage(self):
class TestMain(unittest.TestCase):
def tearDown(self):
- if os.path.exists(support.TESTFN):
- os.unlink(support.TESTFN)
+ if os.path.exists(os_helper.TESTFN):
+ os.unlink(os_helper.TESTFN)
def get_output(self, *args):
return script_helper.assert_python_ok('-m', 'base64', *args).out
@@ -662,9 +662,9 @@ def test_encode_decode(self):
))
def test_encode_file(self):
- with open(support.TESTFN, 'wb') as fp:
+ with open(os_helper.TESTFN, 'wb') as fp:
fp.write(b'a\xffb\n')
- output = self.get_output('-e', support.TESTFN)
+ output = self.get_output('-e', os_helper.TESTFN)
self.assertEqual(output.rstrip(), b'Yf9iCg==')
def test_encode_from_stdin(self):
@@ -674,9 +674,9 @@ def test_encode_from_stdin(self):
self.assertIsNone(err)
def test_decode(self):
- with open(support.TESTFN, 'wb') as fp:
+ with open(os_helper.TESTFN, 'wb') as fp:
fp.write(b'Yf9iCg==')
- output = self.get_output('-d', support.TESTFN)
+ output = self.get_output('-d', os_helper.TESTFN)
self.assertEqual(output.rstrip(), b'a\xffb')
if __name__ == '__main__':
diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py
index 4c6fba42c0c57..7b3a3859e0893 100644
--- a/Lib/test/test_bool.py
+++ b/Lib/test/test_bool.py
@@ -2,6 +2,7 @@
import unittest
from test import support
+from test.support import os_helper
import os
@@ -234,11 +235,11 @@ def test_boolean(self):
def test_fileclosed(self):
try:
- with open(support.TESTFN, "w") as f:
+ with open(os_helper.TESTFN, "w") as f:
self.assertIs(f.closed, False)
self.assertIs(f.closed, True)
finally:
- os.remove(support.TESTFN)
+ os.remove(os_helper.TESTFN)
def test_types(self):
# types are always true.
diff --git a/Lib/test/test_dict_version.py b/Lib/test/test_dict_version.py
index b23786514f82e..8cdccad0d79ab 100644
--- a/Lib/test/test_dict_version.py
+++ b/Lib/test/test_dict_version.py
@@ -2,11 +2,11 @@
Test implementation of the PEP 509: dictionary versionning.
"""
import unittest
-from test import support
+from test.support import import_helper
# PEP 509 is implemented in CPython but other Python implementations
# don't require to implement it
-_testcapi = support.import_module('_testcapi')
+_testcapi = import_helper.import_module('_testcapi')
class DictVersionTests(unittest.TestCase):
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index ef7d1a15c7570..a51452e739f3a 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -1,7 +1,8 @@
# Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
-from test.support import check_syntax_error, check_syntax_warning
+from test.support import check_syntax_error
+from test.support.warnings_helper import check_syntax_warning
import inspect
import unittest
import sys
@@ -276,7 +277,8 @@ def __getitem__(self, item):
class GrammarTests(unittest.TestCase):
- from test.support import check_syntax_error, check_syntax_warning
+ from test.support import check_syntax_error
+ from test.support.warnings_helper import check_syntax_warning
# single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE
# XXX can't test in a script -- this rule is only used when interactive
diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py
index 524346939886d..a7658b5f47694 100644
--- a/Lib/test/test_iter.py
+++ b/Lib/test/test_iter.py
@@ -2,7 +2,8 @@
import sys
import unittest
-from test.support import run_unittest, TESTFN, unlink, cpython_only
+from test.support import run_unittest, cpython_only
+from test.support.os_helper import TESTFN, unlink
from test.support import check_free_after_iterating, ALWAYS_EQ, NEVER_EQ
import pickle
import collections.abc
diff --git a/Lib/test/test_lzma.py b/Lib/test/test_lzma.py
index 0f3af27efa909..c2427f8cd228f 100644
--- a/Lib/test/test_lzma.py
+++ b/Lib/test/test_lzma.py
@@ -9,7 +9,11 @@
import unittest
from test.support import (
- _4G, TESTFN, import_module, bigmemtest, run_unittest, unlink
+ _4G, bigmemtest, run_unittest
+)
+from test.support.import_helper import import_module
+from test.support.os_helper import (
+ TESTFN, unlink
)
lzma = import_module("lzma")
diff --git a/Lib/test/test_mailcap.py b/Lib/test/test_mailcap.py
index c08423c670739..51a0c7da8bb6b 100644
--- a/Lib/test/test_mailcap.py
+++ b/Lib/test/test_mailcap.py
@@ -2,6 +2,7 @@
import os
import copy
import test.support
+from test.support import os_helper
import unittest
# Location of mailcap file
@@ -74,7 +75,7 @@ def test_listmailcapfiles(self):
self.assertIsInstance(mcfiles, list)
for m in mcfiles:
self.assertIsInstance(m, str)
- with test.support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
# According to RFC 1524, if MAILCAPS env variable exists, use that
# and only that.
if "MAILCAPS" in env:
@@ -136,7 +137,7 @@ def test_mock_getcaps(self):
# Test mailcap.getcaps() using mock mailcap file in this dir.
# Temporarily override any existing system mailcap file by pointing the
# MAILCAPS environment variable to our mock file.
- with test.support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env["MAILCAPS"] = MAILCAPFILE
caps = mailcap.getcaps()
self.assertDictEqual(caps, MAILCAPDICT)
diff --git a/Lib/test/test_memoryview.py b/Lib/test/test_memoryview.py
index ca307d8342f31..d7e3f0c0effa6 100644
--- a/Lib/test/test_memoryview.py
+++ b/Lib/test/test_memoryview.py
@@ -14,6 +14,8 @@
import copy
import pickle
+from test.support import import_helper
+
class AbstractMemoryTests:
source_bytes = b"abcdef"
@@ -508,7 +510,7 @@ class ArrayMemorySliceSliceTest(unittest.TestCase,
class OtherTest(unittest.TestCase):
def test_ctypes_cast(self):
# Issue 15944: Allow all source formats when casting to bytes.
- ctypes = test.support.import_module("ctypes")
+ ctypes = import_helper.import_module("ctypes")
p6 = bytes(ctypes.c_double(0.6))
d = ctypes.c_double()
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index ef2395d87a605..03152072c1bf5 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -30,8 +30,10 @@
import uuid
import warnings
from test import support
+from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
+from test.support import warnings_helper
from platform import win32_is_iot
try:
@@ -57,7 +59,8 @@
INT_MAX = PY_SSIZE_T_MAX = sys.maxsize
from test.support.script_helper import assert_python_ok
-from test.support import unix_shell, FakePath
+from test.support import unix_shell
+from test.support.os_helper import FakePath
root_in_posix = False
@@ -109,7 +112,7 @@ def test_getcwd_long_path(self):
dirname = dirname + ('a' * (dirlen - len(dirname)))
with tempfile.TemporaryDirectory() as tmpdir:
- with support.change_cwd(tmpdir) as path:
+ with os_helper.change_cwd(tmpdir) as path:
expected = path
while True:
@@ -153,17 +156,17 @@ def test_getcwdb(self):
# Tests creating TESTFN
class FileTests(unittest.TestCase):
def setUp(self):
- if os.path.lexists(support.TESTFN):
- os.unlink(support.TESTFN)
+ if os.path.lexists(os_helper.TESTFN):
+ os.unlink(os_helper.TESTFN)
tearDown = setUp
def test_access(self):
- f = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR)
+ f = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR)
os.close(f)
- self.assertTrue(os.access(support.TESTFN, os.W_OK))
+ self.assertTrue(os.access(os_helper.TESTFN, os.W_OK))
def test_closerange(self):
- first = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR)
+ first = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR)
# We must allocate two consecutive file descriptors, otherwise
# it will mess up other file descriptors (perhaps even the three
# standard ones).
@@ -185,14 +188,14 @@ def test_closerange(self):
@support.cpython_only
def test_rename(self):
- path = support.TESTFN
+ path = os_helper.TESTFN
old = sys.getrefcount(path)
self.assertRaises(TypeError, os.rename, path, 0)
new = sys.getrefcount(path)
self.assertEqual(old, new)
def test_read(self):
- with open(support.TESTFN, "w+b") as fobj:
+ with open(os_helper.TESTFN, "w+b") as fobj:
fobj.write(b"spam")
fobj.flush()
fd = fobj.fileno()
@@ -208,12 +211,12 @@ def test_read(self):
"needs INT_MAX < PY_SSIZE_T_MAX")
@support.bigmemtest(size=INT_MAX + 10, memuse=1, dry_run=False)
def test_large_read(self, size):
- self.addCleanup(support.unlink, support.TESTFN)
- create_file(support.TESTFN, b'test')
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+ create_file(os_helper.TESTFN, b'test')
# Issue #21932: Make sure that os.read() does not raise an
# OverflowError for size larger than INT_MAX
- with open(support.TESTFN, "rb") as fp:
+ with open(os_helper.TESTFN, "rb") as fp:
data = os.read(fp.fileno(), size)
# The test does not try to read more than 2 GiB at once because the
@@ -222,13 +225,13 @@ def test_large_read(self, size):
def test_write(self):
# os.write() accepts bytes- and buffer-like objects but not strings
- fd = os.open(support.TESTFN, os.O_CREAT | os.O_WRONLY)
+ fd = os.open(os_helper.TESTFN, os.O_CREAT | os.O_WRONLY)
self.assertRaises(TypeError, os.write, fd, "beans")
os.write(fd, b"bacon\n")
os.write(fd, bytearray(b"eggs\n"))
os.write(fd, memoryview(b"spam\n"))
os.close(fd)
- with open(support.TESTFN, "rb") as fobj:
+ with open(os_helper.TESTFN, "rb") as fobj:
self.assertEqual(fobj.read().splitlines(),
[b"bacon", b"eggs", b"spam"])
@@ -252,12 +255,12 @@ def test_write_windows_console(self):
self.write_windows_console(sys.executable, "-u", "-c", code)
def fdopen_helper(self, *args):
- fd = os.open(support.TESTFN, os.O_RDONLY)
+ fd = os.open(os_helper.TESTFN, os.O_RDONLY)
f = os.fdopen(fd, *args)
f.close()
def test_fdopen(self):
- fd = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR)
+ fd = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR)
os.close(fd)
self.fdopen_helper()
@@ -265,15 +268,15 @@ def test_fdopen(self):
self.fdopen_helper('r', 100)
def test_replace(self):
- TESTFN2 = support.TESTFN + ".2"
- self.addCleanup(support.unlink, support.TESTFN)
- self.addCleanup(support.unlink, TESTFN2)
+ TESTFN2 = os_helper.TESTFN + ".2"
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+ self.addCleanup(os_helper.unlink, TESTFN2)
- create_file(support.TESTFN, b"1")
+ create_file(os_helper.TESTFN, b"1")
create_file(TESTFN2, b"2")
- os.replace(support.TESTFN, TESTFN2)
- self.assertRaises(FileNotFoundError, os.stat, support.TESTFN)
+ os.replace(os_helper.TESTFN, TESTFN2)
+ self.assertRaises(FileNotFoundError, os.stat, os_helper.TESTFN)
with open(TESTFN2, 'r') as f:
self.assertEqual(f.read(), "1")
@@ -285,7 +288,7 @@ def test_open_keywords(self):
def test_symlink_keywords(self):
symlink = support.get_attribute(os, "symlink")
try:
- symlink(src='target', dst=support.TESTFN,
+ symlink(src='target', dst=os_helper.TESTFN,
target_is_directory=False, dir_fd=None)
except (NotImplementedError, OSError):
pass # No OS support or unprivileged user
@@ -297,18 +300,18 @@ def test_copy_file_range_invalid_values(self):
@unittest.skipUnless(hasattr(os, 'copy_file_range'), 'test needs os.copy_file_range()')
def test_copy_file_range(self):
- TESTFN2 = support.TESTFN + ".3"
+ TESTFN2 = os_helper.TESTFN + ".3"
data = b'0123456789'
- create_file(support.TESTFN, data)
- self.addCleanup(support.unlink, support.TESTFN)
+ create_file(os_helper.TESTFN, data)
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
- in_file = open(support.TESTFN, 'rb')
+ in_file = open(os_helper.TESTFN, 'rb')
self.addCleanup(in_file.close)
in_fd = in_file.fileno()
out_file = open(TESTFN2, 'w+b')
- self.addCleanup(support.unlink, TESTFN2)
+ self.addCleanup(os_helper.unlink, TESTFN2)
self.addCleanup(out_file.close)
out_fd = out_file.fileno()
@@ -331,21 +334,21 @@ def test_copy_file_range(self):
@unittest.skipUnless(hasattr(os, 'copy_file_range'), 'test needs os.copy_file_range()')
def test_copy_file_range_offset(self):
- TESTFN4 = support.TESTFN + ".4"
+ TESTFN4 = os_helper.TESTFN + ".4"
data = b'0123456789'
bytes_to_copy = 6
in_skip = 3
out_seek = 5
- create_file(support.TESTFN, data)
- self.addCleanup(support.unlink, support.TESTFN)
+ create_file(os_helper.TESTFN, data)
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
- in_file = open(support.TESTFN, 'rb')
+ in_file = open(os_helper.TESTFN, 'rb')
self.addCleanup(in_file.close)
in_fd = in_file.fileno()
out_file = open(TESTFN4, 'w+b')
- self.addCleanup(support.unlink, TESTFN4)
+ self.addCleanup(os_helper.unlink, TESTFN4)
self.addCleanup(out_file.close)
out_fd = out_file.fileno()
@@ -377,8 +380,8 @@ def test_copy_file_range_offset(self):
# Test attributes on return values from os.*stat* family.
class StatAttributeTests(unittest.TestCase):
def setUp(self):
- self.fname = support.TESTFN
- self.addCleanup(support.unlink, self.fname)
+ self.fname = os_helper.TESTFN
+ self.addCleanup(os_helper.unlink, self.fname)
create_file(self.fname, b"ABC")
def check_stat_attributes(self, fname):
@@ -563,7 +566,7 @@ def test_file_attributes(self):
0)
# test directory st_file_attributes (FILE_ATTRIBUTE_DIRECTORY set)
- dirname = support.TESTFN + "dir"
+ dirname = os_helper.TESTFN + "dir"
os.mkdir(dirname)
self.addCleanup(os.rmdir, dirname)
@@ -580,7 +583,7 @@ def test_access_denied(self):
# os.environ['TEMP'] should be located on a volume that
# supports file ACLs.
fname = os.path.join(os.environ['TEMP'], self.fname)
- self.addCleanup(support.unlink, fname)
+ self.addCleanup(os_helper.unlink, fname)
create_file(fname, b'ABC')
# Deny the right to [S]YNCHRONIZE on the file to
# force CreateFile to fail with ERROR_ACCESS_DENIED.
@@ -605,10 +608,10 @@ def test_stat_block_device(self):
class UtimeTests(unittest.TestCase):
def setUp(self):
- self.dirname = support.TESTFN
+ self.dirname = os_helper.TESTFN
self.fname = os.path.join(self.dirname, "f1")
- self.addCleanup(support.rmtree, self.dirname)
+ self.addCleanup(os_helper.rmtree, self.dirname)
os.mkdir(self.dirname)
create_file(self.fname)
@@ -961,7 +964,7 @@ def test_putenv_unsetenv(self):
value = "testvalue"
code = f'import os; print(repr(os.environ.get({name!r})))'
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env.pop(name, None)
os.putenv(name, value)
@@ -1132,7 +1135,7 @@ def walk(self, top, **kwargs):
def setUp(self):
join = os.path.join
- self.addCleanup(support.rmtree, support.TESTFN)
+ self.addCleanup(os_helper.rmtree, os_helper.TESTFN)
# Build:
# TESTFN/
@@ -1151,7 +1154,7 @@ def setUp(self):
# broken_link3
# TEST2/
# tmp4 a lone file
- self.walk_path = join(support.TESTFN, "TEST1")
+ self.walk_path = join(os_helper.TESTFN, "TEST1")
self.sub1_path = join(self.walk_path, "SUB1")
self.sub11_path = join(self.sub1_path, "SUB11")
sub2_path = join(self.walk_path, "SUB2")
@@ -1161,8 +1164,8 @@ def setUp(self):
tmp3_path = join(sub2_path, "tmp3")
tmp5_path = join(sub21_path, "tmp3")
self.link_path = join(sub2_path, "link")
- t2_path = join(support.TESTFN, "TEST2")
- tmp4_path = join(support.TESTFN, "TEST2", "tmp4")
+ t2_path = join(os_helper.TESTFN, "TEST2")
+ tmp4_path = join(os_helper.TESTFN, "TEST2", "tmp4")
broken_link_path = join(sub2_path, "broken_link")
broken_link2_path = join(sub2_path, "broken_link2")
broken_link3_path = join(sub2_path, "broken_link3")
@@ -1177,7 +1180,7 @@ def setUp(self):
with open(path, "x", encoding='utf-8') as f:
f.write("I'm " + path + " and proud of it. Blame test_os.\n")
- if support.can_symlink():
+ if os_helper.can_symlink():
os.symlink(os.path.abspath(t2_path), self.link_path)
os.symlink('broken', broken_link_path, True)
os.symlink(join('tmp3', 'broken'), broken_link2_path, True)
@@ -1260,7 +1263,7 @@ def test_walk_bottom_up(self):
self.sub2_tree)
def test_walk_symlink(self):
- if not support.can_symlink():
+ if not os_helper.can_symlink():
self.skipTest("need symlink support")
# Walk, following symlinks.
@@ -1296,7 +1299,7 @@ def test_walk_bad_dir(self):
def test_walk_many_open_files(self):
depth = 30
- base = os.path.join(support.TESTFN, 'deep')
+ base = os.path.join(os_helper.TESTFN, 'deep')
p = os.path.join(base, *(['d']*depth))
os.makedirs(p)
@@ -1346,13 +1349,13 @@ def _compare_to_walk(self, walk_kwargs, fwalk_kwargs):
self.assertEqual(expected[root], (set(dirs), set(files)))
def test_compare_to_walk(self):
- kwargs = {'top': support.TESTFN}
+ kwargs = {'top': os_helper.TESTFN}
self._compare_to_walk(kwargs, kwargs)
def test_dir_fd(self):
try:
fd = os.open(".", os.O_RDONLY)
- walk_kwargs = {'top': support.TESTFN}
+ walk_kwargs = {'top': os_helper.TESTFN}
fwalk_kwargs = walk_kwargs.copy()
fwalk_kwargs['dir_fd'] = fd
self._compare_to_walk(walk_kwargs, fwalk_kwargs)
@@ -1362,7 +1365,7 @@ def test_dir_fd(self):
def test_yields_correct_dir_fd(self):
# check returned file descriptors
for topdown, follow_symlinks in itertools.product((True, False), repeat=2):
- args = support.TESTFN, topdown, None
+ args = os_helper.TESTFN, topdown, None
for root, dirs, files, rootfd in self.fwalk(*args, follow_symlinks=follow_symlinks):
# check that the FD is valid
os.fstat(rootfd)
@@ -1378,7 +1381,7 @@ def test_fd_leak(self):
minfd = os.dup(1)
os.close(minfd)
for i in range(256):
- for x in self.fwalk(support.TESTFN):
+ for x in self.fwalk(os_helper.TESTFN):
pass
newfd = os.dup(1)
self.addCleanup(os.close, newfd)
@@ -1416,10 +1419,10 @@ def fwalk(self, top='.', *args, **kwargs):
class MakedirTests(unittest.TestCase):
def setUp(self):
- os.mkdir(support.TESTFN)
+ os.mkdir(os_helper.TESTFN)
def test_makedir(self):
- base = support.TESTFN
+ base = os_helper.TESTFN
path = os.path.join(base, 'dir1', 'dir2', 'dir3')
os.makedirs(path) # Should work
path = os.path.join(base, 'dir1', 'dir2', 'dir3', 'dir4')
@@ -1434,8 +1437,8 @@ def test_makedir(self):
os.makedirs(path)
def test_mode(self):
- with support.temp_umask(0o002):
- base = support.TESTFN
+ with os_helper.temp_umask(0o002):
+ base = os_helper.TESTFN
parent = os.path.join(base, 'dir1')
path = os.path.join(parent, 'dir2')
os.makedirs(path, 0o555)
@@ -1446,7 +1449,7 @@ def test_mode(self):
self.assertEqual(os.stat(parent).st_mode & 0o777, 0o775)
def test_exist_ok_existing_directory(self):
- path = os.path.join(support.TESTFN, 'dir1')
+ path = os.path.join(os_helper.TESTFN, 'dir1')
mode = 0o777
old_mask = os.umask(0o022)
os.makedirs(path, mode)
@@ -1460,18 +1463,18 @@ def test_exist_ok_existing_directory(self):
os.makedirs(os.path.abspath('/'), exist_ok=True)
def test_exist_ok_s_isgid_directory(self):
- path = os.path.join(support.TESTFN, 'dir1')
+ path = os.path.join(os_helper.TESTFN, 'dir1')
S_ISGID = stat.S_ISGID
mode = 0o777
old_mask = os.umask(0o022)
try:
existing_testfn_mode = stat.S_IMODE(
- os.lstat(support.TESTFN).st_mode)
+ os.lstat(os_helper.TESTFN).st_mode)
try:
- os.chmod(support.TESTFN, existing_testfn_mode | S_ISGID)
+ os.chmod(os_helper.TESTFN, existing_testfn_mode | S_ISGID)
except PermissionError:
raise unittest.SkipTest('Cannot set S_ISGID for dir.')
- if (os.lstat(support.TESTFN).st_mode & S_ISGID != S_ISGID):
+ if (os.lstat(os_helper.TESTFN).st_mode & S_ISGID != S_ISGID):
raise unittest.SkipTest('No support for S_ISGID dir mode.')
# The os should apply S_ISGID from the parent dir for us, but
# this test need not depend on that behavior. Be explicit.
@@ -1487,8 +1490,8 @@ def test_exist_ok_s_isgid_directory(self):
os.umask(old_mask)
def test_exist_ok_existing_regular_file(self):
- base = support.TESTFN
- path = os.path.join(support.TESTFN, 'dir1')
+ base = os_helper.TESTFN
+ path = os.path.join(os_helper.TESTFN, 'dir1')
with open(path, 'w') as f:
f.write('abc')
self.assertRaises(OSError, os.makedirs, path)
@@ -1497,12 +1500,12 @@ def test_exist_ok_existing_regular_file(self):
os.remove(path)
def tearDown(self):
- path = os.path.join(support.TESTFN, 'dir1', 'dir2', 'dir3',
+ path = os.path.join(os_helper.TESTFN, 'dir1', 'dir2', 'dir3',
'dir4', 'dir5', 'dir6')
# If the tests failed, the bottom-most directory ('../dir6')
# may not have been created, so we look for the outermost directory
# that exists.
- while not os.path.exists(path) and path != support.TESTFN:
+ while not os.path.exists(path) and path != os_helper.TESTFN:
path = os.path.dirname(path)
os.removedirs(path)
@@ -1513,17 +1516,17 @@ class ChownFileTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
- os.mkdir(support.TESTFN)
+ os.mkdir(os_helper.TESTFN)
def test_chown_uid_gid_arguments_must_be_index(self):
- stat = os.stat(support.TESTFN)
+ stat = os.stat(os_helper.TESTFN)
uid = stat.st_uid
gid = stat.st_gid
for value in (-1.0, -1j, decimal.Decimal(-1), fractions.Fraction(-2, 2)):
- self.assertRaises(TypeError, os.chown, support.TESTFN, value, gid)
- self.assertRaises(TypeError, os.chown, support.TESTFN, uid, value)
- self.assertIsNone(os.chown(support.TESTFN, uid, gid))
- self.assertIsNone(os.chown(support.TESTFN, -1, -1))
+ self.assertRaises(TypeError, os.chown, os_helper.TESTFN, value, gid)
+ self.assertRaises(TypeError, os.chown, os_helper.TESTFN, uid, value)
+ self.assertIsNone(os.chown(os_helper.TESTFN, uid, gid))
+ self.assertIsNone(os.chown(os_helper.TESTFN, -1, -1))
@unittest.skipUnless(hasattr(os, 'getgroups'), 'need os.getgroups')
def test_chown_gid(self):
@@ -1532,61 +1535,61 @@ def test_chown_gid(self):
self.skipTest("test needs at least 2 groups")
gid_1, gid_2 = groups[:2]
- uid = os.stat(support.TESTFN).st_uid
+ uid = os.stat(os_helper.TESTFN).st_uid
- os.chown(support.TESTFN, uid, gid_1)
- gid = os.stat(support.TESTFN).st_gid
+ os.chown(os_helper.TESTFN, uid, gid_1)
+ gid = os.stat(os_helper.TESTFN).st_gid
self.assertEqual(gid, gid_1)
- os.chown(support.TESTFN, uid, gid_2)
- gid = os.stat(support.TESTFN).st_gid
+ os.chown(os_helper.TESTFN, uid, gid_2)
+ gid = os.stat(os_helper.TESTFN).st_gid
self.assertEqual(gid, gid_2)
@unittest.skipUnless(root_in_posix and len(all_users) > 1,
"test needs root privilege and more than one user")
def test_chown_with_root(self):
uid_1, uid_2 = all_users[:2]
- gid = os.stat(support.TESTFN).st_gid
- os.chown(support.TESTFN, uid_1, gid)
- uid = os.stat(support.TESTFN).st_uid
+ gid = os.stat(os_helper.TESTFN).st_gid
+ os.chown(os_helper.TESTFN, uid_1, gid)
+ uid = os.stat(os_helper.TESTFN).st_uid
self.assertEqual(uid, uid_1)
- os.chown(support.TESTFN, uid_2, gid)
- uid = os.stat(support.TESTFN).st_uid
+ os.chown(os_helper.TESTFN, uid_2, gid)
+ uid = os.stat(os_helper.TESTFN).st_uid
self.assertEqual(uid, uid_2)
@unittest.skipUnless(not root_in_posix and len(all_users) > 1,
"test needs non-root account and more than one user")
def test_chown_without_permission(self):
uid_1, uid_2 = all_users[:2]
- gid = os.stat(support.TESTFN).st_gid
+ gid = os.stat(os_helper.TESTFN).st_gid
with self.assertRaises(PermissionError):
- os.chown(support.TESTFN, uid_1, gid)
- os.chown(support.TESTFN, uid_2, gid)
+ os.chown(os_helper.TESTFN, uid_1, gid)
+ os.chown(os_helper.TESTFN, uid_2, gid)
@classmethod
def tearDownClass(cls):
- os.rmdir(support.TESTFN)
+ os.rmdir(os_helper.TESTFN)
class RemoveDirsTests(unittest.TestCase):
def setUp(self):
- os.makedirs(support.TESTFN)
+ os.makedirs(os_helper.TESTFN)
def tearDown(self):
- support.rmtree(support.TESTFN)
+ os_helper.rmtree(os_helper.TESTFN)
def test_remove_all(self):
- dira = os.path.join(support.TESTFN, 'dira')
+ dira = os.path.join(os_helper.TESTFN, 'dira')
os.mkdir(dira)
dirb = os.path.join(dira, 'dirb')
os.mkdir(dirb)
os.removedirs(dirb)
self.assertFalse(os.path.exists(dirb))
self.assertFalse(os.path.exists(dira))
- self.assertFalse(os.path.exists(support.TESTFN))
+ self.assertFalse(os.path.exists(os_helper.TESTFN))
def test_remove_partial(self):
- dira = os.path.join(support.TESTFN, 'dira')
+ dira = os.path.join(os_helper.TESTFN, 'dira')
os.mkdir(dira)
dirb = os.path.join(dira, 'dirb')
os.mkdir(dirb)
@@ -1594,10 +1597,10 @@ def test_remove_partial(self):
os.removedirs(dirb)
self.assertFalse(os.path.exists(dirb))
self.assertTrue(os.path.exists(dira))
- self.assertTrue(os.path.exists(support.TESTFN))
+ self.assertTrue(os.path.exists(os_helper.TESTFN))
def test_remove_nothing(self):
- dira = os.path.join(support.TESTFN, 'dira')
+ dira = os.path.join(os_helper.TESTFN, 'dira')
os.mkdir(dira)
dirb = os.path.join(dira, 'dirb')
os.mkdir(dirb)
@@ -1606,7 +1609,7 @@ def test_remove_nothing(self):
os.removedirs(dirb)
self.assertTrue(os.path.exists(dirb))
self.assertTrue(os.path.exists(dira))
- self.assertTrue(os.path.exists(support.TESTFN))
+ self.assertTrue(os.path.exists(os_helper.TESTFN))
class DevNullTests(unittest.TestCase):
@@ -1744,8 +1747,8 @@ def test_urandom_fd_closed(self):
def test_urandom_fd_reopened(self):
# Issue #21207: urandom() should detect its fd to /dev/urandom
# changed to something else, and reopen it.
- self.addCleanup(support.unlink, support.TESTFN)
- create_file(support.TESTFN, b"x" * 256)
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+ create_file(os_helper.TESTFN, b"x" * 256)
code = """if 1:
import os
@@ -1771,7 +1774,7 @@ def test_urandom_fd_reopened(self):
os.dup2(new_fd, fd)
sys.stdout.buffer.write(os.urandom(4))
sys.stdout.buffer.write(os.urandom(4))
- """.format(TESTFN=support.TESTFN)
+ """.format(TESTFN=os_helper.TESTFN)
rc, out, err = assert_python_ok('-Sc', code)
self.assertEqual(len(out), 8)
self.assertNotEqual(out[0:4], out[4:8])
@@ -1923,36 +1926,36 @@ def test_execve_with_empty_path(self):
class Win32ErrorTests(unittest.TestCase):
def setUp(self):
try:
- os.stat(support.TESTFN)
+ os.stat(os_helper.TESTFN)
except FileNotFoundError:
exists = False
except OSError as exc:
exists = True
self.fail("file %s must not exist; os.stat failed with %s"
- % (support.TESTFN, exc))
+ % (os_helper.TESTFN, exc))
else:
- self.fail("file %s must not exist" % support.TESTFN)
+ self.fail("file %s must not exist" % os_helper.TESTFN)
def test_rename(self):
- self.assertRaises(OSError, os.rename, support.TESTFN, support.TESTFN+".bak")
+ self.assertRaises(OSError, os.rename, os_helper.TESTFN, os_helper.TESTFN+".bak")
def test_remove(self):
- self.assertRaises(OSError, os.remove, support.TESTFN)
+ self.assertRaises(OSError, os.remove, os_helper.TESTFN)
def test_chdir(self):
- self.assertRaises(OSError, os.chdir, support.TESTFN)
+ self.assertRaises(OSError, os.chdir, os_helper.TESTFN)
def test_mkdir(self):
- self.addCleanup(support.unlink, support.TESTFN)
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
- with open(support.TESTFN, "x") as f:
- self.assertRaises(OSError, os.mkdir, support.TESTFN)
+ with open(os_helper.TESTFN, "x") as f:
+ self.assertRaises(OSError, os.mkdir, os_helper.TESTFN)
def test_utime(self):
- self.assertRaises(OSError, os.utime, support.TESTFN, None)
+ self.assertRaises(OSError, os.utime, os_helper.TESTFN, None)
def test_chmod(self):
- self.assertRaises(OSError, os.chmod, support.TESTFN, 0)
+ self.assertRaises(OSError, os.chmod, os_helper.TESTFN, 0)
class TestInvalidFD(unittest.TestCase):
@@ -1970,7 +1973,7 @@ def helper(self):
def check(self, f, *args):
try:
- f(support.make_bad_fd(), *args)
+ f(os_helper.make_bad_fd(), *args)
except OSError as e:
self.assertEqual(e.errno, errno.EBADF)
else:
@@ -1979,11 +1982,11 @@ def check(self, f, *args):
@unittest.skipUnless(hasattr(os, 'isatty'), 'test needs os.isatty()')
def test_isatty(self):
- self.assertEqual(os.isatty(support.make_bad_fd()), False)
+ self.assertEqual(os.isatty(os_helper.make_bad_fd()), False)
@unittest.skipUnless(hasattr(os, 'closerange'), 'test needs os.closerange()')
def test_closerange(self):
- fd = support.make_bad_fd()
+ fd = os_helper.make_bad_fd()
# Make sure none of the descriptors we are about to close are
# currently valid (issue 6542).
for i in range(10):
@@ -2057,8 +2060,8 @@ def test_blocking(self):
class LinkTests(unittest.TestCase):
def setUp(self):
- self.file1 = support.TESTFN
- self.file2 = os.path.join(support.TESTFN + "2")
+ self.file1 = os_helper.TESTFN
+ self.file2 = os.path.join(os_helper.TESTFN + "2")
def tearDown(self):
for file in (self.file1, self.file2):
@@ -2163,12 +2166,12 @@ def test_setregid_neg1(self):
@unittest.skipIf(sys.platform == "win32", "Posix specific tests")
class Pep383Tests(unittest.TestCase):
def setUp(self):
- if support.TESTFN_UNENCODABLE:
- self.dir = support.TESTFN_UNENCODABLE
- elif support.TESTFN_NONASCII:
- self.dir = support.TESTFN_NONASCII
+ if os_helper.TESTFN_UNENCODABLE:
+ self.dir = os_helper.TESTFN_UNENCODABLE
+ elif os_helper.TESTFN_NONASCII:
+ self.dir = os_helper.TESTFN_NONASCII
else:
- self.dir = support.TESTFN
+ self.dir = os_helper.TESTFN
self.bdir = os.fsencode(self.dir)
bytesfn = []
@@ -2178,11 +2181,11 @@ def add_filename(fn):
except UnicodeEncodeError:
return
bytesfn.append(fn)
- add_filename(support.TESTFN_UNICODE)
- if support.TESTFN_UNENCODABLE:
- add_filename(support.TESTFN_UNENCODABLE)
- if support.TESTFN_NONASCII:
- add_filename(support.TESTFN_NONASCII)
+ add_filename(os_helper.TESTFN_UNICODE)
+ if os_helper.TESTFN_UNENCODABLE:
+ add_filename(os_helper.TESTFN_UNENCODABLE)
+ if os_helper.TESTFN_NONASCII:
+ add_filename(os_helper.TESTFN_NONASCII)
if not bytesfn:
self.skipTest("couldn't create any non-ascii filename")
@@ -2190,7 +2193,7 @@ def add_filename(fn):
os.mkdir(self.dir)
try:
for fn in bytesfn:
- support.create_empty_file(os.path.join(self.bdir, fn))
+ os_helper.create_empty_file(os.path.join(self.bdir, fn))
fn = os.fsdecode(fn)
if fn in self.unicodefn:
raise ValueError("duplicate filename")
@@ -2356,9 +2359,9 @@ def setUp(self):
self.created_paths = []
for i in range(2):
dir_name = 'SUB%d' % i
- dir_path = os.path.join(support.TESTFN, dir_name)
+ dir_path = os.path.join(os_helper.TESTFN, dir_name)
file_name = 'FILE%d' % i
- file_path = os.path.join(support.TESTFN, file_name)
+ file_path = os.path.join(os_helper.TESTFN, file_name)
os.makedirs(dir_path)
with open(file_path, 'w', encoding='utf-8') as f:
f.write("I'm %s and proud of it. Blame test_os.\n" % file_path)
@@ -2366,31 +2369,31 @@ def setUp(self):
self.created_paths.sort()
def tearDown(self):
- shutil.rmtree(support.TESTFN)
+ shutil.rmtree(os_helper.TESTFN)
def test_listdir_no_extended_path(self):
"""Test when the path is not an "extended" path."""
# unicode
self.assertEqual(
- sorted(os.listdir(support.TESTFN)),
+ sorted(os.listdir(os_helper.TESTFN)),
self.created_paths)
# bytes
self.assertEqual(
- sorted(os.listdir(os.fsencode(support.TESTFN))),
+ sorted(os.listdir(os.fsencode(os_helper.TESTFN))),
[os.fsencode(path) for path in self.created_paths])
def test_listdir_extended_path(self):
"""Test when the path starts with '\\\\?\\'."""
# See: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).a…
# unicode
- path = '\\\\?\\' + os.path.abspath(support.TESTFN)
+ path = '\\\\?\\' + os.path.abspath(os_helper.TESTFN)
self.assertEqual(
sorted(os.listdir(path)),
self.created_paths)
# bytes
- path = b'\\\\?\\' + os.fsencode(os.path.abspath(support.TESTFN))
+ path = b'\\\\?\\' + os.fsencode(os.path.abspath(os_helper.TESTFN))
self.assertEqual(
sorted(os.listdir(path)),
[os.fsencode(path) for path in self.created_paths])
@@ -2433,32 +2436,32 @@ def test_missing_link(self):
self.assertRaises(FileNotFoundError, os.readlink,
FakePath('missing-link'))
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_pathlike(self):
os.symlink(self.filelink_target, self.filelink)
- self.addCleanup(support.unlink, self.filelink)
+ self.addCleanup(os_helper.unlink, self.filelink)
filelink = FakePath(self.filelink)
self.assertPathEqual(os.readlink(filelink), self.filelink_target)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_pathlike_bytes(self):
os.symlink(self.filelinkb_target, self.filelinkb)
- self.addCleanup(support.unlink, self.filelinkb)
+ self.addCleanup(os_helper.unlink, self.filelinkb)
path = os.readlink(FakePath(self.filelinkb))
self.assertPathEqual(path, self.filelinkb_target)
self.assertIsInstance(path, bytes)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_bytes(self):
os.symlink(self.filelinkb_target, self.filelinkb)
- self.addCleanup(support.unlink, self.filelinkb)
+ self.addCleanup(os_helper.unlink, self.filelinkb)
path = os.readlink(self.filelinkb)
self.assertPathEqual(path, self.filelinkb_target)
self.assertIsInstance(path, bytes)
@unittest.skipUnless(sys.platform == "win32", "Win32 specific tests")
-(a)support.skip_unless_symlink
+(a)os_helper.skip_unless_symlink
class Win32SymlinkTests(unittest.TestCase):
filelink = 'filelinktest'
filelink_target = os.path.abspath(__file__)
@@ -2529,10 +2532,10 @@ def check_stat(self, link, target):
self.assertNotEqual(os.lstat(bytes_link), os.stat(bytes_link))
def test_12084(self):
- level1 = os.path.abspath(support.TESTFN)
+ level1 = os.path.abspath(os_helper.TESTFN)
level2 = os.path.join(level1, "level2")
level3 = os.path.join(level2, "level3")
- self.addCleanup(support.rmtree, level1)
+ self.addCleanup(os_helper.rmtree, level1)
os.mkdir(level1)
os.mkdir(level2)
@@ -2718,7 +2721,7 @@ def test_getfinalpathname_handles(self):
self.assertEqual(0, handle_delta)
-(a)support.skip_unless_symlink
+(a)os_helper.skip_unless_symlink
class NonLocalSymlinkTests(unittest.TestCase):
def setUp(self):
@@ -2857,8 +2860,8 @@ class SpawnTests(unittest.TestCase):
def create_args(self, *, with_env=False, use_bytes=False):
self.exitcode = 17
- filename = support.TESTFN
- self.addCleanup(support.unlink, filename)
+ filename = os_helper.TESTFN
+ self.addCleanup(os_helper.unlink, filename)
if not with_env:
code = 'import sys; sys.exit(%s)' % self.exitcode
@@ -3009,8 +3012,8 @@ def _test_invalid_env(self, spawn):
self.assertEqual(exitcode, 127)
# equal character in the environment variable value
- filename = support.TESTFN
- self.addCleanup(support.unlink, filename)
+ filename = os_helper.TESTFN
+ self.addCleanup(os_helper.unlink, filename)
with open(filename, "w") as fp:
fp.write('import sys, os\n'
'if os.getenv("FRUIT") != "orange=lemon":\n'
@@ -3165,12 +3168,12 @@ class TestSendfile(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.key = threading_helper.threading_setup()
- create_file(support.TESTFN, cls.DATA)
+ create_file(os_helper.TESTFN, cls.DATA)
@classmethod
def tearDownClass(cls):
threading_helper.threading_cleanup(*cls.key)
- support.unlink(support.TESTFN)
+ os_helper.unlink(os_helper.TESTFN)
def setUp(self):
self.server = SendfileTestServer((socket_helper.HOST, 0))
@@ -3181,7 +3184,7 @@ def setUp(self):
# synchronize by waiting for "220 ready" response
self.client.recv(1024)
self.sockno = self.client.fileno()
- self.file = open(support.TESTFN, 'rb')
+ self.file = open(os_helper.TESTFN, 'rb')
self.fileno = self.file.fileno()
def tearDown(self):
@@ -3313,10 +3316,10 @@ def test_headers(self):
@requires_headers_trailers
def test_trailers(self):
- TESTFN2 = support.TESTFN + "2"
+ TESTFN2 = os_helper.TESTFN + "2"
file_data = b"abcdef"
- self.addCleanup(support.unlink, TESTFN2)
+ self.addCleanup(os_helper.unlink, TESTFN2)
create_file(TESTFN2, file_data)
with open(TESTFN2, 'rb') as f:
@@ -3362,13 +3365,13 @@ def supports_extended_attributes():
return False
try:
- with open(support.TESTFN, "xb", 0) as fp:
+ with open(os_helper.TESTFN, "xb", 0) as fp:
try:
os.setxattr(fp.fileno(), b"user.test", b"")
except OSError:
return False
finally:
- support.unlink(support.TESTFN)
+ os_helper.unlink(os_helper.TESTFN)
return True
@@ -3380,8 +3383,8 @@ def supports_extended_attributes():
class ExtendedAttributeTests(unittest.TestCase):
def _check_xattrs_str(self, s, getxattr, setxattr, removexattr, listxattr, **kwargs):
- fn = support.TESTFN
- self.addCleanup(support.unlink, fn)
+ fn = os_helper.TESTFN
+ self.addCleanup(os_helper.unlink, fn)
create_file(fn)
with self.assertRaises(OSError) as cm:
@@ -3429,10 +3432,10 @@ def _check_xattrs_str(self, s, getxattr, setxattr, removexattr, listxattr, **kwa
def _check_xattrs(self, *args, **kwargs):
self._check_xattrs_str(str, *args, **kwargs)
- support.unlink(support.TESTFN)
+ os_helper.unlink(os_helper.TESTFN)
self._check_xattrs_str(os.fsencode, *args, **kwargs)
- support.unlink(support.TESTFN)
+ os_helper.unlink(os_helper.TESTFN)
def test_simple(self):
self._check_xattrs(os.getxattr, os.setxattr, os.removexattr,
@@ -3531,16 +3534,16 @@ class Str(str):
self.bytes_filenames = []
self.unicode_filenames = []
- if support.TESTFN_UNENCODABLE is not None:
- decoded = support.TESTFN_UNENCODABLE
+ if os_helper.TESTFN_UNENCODABLE is not None:
+ decoded = os_helper.TESTFN_UNENCODABLE
else:
- decoded = support.TESTFN
+ decoded = os_helper.TESTFN
self.unicode_filenames.append(decoded)
self.unicode_filenames.append(Str(decoded))
- if support.TESTFN_UNDECODABLE is not None:
- encoded = support.TESTFN_UNDECODABLE
+ if os_helper.TESTFN_UNDECODABLE is not None:
+ encoded = os_helper.TESTFN_UNDECODABLE
else:
- encoded = os.fsencode(support.TESTFN)
+ encoded = os.fsencode(os_helper.TESTFN)
self.bytes_filenames.append(encoded)
self.bytes_filenames.append(bytearray(encoded))
self.bytes_filenames.append(memoryview(encoded))
@@ -3734,14 +3737,14 @@ class PathTConverterTests(unittest.TestCase):
]
def test_path_t_converter(self):
- str_filename = support.TESTFN
+ str_filename = os_helper.TESTFN
if os.name == 'nt':
bytes_fspath = bytes_filename = None
else:
- bytes_filename = os.fsencode(support.TESTFN)
+ bytes_filename = os.fsencode(os_helper.TESTFN)
bytes_fspath = FakePath(bytes_filename)
fd = os.open(FakePath(str_filename), os.O_WRONLY|os.O_CREAT)
- self.addCleanup(support.unlink, support.TESTFN)
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
self.addCleanup(os.close, fd)
int_fspath = FakePath(fd)
@@ -3811,8 +3814,8 @@ def test_os_all(self):
class TestDirEntry(unittest.TestCase):
def setUp(self):
- self.path = os.path.realpath(support.TESTFN)
- self.addCleanup(support.rmtree, self.path)
+ self.path = os.path.realpath(os_helper.TESTFN)
+ self.addCleanup(os_helper.rmtree, self.path)
os.mkdir(self.path)
def test_uninstantiable(self):
@@ -3828,12 +3831,12 @@ def test_unpickable(self):
class TestScandir(unittest.TestCase):
- check_no_resource_warning = support.check_no_resource_warning
+ check_no_resource_warning = warnings_helper.check_no_resource_warning
def setUp(self):
- self.path = os.path.realpath(support.TESTFN)
+ self.path = os.path.realpath(os_helper.TESTFN)
self.bytes_path = os.fsencode(self.path)
- self.addCleanup(support.rmtree, self.path)
+ self.addCleanup(os_helper.rmtree, self.path)
os.mkdir(self.path)
def create_file(self, name="file.txt"):
@@ -3903,7 +3906,7 @@ def check_entry(self, entry, name, is_dir, is_file, is_symlink):
def test_attributes(self):
link = hasattr(os, 'link')
- symlink = support.can_symlink()
+ symlink = os_helper.can_symlink()
dirname = os.path.join(self.path, "dir")
os.mkdir(dirname)
@@ -4027,7 +4030,7 @@ def test_removed_file(self):
self.assertRaises(FileNotFoundError, entry.stat, follow_symlinks=False)
def test_broken_symlink(self):
- if not support.can_symlink():
+ if not os_helper.can_symlink():
return self.skipTest('cannot create symbolic link')
filename = self.create_file("file.txt")
@@ -4081,7 +4084,7 @@ def test_fd(self):
self.assertIn(os.scandir, os.supports_fd)
self.create_file('file.txt')
expected_names = ['file.txt']
- if support.can_symlink():
+ if os_helper.can_symlink():
os.symlink('file.txt', os.path.join(self.path, 'link'))
expected_names.append('link')
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index e56b337083c8f..06ca50af14337 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -30,7 +30,8 @@
posix = None
from test import support
-from test.support import TESTFN, FakePath
+from test.support import os_helper
+from test.support.os_helper import TESTFN, FakePath
TESTFN2 = TESTFN + "2"
MACOS = sys.platform.startswith("darwin")
@@ -140,9 +141,9 @@ def supports_file2file_sendfile():
return True
finally:
if srcname is not None:
- support.unlink(srcname)
+ os_helper.unlink(srcname)
if dstname is not None:
- support.unlink(dstname)
+ os_helper.unlink(dstname)
SUPPORTS_SENDFILE = supports_file2file_sendfile()
@@ -168,7 +169,7 @@ def mkdtemp(self, prefix=None):
Returns the path of the directory.
"""
d = tempfile.mkdtemp(prefix=prefix, dir=os.getcwd())
- self.addCleanup(support.rmtree, d)
+ self.addCleanup(os_helper.rmtree, d)
return d
@@ -183,7 +184,7 @@ def test_rmtree_works_on_bytes(self):
self.assertIsInstance(victim, bytes)
shutil.rmtree(victim)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_rmtree_fails_on_symlink(self):
tmp = self.mkdtemp()
dir_ = os.path.join(tmp, 'dir')
@@ -202,7 +203,7 @@ def onerror(*args):
self.assertEqual(errors[0][1], link)
self.assertIsInstance(errors[0][2][1], OSError)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_rmtree_works_on_symlinks(self):
tmp = self.mkdtemp()
dir1 = os.path.join(tmp, 'dir1')
@@ -231,7 +232,7 @@ def test_rmtree_fails_on_junctions(self):
os.mkdir(dir_)
link = os.path.join(tmp, 'link')
_winapi.CreateJunction(dir_, link)
- self.addCleanup(support.unlink, link)
+ self.addCleanup(os_helper.unlink, link)
self.assertRaises(OSError, shutil.rmtree, link)
self.assertTrue(os.path.exists(dir_))
self.assertTrue(os.path.lexists(link))
@@ -313,7 +314,7 @@ def test_on_error(self):
self.child_file_path = os.path.join(TESTFN, 'a')
self.child_dir_path = os.path.join(TESTFN, 'b')
- support.create_empty_file(self.child_file_path)
+ os_helper.create_empty_file(self.child_file_path)
os.mkdir(self.child_dir_path)
old_dir_mode = os.stat(TESTFN).st_mode
old_child_file_mode = os.stat(self.child_file_path).st_mode
@@ -407,7 +408,7 @@ def test_rmtree_dont_delete_file(self):
self.assertRaises(NotADirectoryError, shutil.rmtree, path)
os.remove(path)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_rmtree_on_symlink(self):
# bug 1669.
os.mkdir(TESTFN)
@@ -482,7 +483,7 @@ def test_copytree_dirs_exist_ok(self):
with self.assertRaises(FileExistsError):
shutil.copytree(src_dir, dst_dir, dirs_exist_ok=False)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copytree_symlinks(self):
tmp_dir = self.mkdtemp()
src_dir = os.path.join(tmp_dir, 'src')
@@ -634,7 +635,7 @@ def test_copytree_retains_permissions(self):
write_file((src_dir, 'restrictive.txt'), '456')
os.chmod(os.path.join(src_dir, 'restrictive.txt'), 0o600)
restrictive_subdir = tempfile.mkdtemp(dir=src_dir)
- self.addCleanup(support.rmtree, restrictive_subdir)
+ self.addCleanup(os_helper.rmtree, restrictive_subdir)
os.chmod(restrictive_subdir, 0o600)
shutil.copytree(src_dir, dst_dir)
@@ -681,7 +682,7 @@ def custom_cpfun(a, b):
# Issue #3002: copyfile and copytree block indefinitely on named pipes
@unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()')
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copytree_named_pipe(self):
os.mkdir(TESTFN)
try:
@@ -719,7 +720,7 @@ def _copy(src, dst):
shutil.copytree(src_dir, dst_dir, copy_function=_copy)
self.assertEqual(len(copied), 2)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copytree_dangling_symlinks(self):
# a dangling symlink raises an error at the end
src_dir = self.mkdtemp()
@@ -739,7 +740,7 @@ def test_copytree_dangling_symlinks(self):
shutil.copytree(src_dir, dst_dir, symlinks=True)
self.assertIn('test.txt', os.listdir(dst_dir))
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copytree_symlink_dir(self):
src_dir = self.mkdtemp()
dst_dir = os.path.join(self.mkdtemp(), 'destination')
@@ -785,7 +786,7 @@ class TestCopy(BaseTest, unittest.TestCase):
### shutil.copymode
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copymode_follow_symlinks(self):
tmp_dir = self.mkdtemp()
src = os.path.join(tmp_dir, 'foo')
@@ -818,7 +819,7 @@ def test_copymode_follow_symlinks(self):
self.assertEqual(os.stat(src).st_mode, os.stat(dst).st_mode)
@unittest.skipUnless(hasattr(os, 'lchmod'), 'requires os.lchmod')
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copymode_symlink_to_symlink(self):
tmp_dir = self.mkdtemp()
src = os.path.join(tmp_dir, 'foo')
@@ -848,7 +849,7 @@ def test_copymode_symlink_to_symlink(self):
self.assertEqual(os.stat(src).st_mode, os.stat(dst).st_mode)
@unittest.skipIf(hasattr(os, 'lchmod'), 'requires os.lchmod to be missing')
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copymode_symlink_to_symlink_wo_lchmod(self):
tmp_dir = self.mkdtemp()
src = os.path.join(tmp_dir, 'foo')
@@ -863,7 +864,7 @@ def test_copymode_symlink_to_symlink_wo_lchmod(self):
### shutil.copystat
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copystat_symlinks(self):
tmp_dir = self.mkdtemp()
src = os.path.join(tmp_dir, 'foo')
@@ -935,7 +936,7 @@ def _chflags_raiser(path, flags, *, follow_symlinks=True):
### shutil.copyxattr
- @support.skip_unless_xattr
+ @os_helper.skip_unless_xattr
def test_copyxattr(self):
tmp_dir = self.mkdtemp()
src = os.path.join(tmp_dir, 'foo')
@@ -999,8 +1000,8 @@ def _raise_on_src(fname, *, follow_symlinks=True):
self.assertEqual(os.getxattr(dst, 'user.the_value'), b'fiddly')
self.assertEqual(os.getxattr(dstro, 'user.the_value'), b'fiddly')
- @support.skip_unless_symlink
- @support.skip_unless_xattr
+ @os_helper.skip_unless_symlink
+ @os_helper.skip_unless_xattr
@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
'root privileges required')
def test_copyxattr_symlinks(self):
@@ -1042,7 +1043,7 @@ def test_copy(self):
self.assertTrue(os.path.exists(file2))
self.assertEqual(os.stat(file1).st_mode, os.stat(file2).st_mode)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copy_symlinks(self):
tmp_dir = self.mkdtemp()
src = os.path.join(tmp_dir, 'foo')
@@ -1084,7 +1085,7 @@ def test_copy2(self):
self.assertEqual(getattr(file1_stat, 'st_flags'),
getattr(file2_stat, 'st_flags'))
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copy2_symlinks(self):
tmp_dir = self.mkdtemp()
src = os.path.join(tmp_dir, 'foo')
@@ -1119,7 +1120,7 @@ def test_copy2_symlinks(self):
if hasattr(os, 'lchflags') and hasattr(src_link_stat, 'st_flags'):
self.assertEqual(src_link_stat.st_flags, dst_stat.st_flags)
- @support.skip_unless_xattr
+ @os_helper.skip_unless_xattr
def test_copy2_xattr(self):
tmp_dir = self.mkdtemp()
src = os.path.join(tmp_dir, 'foo')
@@ -1146,7 +1147,7 @@ def test_copy_return_value(self):
### shutil.copyfile
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_copyfile_symlinks(self):
tmp_dir = self.mkdtemp()
src = os.path.join(tmp_dir, 'src')
@@ -1183,7 +1184,7 @@ def test_dont_copy_file_onto_link_to_itself(self):
finally:
shutil.rmtree(TESTFN, ignore_errors=True)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_dont_copy_file_onto_symlink_to_itself(self):
# bug 851123.
os.mkdir(TESTFN)
@@ -1258,7 +1259,7 @@ def test_make_tarball(self):
work_dir = os.path.dirname(tmpdir2)
rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive')
- with support.change_cwd(work_dir):
+ with os_helper.change_cwd(work_dir):
base_name = os.path.abspath(rel_base_name)
tarball = make_archive(rel_base_name, 'gztar', root_dir, '.')
@@ -1272,7 +1273,7 @@ def test_make_tarball(self):
'./file1', './file2', './sub/file3'])
# trying an uncompressed one
- with support.change_cwd(work_dir):
+ with os_helper.change_cwd(work_dir):
tarball = make_archive(rel_base_name, 'tar', root_dir, '.')
self.assertEqual(tarball, base_name + '.tar')
self.assertTrue(os.path.isfile(tarball))
@@ -1347,7 +1348,7 @@ def test_make_zipfile(self):
work_dir = os.path.dirname(tmpdir2)
rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive')
- with support.change_cwd(work_dir):
+ with os_helper.change_cwd(work_dir):
base_name = os.path.abspath(rel_base_name)
res = make_archive(rel_base_name, 'zip', root_dir)
@@ -1360,7 +1361,7 @@ def test_make_zipfile(self):
'dist/file1', 'dist/file2', 'dist/sub/file3',
'outer'])
- with support.change_cwd(work_dir):
+ with os_helper.change_cwd(work_dir):
base_name = os.path.abspath(rel_base_name)
res = make_archive(rel_base_name, 'zip', root_dir, base_dir)
@@ -1412,7 +1413,7 @@ def test_unzip_zipfile(self):
# now check the ZIP file using `unzip -t`
zip_cmd = ['unzip', '-t', archive]
- with support.change_cwd(root_dir):
+ with os_helper.change_cwd(root_dir):
try:
subprocess.check_output(zip_cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as exc:
@@ -1462,7 +1463,7 @@ def test_tarfile_root_owner(self):
base_name = os.path.join(self.mkdtemp(), 'archive')
group = grp.getgrgid(0)[0]
owner = pwd.getpwuid(0)[0]
- with support.change_cwd(root_dir):
+ with os_helper.change_cwd(root_dir):
archive_name = make_archive(base_name, 'gztar', root_dir, 'dist',
owner=owner, group=group)
@@ -1496,7 +1497,7 @@ def _breaks(*args, **kw):
def test_make_tarfile_in_curdir(self):
# Issue #21280
root_dir = self.mkdtemp()
- with support.change_cwd(root_dir):
+ with os_helper.change_cwd(root_dir):
self.assertEqual(make_archive('test', 'tar'), 'test.tar')
self.assertTrue(os.path.isfile('test.tar'))
@@ -1504,7 +1505,7 @@ def test_make_tarfile_in_curdir(self):
def test_make_zipfile_in_curdir(self):
# Issue #21280
root_dir = self.mkdtemp()
- with support.change_cwd(root_dir):
+ with os_helper.change_cwd(root_dir):
self.assertEqual(make_archive('test', 'zip'), 'test.zip')
self.assertTrue(os.path.isfile('test.zip'))
@@ -1711,18 +1712,18 @@ def test_relative_cmd(self):
# that exists, it should be returned.
base_dir, tail_dir = os.path.split(self.dir)
relpath = os.path.join(tail_dir, self.file)
- with support.change_cwd(path=base_dir):
+ with os_helper.change_cwd(path=base_dir):
rv = shutil.which(relpath, path=self.temp_dir)
self.assertEqual(rv, relpath)
# But it shouldn't be searched in PATH directories (issue #16957).
- with support.change_cwd(path=self.dir):
+ with os_helper.change_cwd(path=self.dir):
rv = shutil.which(relpath, path=base_dir)
self.assertIsNone(rv)
def test_cwd(self):
# Issue #16957
base_dir = os.path.dirname(self.dir)
- with support.change_cwd(path=self.dir):
+ with os_helper.change_cwd(path=self.dir):
rv = shutil.which(self.file, path=base_dir)
if sys.platform == "win32":
# Windows: current directory implicitly on PATH
@@ -1743,7 +1744,7 @@ def test_non_matching_mode(self):
def test_relative_path(self):
base_dir, tail_dir = os.path.split(self.dir)
- with support.change_cwd(path=base_dir):
+ with os_helper.change_cwd(path=base_dir):
rv = shutil.which(self.file, path=tail_dir)
self.assertEqual(rv, os.path.join(tail_dir, self.file))
@@ -1761,19 +1762,19 @@ def test_pathext_checking(self):
self.assertEqual(rv, self.temp_file.name[:-4] + self.ext)
def test_environ_path(self):
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env['PATH'] = self.env_path
rv = shutil.which(self.file)
self.assertEqual(rv, self.temp_file.name)
def test_environ_path_empty(self):
# PATH='': no match
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env['PATH'] = ''
with unittest.mock.patch('os.confstr', return_value=self.dir, \
create=True), \
support.swap_attr(os, 'defpath', self.dir), \
- support.change_cwd(self.dir):
+ os_helper.change_cwd(self.dir):
rv = shutil.which(self.file)
self.assertIsNone(rv)
@@ -1786,7 +1787,7 @@ def test_environ_path_cwd(self):
expected_cwd = os.path.join(curdir, expected_cwd)
# PATH=':': explicitly looks in the current directory
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env['PATH'] = os.pathsep
with unittest.mock.patch('os.confstr', return_value=self.dir, \
create=True), \
@@ -1795,12 +1796,12 @@ def test_environ_path_cwd(self):
self.assertIsNone(rv)
# look in current directory
- with support.change_cwd(self.dir):
+ with os_helper.change_cwd(self.dir):
rv = shutil.which(self.file)
self.assertEqual(rv, expected_cwd)
def test_environ_path_missing(self):
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env.pop('PATH', None)
# without confstr
@@ -1819,14 +1820,14 @@ def test_environ_path_missing(self):
def test_empty_path(self):
base_dir = os.path.dirname(self.dir)
- with support.change_cwd(path=self.dir), \
- support.EnvironmentVarGuard() as env:
+ with os_helper.change_cwd(path=self.dir), \
+ os_helper.EnvironmentVarGuard() as env:
env['PATH'] = self.env_path
rv = shutil.which(self.file, path='')
self.assertIsNone(rv)
def test_empty_path_no_PATH(self):
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env.pop('PATH', None)
rv = shutil.which(self.file)
self.assertIsNone(rv)
@@ -1843,7 +1844,7 @@ def test_pathext(self):
program = os.path.basename(temp_filexyz.name)
program = os.path.splitext(program)[0]
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env['PATHEXT'] = ext
rv = shutil.which(program, path=self.temp_dir)
self.assertEqual(rv, temp_filexyz.name)
@@ -1918,7 +1919,7 @@ def test_move_dir(self):
try:
self._check_move_dir(self.src_dir, dst_dir, dst_dir)
finally:
- support.rmtree(dst_dir)
+ os_helper.rmtree(dst_dir)
@mock_rename
def test_move_dir_other_fs(self):
@@ -1965,7 +1966,7 @@ def test_destinsrc_false_negative(self):
msg='_destinsrc() wrongly concluded that '
'dst (%s) is not in src (%s)' % (dst, src))
finally:
- support.rmtree(TESTFN)
+ os_helper.rmtree(TESTFN)
def test_destinsrc_false_positive(self):
os.mkdir(TESTFN)
@@ -1977,9 +1978,9 @@ def test_destinsrc_false_positive(self):
msg='_destinsrc() wrongly concluded that '
'dst (%s) is in src (%s)' % (dst, src))
finally:
- support.rmtree(TESTFN)
+ os_helper.rmtree(TESTFN)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
@mock_rename
def test_move_file_symlink(self):
dst = os.path.join(self.src_dir, 'bar')
@@ -1988,7 +1989,7 @@ def test_move_file_symlink(self):
self.assertTrue(os.path.islink(self.dst_file))
self.assertTrue(os.path.samefile(self.src_file, self.dst_file))
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
@mock_rename
def test_move_file_symlink_to_dir(self):
filename = "bar"
@@ -1999,7 +2000,7 @@ def test_move_file_symlink_to_dir(self):
self.assertTrue(os.path.islink(final_link))
self.assertTrue(os.path.samefile(self.src_file, final_link))
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
@mock_rename
def test_move_dangling_symlink(self):
src = os.path.join(self.src_dir, 'baz')
@@ -2010,7 +2011,7 @@ def test_move_dangling_symlink(self):
self.assertTrue(os.path.islink(dst_link))
self.assertEqual(os.path.realpath(src), os.path.realpath(dst_link))
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
@mock_rename
def test_move_dir_symlink(self):
src = os.path.join(self.src_dir, 'baz')
@@ -2044,8 +2045,8 @@ def test_move_dir_special_function(self):
moved = []
def _copy(src, dst):
moved.append((src, dst))
- support.create_empty_file(os.path.join(self.src_dir, 'child'))
- support.create_empty_file(os.path.join(self.src_dir, 'child1'))
+ os_helper.create_empty_file(os.path.join(self.src_dir, 'child'))
+ os_helper.create_empty_file(os.path.join(self.src_dir, 'child1'))
shutil.move(self.src_dir, self.dst_dir, copy_function=_copy)
self.assertEqual(len(moved), 3)
@@ -2167,11 +2168,11 @@ def setUpClass(cls):
@classmethod
def tearDownClass(cls):
- support.unlink(TESTFN)
- support.unlink(TESTFN2)
+ os_helper.unlink(TESTFN)
+ os_helper.unlink(TESTFN2)
def tearDown(self):
- support.unlink(TESTFN2)
+ os_helper.unlink(TESTFN2)
@contextlib.contextmanager
def get_files(self):
@@ -2216,7 +2217,7 @@ def test_win_impl(self):
with tempfile.NamedTemporaryFile(dir=os.getcwd(), delete=False) as f:
f.write(b'foo')
fname = f.name
- self.addCleanup(support.unlink, fname)
+ self.addCleanup(os_helper.unlink, fname)
with unittest.mock.patch("shutil._copyfileobj_readinto") as m:
shutil.copyfile(fname, TESTFN2)
self.assertEqual(m.call_args[0][2], 3)
@@ -2225,7 +2226,7 @@ def test_win_impl(self):
with tempfile.NamedTemporaryFile(dir=os.getcwd(), delete=False) as f:
pass
fname = f.name
- self.addCleanup(support.unlink, fname)
+ self.addCleanup(os_helper.unlink, fname)
with unittest.mock.patch("shutil._copyfileobj_readinto") as m:
shutil.copyfile(fname, TESTFN2)
assert not m.called
@@ -2247,10 +2248,10 @@ def setUpClass(cls):
@classmethod
def tearDownClass(cls):
- support.unlink(TESTFN)
+ os_helper.unlink(TESTFN)
def tearDown(self):
- support.unlink(TESTFN2)
+ os_helper.unlink(TESTFN2)
@contextlib.contextmanager
def get_files(self):
@@ -2296,8 +2297,8 @@ def test_non_existent_src(self):
def test_empty_file(self):
srcname = TESTFN + 'src'
dstname = TESTFN + 'dst'
- self.addCleanup(lambda: support.unlink(srcname))
- self.addCleanup(lambda: support.unlink(dstname))
+ self.addCleanup(lambda: os_helper.unlink(srcname))
+ self.addCleanup(lambda: os_helper.unlink(dstname))
with open(srcname, "wb"):
pass
@@ -2421,9 +2422,9 @@ def test_blocksize_arg(self):
# sendfile() are the same.
self.assertEqual(blocksize, os.path.getsize(TESTFN))
# ...unless we're dealing with a small file.
- support.unlink(TESTFN2)
+ os_helper.unlink(TESTFN2)
write_file(TESTFN2, b"hello", binary=True)
- self.addCleanup(support.unlink, TESTFN2 + '3')
+ self.addCleanup(os_helper.unlink, TESTFN2 + '3')
self.assertRaises(ZeroDivisionError,
shutil.copyfile, TESTFN2, TESTFN2 + '3')
blocksize = m.call_args[0][3]
@@ -2473,20 +2474,20 @@ def test_does_not_crash(self):
def test_os_environ_first(self):
"Check if environment variables have precedence"
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env['COLUMNS'] = '777'
del env['LINES']
size = shutil.get_terminal_size()
self.assertEqual(size.columns, 777)
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
del env['COLUMNS']
env['LINES'] = '888'
size = shutil.get_terminal_size()
self.assertEqual(size.lines, 888)
def test_bad_environ(self):
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
env['COLUMNS'] = 'xxx'
env['LINES'] = 'yyy'
size = shutil.get_terminal_size()
@@ -2510,7 +2511,7 @@ def test_stty_match(self):
self.skipTest("stty invocation failed")
expected = (int(size[1]), int(size[0])) # reversed order
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
del env['LINES']
del env['COLUMNS']
actual = shutil.get_terminal_size()
@@ -2518,7 +2519,7 @@ def test_stty_match(self):
self.assertEqual(expected, actual)
def test_fallback(self):
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
del env['LINES']
del env['COLUMNS']
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index aced87694cf7b..0162424e2fd6b 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -1,6 +1,9 @@
import unittest
from unittest import mock
from test import support
+from test.support import import_helper
+from test.support import os_helper
+from test.support import warnings_helper
import subprocess
import sys
import signal
@@ -20,7 +23,7 @@
import gc
import textwrap
import json
-from test.support import FakePath
+from test.support.os_helper import FakePath
try:
import _testcapi
@@ -357,7 +360,7 @@ def _normalize_cwd(self, cwd):
# Normalize an expected cwd (for Tru64 support).
# We can't use os.path.realpath since it doesn't expand Tru64 {memb}
# strings. See bug #1063571.
- with support.change_cwd(cwd):
+ with os_helper.change_cwd(cwd):
return os.getcwd()
# For use in the test_cwd* tests below.
@@ -406,7 +409,7 @@ def test_cwd_with_relative_arg(self):
# is relative.
python_dir, python_base = self._split_python_path()
rel_python = os.path.join(os.curdir, python_base)
- with support.temp_cwd() as wrong_dir:
+ with os_helper.temp_cwd() as wrong_dir:
# Before calling with the correct cwd, confirm that the call fails
# without cwd and with the wrong cwd.
self.assertRaises(FileNotFoundError, subprocess.Popen,
@@ -423,7 +426,7 @@ def test_cwd_with_relative_executable(self):
python_dir, python_base = self._split_python_path()
rel_python = os.path.join(os.curdir, python_base)
doesntexist = "somethingyoudonthave"
- with support.temp_cwd() as wrong_dir:
+ with os_helper.temp_cwd() as wrong_dir:
# Before calling with the correct cwd, confirm that the call fails
# without cwd and with the wrong cwd.
self.assertRaises(FileNotFoundError, subprocess.Popen,
@@ -441,7 +444,7 @@ def test_cwd_with_absolute_arg(self):
python_dir, python_base = self._split_python_path()
abs_python = os.path.join(python_dir, python_base)
rel_python = os.path.join(os.curdir, python_base)
- with support.temp_dir() as wrong_dir:
+ with os_helper.temp_dir() as wrong_dir:
# Before calling with an absolute path, confirm that using a
# relative path fails.
self.assertRaises(FileNotFoundError, subprocess.Popen,
@@ -1052,7 +1055,7 @@ def test_no_leaking(self):
try:
for i in range(max_handles):
try:
- tmpfile = os.path.join(tmpdir, support.TESTFN)
+ tmpfile = os.path.join(tmpdir, os_helper.TESTFN)
handles.append(os.open(tmpfile, os.O_WRONLY|os.O_CREAT))
except OSError as e:
if e.errno != errno.EMFILE:
@@ -2881,7 +2884,7 @@ def test_wait_when_sigchild_ignored(self):
def test_select_unbuffered(self):
# Issue #11459: bufsize=0 should really set the pipes as
# unbuffered (and therefore let select() work properly).
- select = support.import_module("select")
+ select = import_helper.import_module("select")
p = subprocess.Popen([sys.executable, "-c",
'import sys;'
'sys.stdout.write("apple")'],
@@ -2909,7 +2912,7 @@ def test_zombie_fast_process_del(self):
self.addCleanup(p.stderr.close)
ident = id(p)
pid = p.pid
- with support.check_warnings(('', ResourceWarning)):
+ with warnings_helper.check_warnings(('', ResourceWarning)):
p = None
if mswindows:
@@ -2934,7 +2937,7 @@ def test_leak_fast_process_del_killed(self):
self.addCleanup(p.stderr.close)
ident = id(p)
pid = p.pid
- with support.check_warnings(('', ResourceWarning)):
+ with warnings_helper.check_warnings(('', ResourceWarning)):
p = None
os.kill(pid, signal.SIGKILL)
@@ -3288,7 +3291,8 @@ def test_close_fds_with_stdio(self):
self.assertIn(b"OSError", stderr)
# Check for a warning due to using handle_list and close_fds=False
- with support.check_warnings((".*overriding close_fds", RuntimeWarning)):
+ with warnings_helper.check_warnings((".*overriding close_fds",
+ RuntimeWarning)):
startupinfo = subprocess.STARTUPINFO()
startupinfo.lpAttributeList = {"handle_list": handles[:]}
p = subprocess.Popen([sys.executable, "-c",
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index a7d5b1bfe4eaf..b268511844b82 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -12,20 +12,24 @@
import time
import unittest
from test import support
+from test.support import import_helper
+from test.support import os_helper
from test.support import script_helper
from test.support import socket_helper
+from test.support import warnings_helper
-TESTFN = support.TESTFN
+TESTFN = os_helper.TESTFN
class TestSupport(unittest.TestCase):
def test_import_module(self):
- support.import_module("ftplib")
- self.assertRaises(unittest.SkipTest, support.import_module, "foo")
+ import_helper.import_module("ftplib")
+ self.assertRaises(unittest.SkipTest,
+ import_helper.import_module, "foo")
def test_import_fresh_module(self):
- support.import_fresh_module("ftplib")
+ import_helper.import_fresh_module("ftplib")
def test_get_attribute(self):
self.assertEqual(support.get_attribute(self, "test_get_attribute"),
@@ -39,38 +43,38 @@ def test_get_original_stdout(self):
def test_unload(self):
import sched
self.assertIn("sched", sys.modules)
- support.unload("sched")
+ import_helper.unload("sched")
self.assertNotIn("sched", sys.modules)
def test_unlink(self):
with open(TESTFN, "w") as f:
pass
- support.unlink(TESTFN)
+ os_helper.unlink(TESTFN)
self.assertFalse(os.path.exists(TESTFN))
- support.unlink(TESTFN)
+ os_helper.unlink(TESTFN)
def test_rmtree(self):
- dirpath = support.TESTFN + 'd'
+ dirpath = os_helper.TESTFN + 'd'
subdirpath = os.path.join(dirpath, 'subdir')
os.mkdir(dirpath)
os.mkdir(subdirpath)
- support.rmtree(dirpath)
+ os_helper.rmtree(dirpath)
self.assertFalse(os.path.exists(dirpath))
with support.swap_attr(support, 'verbose', 0):
- support.rmtree(dirpath)
+ os_helper.rmtree(dirpath)
os.mkdir(dirpath)
os.mkdir(subdirpath)
os.chmod(dirpath, stat.S_IRUSR|stat.S_IXUSR)
with support.swap_attr(support, 'verbose', 0):
- support.rmtree(dirpath)
+ os_helper.rmtree(dirpath)
self.assertFalse(os.path.exists(dirpath))
os.mkdir(dirpath)
os.mkdir(subdirpath)
os.chmod(dirpath, 0)
with support.swap_attr(support, 'verbose', 0):
- support.rmtree(dirpath)
+ os_helper.rmtree(dirpath)
self.assertFalse(os.path.exists(dirpath))
def test_forget(self):
@@ -83,12 +87,12 @@ def test_forget(self):
mod = __import__(TESTFN)
self.assertIn(TESTFN, sys.modules)
- support.forget(TESTFN)
+ import_helper.forget(TESTFN)
self.assertNotIn(TESTFN, sys.modules)
finally:
del sys.path[0]
- support.unlink(mod_filename)
- support.rmtree('__pycache__')
+ os_helper.unlink(mod_filename)
+ os_helper.rmtree('__pycache__')
def test_HOST(self):
s = socket.create_server((socket_helper.HOST, 0))
@@ -115,23 +119,23 @@ def test_temp_dir(self):
try:
path = os.path.join(parent_dir, 'temp')
self.assertFalse(os.path.isdir(path))
- with support.temp_dir(path) as temp_path:
+ with os_helper.temp_dir(path) as temp_path:
self.assertEqual(temp_path, path)
self.assertTrue(os.path.isdir(path))
self.assertFalse(os.path.isdir(path))
finally:
- support.rmtree(parent_dir)
+ os_helper.rmtree(parent_dir)
def test_temp_dir__path_none(self):
"""Test passing no path."""
- with support.temp_dir() as temp_path:
+ with os_helper.temp_dir() as temp_path:
self.assertTrue(os.path.isdir(temp_path))
self.assertFalse(os.path.isdir(temp_path))
def test_temp_dir__existing_dir__quiet_default(self):
"""Test passing a directory that already exists."""
def call_temp_dir(path):
- with support.temp_dir(path) as temp_path:
+ with os_helper.temp_dir(path) as temp_path:
raise Exception("should not get here")
path = tempfile.mkdtemp()
@@ -150,8 +154,8 @@ def test_temp_dir__existing_dir__quiet_true(self):
path = os.path.realpath(path)
try:
- with support.check_warnings() as recorder:
- with support.temp_dir(path, quiet=True) as temp_path:
+ with warnings_helper.check_warnings() as recorder:
+ with os_helper.temp_dir(path, quiet=True) as temp_path:
self.assertEqual(path, temp_path)
warnings = [str(w.message) for w in recorder.warnings]
# Make sure temp_dir did not delete the original directory.
@@ -173,7 +177,8 @@ def test_temp_dir__forked_child(self):
script_helper.assert_python_ok("-c", textwrap.dedent("""
import os
from test import support
- with support.temp_cwd() as temp_path:
+ from test.support import os_helper
+ with os_helper.temp_cwd() as temp_path:
pid = os.fork()
if pid != 0:
# parent process
@@ -194,8 +199,8 @@ def test_temp_dir__forked_child(self):
def test_change_cwd(self):
original_cwd = os.getcwd()
- with support.temp_dir() as temp_path:
- with support.change_cwd(temp_path) as new_cwd:
+ with os_helper.temp_dir() as temp_path:
+ with os_helper.change_cwd(temp_path) as new_cwd:
self.assertEqual(new_cwd, temp_path)
self.assertEqual(os.getcwd(), new_cwd)
@@ -206,10 +211,10 @@ def test_change_cwd__non_existent_dir(self):
original_cwd = os.getcwd()
def call_change_cwd(path):
- with support.change_cwd(path) as new_cwd:
+ with os_helper.change_cwd(path) as new_cwd:
raise Exception("should not get here")
- with support.temp_dir() as parent_dir:
+ with os_helper.temp_dir() as parent_dir:
non_existent_dir = os.path.join(parent_dir, 'does_not_exist')
self.assertRaises(FileNotFoundError, call_change_cwd,
non_existent_dir)
@@ -220,10 +225,10 @@ def test_change_cwd__non_existent_dir__quiet_true(self):
"""Test passing a non-existent directory with quiet=True."""
original_cwd = os.getcwd()
- with support.temp_dir() as parent_dir:
+ with os_helper.temp_dir() as parent_dir:
bad_dir = os.path.join(parent_dir, 'does_not_exist')
- with support.check_warnings() as recorder:
- with support.change_cwd(bad_dir, quiet=True) as new_cwd:
+ with warnings_helper.check_warnings() as recorder:
+ with os_helper.change_cwd(bad_dir, quiet=True) as new_cwd:
self.assertEqual(new_cwd, original_cwd)
self.assertEqual(os.getcwd(), new_cwd)
warnings = [str(w.message) for w in recorder.warnings]
@@ -240,8 +245,8 @@ def test_change_cwd__non_existent_dir__quiet_true(self):
def test_change_cwd__chdir_warning(self):
"""Check the warning message when os.chdir() fails."""
path = TESTFN + '_does_not_exist'
- with support.check_warnings() as recorder:
- with support.change_cwd(path=path, quiet=True):
+ with warnings_helper.check_warnings() as recorder:
+ with os_helper.change_cwd(path=path, quiet=True):
pass
messages = [str(w.message) for w in recorder.warnings]
@@ -256,7 +261,7 @@ def test_change_cwd__chdir_warning(self):
def test_temp_cwd(self):
here = os.getcwd()
- with support.temp_cwd(name=TESTFN):
+ with os_helper.temp_cwd(name=TESTFN):
self.assertEqual(os.path.basename(os.getcwd()), TESTFN)
self.assertFalse(os.path.exists(TESTFN))
self.assertEqual(os.getcwd(), here)
@@ -265,7 +270,7 @@ def test_temp_cwd(self):
def test_temp_cwd__name_none(self):
"""Test passing None to temp_cwd()."""
original_cwd = os.getcwd()
- with support.temp_cwd(name=None) as new_cwd:
+ with os_helper.temp_cwd(name=None) as new_cwd:
self.assertNotEqual(new_cwd, original_cwd)
self.assertTrue(os.path.isdir(new_cwd))
self.assertEqual(os.getcwd(), new_cwd)
@@ -275,7 +280,7 @@ def test_sortdict(self):
self.assertEqual(support.sortdict({3:3, 2:2, 1:1}), "{1: 1, 2: 2, 3: 3}")
def test_make_bad_fd(self):
- fd = support.make_bad_fd()
+ fd = os_helper.make_bad_fd()
with self.assertRaises(OSError) as cm:
os.write(fd, b"foo")
self.assertEqual(cm.exception.errno, errno.EBADF)
@@ -287,11 +292,11 @@ def test_check_syntax_error(self):
def test_CleanImport(self):
import importlib
- with support.CleanImport("asyncore"):
+ with import_helper.CleanImport("asyncore"):
importlib.import_module("asyncore")
def test_DirsOnSysPath(self):
- with support.DirsOnSysPath('foo', 'bar'):
+ with import_helper.DirsOnSysPath('foo', 'bar'):
self.assertIn("foo", sys.path)
self.assertIn("bar", sys.path)
self.assertNotIn("foo", sys.path)
@@ -625,10 +630,10 @@ def test_fd_count(self):
# We cannot test the absolute value of fd_count(): on old Linux
# kernel or glibc versions, os.urandom() keeps a FD open on
# /dev/urandom device and Python has 4 FD opens instead of 3.
- start = support.fd_count()
+ start = os_helper.fd_count()
fd = os.open(__file__, os.O_RDONLY)
try:
- more = support.fd_count()
+ more = os_helper.fd_count()
finally:
os.close(fd)
self.assertEqual(more - start, 1)
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index fcc706ede5aaa..8ace883d74bb2 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -15,7 +15,9 @@
import unittest
from test import support
+from test.support import os_helper
from test.support import script_helper
+from test.support import warnings_helper
has_textmode = (tempfile._text_openflags != tempfile._bin_openflags)
@@ -69,7 +71,7 @@ class BaseTestCase(unittest.TestCase):
b_check = re.compile(br"^[a-z0-9_-]{8}$")
def setUp(self):
- self._warnings_manager = support.check_warnings()
+ self._warnings_manager = warnings_helper.check_warnings()
self._warnings_manager.__enter__()
warnings.filterwarnings("ignore", category=RuntimeWarning,
message="mktemp", module=__name__)
@@ -224,7 +226,7 @@ def test_wanted_dirs(self):
# _candidate_tempdir_list contains the expected directories
# Make sure the interesting environment variables are all set.
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
for envname in 'TMPDIR', 'TEMP', 'TMP':
dirname = os.getenv(envname)
if not dirname:
@@ -310,7 +312,7 @@ def _inside_empty_temp_dir():
with support.swap_attr(tempfile, 'tempdir', dir):
yield
finally:
- support.rmtree(dir)
+ os_helper.rmtree(dir)
def _mock_candidate_names(*names):
@@ -594,13 +596,13 @@ def test_case_sensitive(self):
case_sensitive_tempdir = tempfile.mkdtemp("-Temp")
_tempdir, tempfile.tempdir = tempfile.tempdir, None
try:
- with support.EnvironmentVarGuard() as env:
+ with os_helper.EnvironmentVarGuard() as env:
# Fake the first env var which is checked as a candidate
env["TMPDIR"] = case_sensitive_tempdir
self.assertEqual(tempfile.gettempdir(), case_sensitive_tempdir)
finally:
tempfile.tempdir = _tempdir
- support.rmdir(case_sensitive_tempdir)
+ os_helper.rmdir(case_sensitive_tempdir)
class TestMkstemp(BaseTestCase):
@@ -950,7 +952,7 @@ def close(fd):
def test_bad_mode(self):
dir = tempfile.mkdtemp()
- self.addCleanup(support.rmtree, dir)
+ self.addCleanup(os_helper.rmtree, dir)
with self.assertRaises(ValueError):
tempfile.NamedTemporaryFile(mode='wr', dir=dir)
with self.assertRaises(TypeError):
@@ -1351,7 +1353,7 @@ def test_explicit_cleanup(self):
finally:
os.rmdir(dir)
- @support.skip_unless_symlink
+ @os_helper.skip_unless_symlink
def test_cleanup_with_symlink_to_a_directory(self):
# cleanup() should not follow symlinks to directories (issue #12464)
d1 = self.do_create()
@@ -1448,7 +1450,9 @@ def test_warnings_on_cleanup(self):
name = d.name
# Check for the resource warning
- with support.check_warnings(('Implicitly', ResourceWarning), quiet=False):
+ with warnings_helper.check_warnings(('Implicitly',
+ ResourceWarning),
+ quiet=False):
warnings.filterwarnings("always", category=ResourceWarning)
del d
support.gc_collect()
1
0
30 Jun '20
https://github.com/python/cpython/commit/3ddc634cd5469550c0c2dc5a6051a70739…
commit: 3ddc634cd5469550c0c2dc5a6051a70739995699
branch: master
author: Hai Shi <shihai1992(a)gmail.com>
committer: GitHub <noreply(a)github.com>
date: 2020-06-30T15:46:06+02:00
summary:
bpo-40275: Use new test.support helper submodules in tests (GH-21219)
files:
M Lib/test/audiotests.py
M Lib/test/libregrtest/cmdline.py
M Lib/test/libregrtest/main.py
M Lib/test/libregrtest/runtest_mp.py
M Lib/test/test_aifc.py
M Lib/test/test_bz2.py
M Lib/test/test_functools.py
M Lib/test/test_future.py
M Lib/test/test_logging.py
M Lib/test/test_poll.py
M Lib/test/test_regrtest.py
M Lib/test/test_smtpd.py
M Lib/test/test_time.py
M Lib/test/test_unicode_file.py
M Lib/test/test_urllib.py
M Lib/test/test_zipimport_support.py
diff --git a/Lib/test/audiotests.py b/Lib/test/audiotests.py
index d3e8e9ee44a13..9d6c4cc2b4b02 100644
--- a/Lib/test/audiotests.py
+++ b/Lib/test/audiotests.py
@@ -1,4 +1,5 @@
-from test.support import findfile, TESTFN, unlink
+from test.support import findfile
+from test.support.os_helper import TESTFN, unlink
import array
import io
import pickle
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
index c0bb051bd0783..a4bac79c8af68 100644
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -2,6 +2,7 @@
import os
import sys
from test import support
+from test.support import os_helper
USAGE = """\
@@ -291,7 +292,7 @@ def _create_parser():
def relative_filename(string):
# CWD is replaced with a temporary dir before calling main(), so we
# join it with the saved CWD so it ends up where the user expects.
- return os.path.join(support.SAVEDCWD, string)
+ return os.path.join(os_helper.SAVEDCWD, string)
def huntrleaks(string):
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 7675a97b5b48e..793c99a8f4ca3 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -216,7 +216,7 @@ def find_tests(self, tests):
# regex to match 'test_builtin' in line:
# '0:00:00 [ 4/400] test_builtin -- test_dict took 1 sec'
regex = re.compile(r'\btest_[a-zA-Z0-9_]+\b')
- with open(os.path.join(support.SAVEDCWD, self.ns.fromfile)) as fp:
+ with open(os.path.join(os_helper.SAVEDCWD, self.ns.fromfile)) as fp:
for line in fp:
line = line.split('#', 1)[0]
line = line.strip()
@@ -559,7 +559,7 @@ def save_xml_result(self):
for k, v in totals.items():
root.set(k, str(v))
- xmlpath = os.path.join(support.SAVEDCWD, self.ns.xmlpath)
+ xmlpath = os.path.join(os_helper.SAVEDCWD, self.ns.xmlpath)
with open(xmlpath, 'wb') as f:
for s in ET.tostringlist(root):
f.write(s)
@@ -597,7 +597,7 @@ def create_temp_dir(self):
test_cwd = 'test_python_worker_{}'.format(pid)
else:
test_cwd = 'test_python_{}'.format(pid)
- test_cwd += support.FS_NONASCII
+ test_cwd += os_helper.FS_NONASCII
test_cwd = os.path.join(self.tmp_dir, test_cwd)
return test_cwd
@@ -609,10 +609,10 @@ def cleanup(self):
for name in glob.glob(path):
if os.path.isdir(name):
print("Remove directory: %s" % name)
- support.rmtree(name)
+ os_helper.rmtree(name)
else:
print("Remove file: %s" % name)
- support.unlink(name)
+ os_helper.unlink(name)
def main(self, tests=None, **kwargs):
self.parse_args(kwargs)
@@ -629,7 +629,7 @@ def main(self, tests=None, **kwargs):
# Run the tests in a context manager that temporarily changes the CWD
# to a temporary and writable directory. If it's not possible to
# create or change the CWD, the original CWD will be used.
- # The original CWD is available from support.SAVEDCWD.
+ # The original CWD is available from os_helper.SAVEDCWD.
with os_helper.temp_cwd(test_cwd, quiet=True):
# When using multiprocessing, worker processes will use test_cwd
# as their parent temporary directory. So when the main process
diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py
index 7a18e45434bb4..3d503af23b6a7 100644
--- a/Lib/test/libregrtest/runtest_mp.py
+++ b/Lib/test/libregrtest/runtest_mp.py
@@ -11,6 +11,7 @@
import traceback
import types
from test import support
+from test.support import os_helper
from test.libregrtest.runtest import (
runtest, INTERRUPTED, CHILD_ERROR, PROGRESS_MIN_TIME,
@@ -70,7 +71,7 @@ def run_test_in_subprocess(testname, ns):
stderr=subprocess.PIPE,
universal_newlines=True,
close_fds=(os.name != 'nt'),
- cwd=support.SAVEDCWD,
+ cwd=os_helper.SAVEDCWD,
**kw)
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py
index 5a95099cc5cdf..fb6da4136f4c5 100644
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -1,4 +1,6 @@
-from test.support import check_no_resource_warning, findfile, TESTFN, unlink
+from test.support import findfile
+from test.support.os_helper import TESTFN, unlink
+from test.support.warnings_helper import check_no_resource_warning
import unittest
from unittest import mock
from test import audiotests
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 8f0773d55faef..ccc5e4df83a7a 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -12,14 +12,15 @@
import shutil
import subprocess
import threading
+from test.support import import_helper
from test.support import threading_helper
-from test.support import unlink
+from test.support.os_helper import unlink
import _compression
import sys
# Skip tests if the bz2 module doesn't exist.
-bz2 = support.import_module('bz2')
+bz2 = import_helper.import_module('bz2')
from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor
has_cmdline_bunzip2 = None
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index e726188982bc4..edd5773e13d54 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -19,15 +19,18 @@
from weakref import proxy
import contextlib
+from test.support import import_helper
from test.support import threading_helper
from test.support.script_helper import assert_python_ok
import functools
-py_functools = support.import_fresh_module('functools', blocked=['_functools'])
-c_functools = support.import_fresh_module('functools', fresh=['_functools'])
+py_functools = import_helper.import_fresh_module('functools',
+ blocked=['_functools'])
+c_functools = import_helper.import_fresh_module('functools',
+ fresh=['_functools'])
-decimal = support.import_fresh_module('decimal', fresh=['_decimal'])
+decimal = import_helper.import_fresh_module('decimal', fresh=['_decimal'])
@contextlib.contextmanager
def replaced_module(name, replacement):
diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py
index 0f40357b3a731..e4715587d21cf 100644
--- a/Lib/test/test_future.py
+++ b/Lib/test/test_future.py
@@ -4,6 +4,7 @@
import ast
import unittest
from test import support
+from test.support import import_helper
from textwrap import dedent
import os
import re
@@ -24,17 +25,17 @@ def check_syntax_error(self, err, basename, lineno, offset=1):
self.assertEqual(err.offset, offset)
def test_future1(self):
- with support.CleanImport('future_test1'):
+ with import_helper.CleanImport('future_test1'):
from test import future_test1
self.assertEqual(future_test1.result, 6)
def test_future2(self):
- with support.CleanImport('future_test2'):
+ with import_helper.CleanImport('future_test2'):
from test import future_test2
self.assertEqual(future_test2.result, 6)
def test_future3(self):
- with support.CleanImport('test_future3'):
+ with import_helper.CleanImport('test_future3'):
from test import test_future3
def test_badfuture3(self):
@@ -113,7 +114,7 @@ def test_parserhack(self):
self.fail("syntax error didn't occur")
def test_multiple_features(self):
- with support.CleanImport("test.test_future5"):
+ with import_helper.CleanImport("test.test_future5"):
from test import test_future5
def test_unicode_literals_exec(self):
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 2ae00b6e3b4e9..eb5b926908a19 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -42,8 +42,10 @@
import tempfile
from test.support.script_helper import assert_python_ok, assert_python_failure
from test import support
+from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
+from test.support import warnings_helper
from test.support.logging_helper import TestHandler
import textwrap
import threading
@@ -1169,7 +1171,7 @@ class ConfigFileTest(BaseTest):
"""Reading logging config from a .ini-style config file."""
- check_no_resource_warning = support.check_no_resource_warning
+ check_no_resource_warning = warnings_helper.check_no_resource_warning
expected_log_pat = r"^(\w+) \+\+ (\w+)$"
# config0 is a standard configuration.
@@ -1756,7 +1758,7 @@ def setUp(self):
def tearDown(self):
SocketHandlerTest.tearDown(self)
- support.unlink(self.address)
+ os_helper.unlink(self.address)
class DatagramHandlerTest(BaseTest):
@@ -1837,7 +1839,7 @@ def setUp(self):
def tearDown(self):
DatagramHandlerTest.tearDown(self)
- support.unlink(self.address)
+ os_helper.unlink(self.address)
class SysLogHandlerTest(BaseTest):
@@ -1921,7 +1923,7 @@ def setUp(self):
def tearDown(self):
SysLogHandlerTest.tearDown(self)
- support.unlink(self.address)
+ os_helper.unlink(self.address)
@unittest.skipUnless(socket_helper.IPV6_ENABLED,
'IPv6 support required for this test.')
@@ -2175,7 +2177,7 @@ class ConfigDictTest(BaseTest):
"""Reading logging config from a dictionary."""
- check_no_resource_warning = support.check_no_resource_warning
+ check_no_resource_warning = warnings_helper.check_no_resource_warning
expected_log_pat = r"^(\w+) \+\+ (\w+)$"
# config0 is a standard configuration.
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index a14c69a5723a2..de62350696a92 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -7,8 +7,10 @@
import threading
import time
import unittest
-from test.support import TESTFN, run_unittest, cpython_only
+from test.support import run_unittest, cpython_only
from test.support import threading_helper
+from test.support.os_helper import TESTFN
+
try:
select.poll
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 6745be6fea1ac..39af0d96d1e54 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -18,6 +18,7 @@
import unittest
from test import libregrtest
from test import support
+from test.support import os_helper
from test.libregrtest import utils
@@ -161,12 +162,12 @@ def test_ignore(self):
self.assertEqual(ns.ignore_tests, ['pattern'])
self.checkError([opt], 'expected one argument')
- self.addCleanup(support.unlink, support.TESTFN)
- with open(support.TESTFN, "w") as fp:
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+ with open(os_helper.TESTFN, "w") as fp:
print('matchfile1', file=fp)
print('matchfile2', file=fp)
- filename = os.path.abspath(support.TESTFN)
+ filename = os.path.abspath(os_helper.TESTFN)
ns = libregrtest._parse_args(['-m', 'match',
'--ignorefile', filename])
self.assertEqual(ns.ignore_tests,
@@ -183,12 +184,12 @@ def test_match(self):
'-m', 'pattern2'])
self.assertEqual(ns.match_tests, ['pattern1', 'pattern2'])
- self.addCleanup(support.unlink, support.TESTFN)
- with open(support.TESTFN, "w") as fp:
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+ with open(os_helper.TESTFN, "w") as fp:
print('matchfile1', file=fp)
print('matchfile2', file=fp)
- filename = os.path.abspath(support.TESTFN)
+ filename = os.path.abspath(os_helper.TESTFN)
ns = libregrtest._parse_args(['-m', 'match',
'--matchfile', filename])
self.assertEqual(ns.match_tests,
@@ -237,7 +238,7 @@ def test_memlimit(self):
def test_testdir(self):
ns = libregrtest._parse_args(['--testdir', 'foo'])
- self.assertEqual(ns.testdir, os.path.join(support.SAVEDCWD, 'foo'))
+ self.assertEqual(ns.testdir, os.path.join(os_helper.SAVEDCWD, 'foo'))
self.checkError(['--testdir'], 'expected one argument')
def test_runleaks(self):
@@ -284,7 +285,7 @@ def test_coverdir(self):
with self.subTest(opt=opt):
ns = libregrtest._parse_args([opt, 'foo'])
self.assertEqual(ns.coverdir,
- os.path.join(support.SAVEDCWD, 'foo'))
+ os.path.join(os_helper.SAVEDCWD, 'foo'))
self.checkError([opt], 'expected one argument')
def test_nocoverdir(self):
@@ -363,7 +364,7 @@ def setUp(self):
self.testdir = os.path.realpath(os.path.dirname(__file__))
self.tmptestdir = tempfile.mkdtemp()
- self.addCleanup(support.rmtree, self.tmptestdir)
+ self.addCleanup(os_helper.rmtree, self.tmptestdir)
def create_test(self, name=None, code=None):
if not name:
@@ -384,7 +385,7 @@ def test_empty_test(self):
name = self.TESTNAME_PREFIX + name
path = os.path.join(self.tmptestdir, name + '.py')
- self.addCleanup(support.unlink, path)
+ self.addCleanup(os_helper.unlink, path)
# Use 'x' mode to ensure that we do not override existing tests
try:
with open(path, 'x', encoding='utf-8') as fp:
@@ -770,8 +771,8 @@ def test_fromfile(self):
# Write the list of files using a format similar to regrtest output:
# [1/2] test_1
# [2/2] test_2
- filename = support.TESTFN
- self.addCleanup(support.unlink, filename)
+ filename = os_helper.TESTFN
+ self.addCleanup(os_helper.unlink, filename)
# test format '0:00:00 [2/7] test_opcodes -- test_grammar took 0 sec'
with open(filename, "w") as fp:
@@ -886,7 +887,7 @@ def check_leak(self, code, what):
test = self.create_test('huntrleaks', code=code)
filename = 'reflog.txt'
- self.addCleanup(support.unlink, filename)
+ self.addCleanup(os_helper.unlink, filename)
output = self.run_tests('--huntrleaks', '3:3:', test,
exitcode=2,
stderr=subprocess.STDOUT)
@@ -997,8 +998,8 @@ def test_method4(self):
testname = self.create_test(code=code)
# only run a subset
- filename = support.TESTFN
- self.addCleanup(support.unlink, filename)
+ filename = os_helper.TESTFN
+ self.addCleanup(os_helper.unlink, filename)
subset = [
# only ignore the method name
@@ -1038,8 +1039,8 @@ def test_method4(self):
self.assertEqual(methods, all_methods)
# only run a subset
- filename = support.TESTFN
- self.addCleanup(support.unlink, filename)
+ filename = os_helper.TESTFN
+ self.addCleanup(os_helper.unlink, filename)
subset = [
# only match the method name
diff --git a/Lib/test/test_smtpd.py b/Lib/test/test_smtpd.py
index 3be7739743940..d5d5abfcf370a 100644
--- a/Lib/test/test_smtpd.py
+++ b/Lib/test/test_smtpd.py
@@ -2,6 +2,7 @@
import textwrap
from test import support, mock_socket
from test.support import socket_helper
+from test.support import warnings_helper
import socket
import io
import smtpd
@@ -714,49 +715,49 @@ def test_unknown_command(self):
b'recognized\r\n')
def test_attribute_deprecations(self):
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__server
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__server = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__line
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__line = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__state
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__state = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__greeting
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__greeting = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__mailfrom
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__mailfrom = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__rcpttos
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__rcpttos = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__data
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__data = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__fqdn
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__fqdn = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__peer
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__peer = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__conn
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__conn = 'spam'
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
spam = self.channel._SMTPChannel__addr
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
self.channel._SMTPChannel__addr = 'spam'
@unittest.skipUnless(socket_helper.IPV6_ENABLED, "IPv6 not enabled")
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 80e43fafad813..6ced0470d0756 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -1,4 +1,5 @@
from test import support
+from test.support import warnings_helper
import decimal
import enum
import locale
@@ -247,7 +248,7 @@ def test_default_values_for_zero(self):
# not change output based on its value and no test for year
# because systems vary in their support for year 0.
expected = "2000 01 01 00 00 00 1 001"
- with support.check_warnings():
+ with warnings_helper.check_warnings():
result = time.strftime("%Y %m %d %H %M %S %w %j", (2000,)+(0,)*8)
self.assertEqual(expected, result)
diff --git a/Lib/test/test_unicode_file.py b/Lib/test/test_unicode_file.py
index 46a0d062540b7..e397949187983 100644
--- a/Lib/test/test_unicode_file.py
+++ b/Lib/test/test_unicode_file.py
@@ -6,8 +6,10 @@
import unicodedata
import unittest
-from test.support import (run_unittest, rmtree, change_cwd,
- TESTFN_UNICODE, TESTFN_UNENCODABLE, create_empty_file)
+from test.support import run_unittest
+from test.support.os_helper import (rmtree, change_cwd, TESTFN_UNICODE,
+ TESTFN_UNENCODABLE, create_empty_file)
+
if not os.path.supports_unicode_filenames:
try:
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 68bb49efb2810..f41fa2a950686 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -9,6 +9,8 @@
import unittest
from unittest.mock import patch
from test import support
+from test.support import os_helper
+from test.support import warnings_helper
import os
try:
import ssl
@@ -50,7 +52,7 @@ def urlopen(url, data=None, proxies=None):
def FancyURLopener():
- with support.check_warnings(
+ with warnings_helper.check_warnings(
('FancyURLopener style of invoking requests is deprecated.',
DeprecationWarning)):
return urllib.request.FancyURLopener()
@@ -145,19 +147,19 @@ def setUp(self):
# Create a temp file to use for testing
self.text = bytes("test_urllib: %s\n" % self.__class__.__name__,
"ascii")
- f = open(support.TESTFN, 'wb')
+ f = open(os_helper.TESTFN, 'wb')
try:
f.write(self.text)
finally:
f.close()
- self.pathname = support.TESTFN
+ self.pathname = os_helper.TESTFN
self.quoted_pathname = urllib.parse.quote(self.pathname)
self.returned_obj = urlopen("file:%s" % self.quoted_pathname)
def tearDown(self):
"""Shut down the open object"""
self.returned_obj.close()
- os.remove(support.TESTFN)
+ os.remove(os_helper.TESTFN)
def test_interface(self):
# Make sure object returned by urlopen() has the specified methods
@@ -230,7 +232,7 @@ class ProxyTests(unittest.TestCase):
def setUp(self):
# Records changes to env vars
- self.env = support.EnvironmentVarGuard()
+ self.env = os_helper.EnvironmentVarGuard()
# Delete all proxy related env vars
for k in list(os.environ):
if 'proxy' in k.lower():
@@ -592,13 +594,13 @@ def test_userpass_inurl_w_spaces(self):
self.unfakehttp()
def test_URLopener_deprecation(self):
- with support.check_warnings(('',DeprecationWarning)):
+ with warnings_helper.check_warnings(('',DeprecationWarning)):
urllib.request.URLopener()
@unittest.skipUnless(ssl, "ssl module required")
def test_cafile_and_context(self):
context = ssl.create_default_context()
- with support.check_warnings(('', DeprecationWarning)):
+ with warnings_helper.check_warnings(('', DeprecationWarning)):
with self.assertRaises(ValueError):
urllib.request.urlopen(
"https://localhost", cafile="/nonexistent/path", context=context
@@ -699,10 +701,10 @@ def setUp(self):
self.tempFiles = []
# Create a temporary file.
- self.registerFileForCleanUp(support.TESTFN)
+ self.registerFileForCleanUp(os_helper.TESTFN)
self.text = b'testing urllib.urlretrieve'
try:
- FILE = open(support.TESTFN, 'wb')
+ FILE = open(os_helper.TESTFN, 'wb')
FILE.write(self.text)
FILE.close()
finally:
@@ -745,18 +747,18 @@ def registerFileForCleanUp(self, fileName):
def test_basic(self):
# Make sure that a local file just gets its own location returned and
# a headers value is returned.
- result = urllib.request.urlretrieve("file:%s" % support.TESTFN)
- self.assertEqual(result[0], support.TESTFN)
+ result = urllib.request.urlretrieve("file:%s" % os_helper.TESTFN)
+ self.assertEqual(result[0], os_helper.TESTFN)
self.assertIsInstance(result[1], email.message.Message,
"did not get an email.message.Message instance "
"as second returned value")
def test_copy(self):
# Test that setting the filename argument works.
- second_temp = "%s.2" % support.TESTFN
+ second_temp = "%s.2" % os_helper.TESTFN
self.registerFileForCleanUp(second_temp)
result = urllib.request.urlretrieve(self.constructLocalFileUrl(
- support.TESTFN), second_temp)
+ os_helper.TESTFN), second_temp)
self.assertEqual(second_temp, result[0])
self.assertTrue(os.path.exists(second_temp), "copy of the file was not "
"made")
@@ -777,10 +779,10 @@ def hooktester(block_count, block_read_size, file_size, count_holder=[0]):
self.assertIsInstance(file_size, int)
self.assertEqual(block_count, count_holder[0])
count_holder[0] = count_holder[0] + 1
- second_temp = "%s.2" % support.TESTFN
+ second_temp = "%s.2" % os_helper.TESTFN
self.registerFileForCleanUp(second_temp)
urllib.request.urlretrieve(
- self.constructLocalFileUrl(support.TESTFN),
+ self.constructLocalFileUrl(os_helper.TESTFN),
second_temp, hooktester)
def test_reporthook_0_bytes(self):
@@ -790,7 +792,7 @@ def hooktester(block_count, block_read_size, file_size, _report=report):
_report.append((block_count, block_read_size, file_size))
srcFileName = self.createNewTempFile()
urllib.request.urlretrieve(self.constructLocalFileUrl(srcFileName),
- support.TESTFN, hooktester)
+ os_helper.TESTFN, hooktester)
self.assertEqual(len(report), 1)
self.assertEqual(report[0][2], 0)
@@ -803,7 +805,7 @@ def hooktester(block_count, block_read_size, file_size, _report=report):
_report.append((block_count, block_read_size, file_size))
srcFileName = self.createNewTempFile(b"x" * 5)
urllib.request.urlretrieve(self.constructLocalFileUrl(srcFileName),
- support.TESTFN, hooktester)
+ os_helper.TESTFN, hooktester)
self.assertEqual(len(report), 2)
self.assertEqual(report[0][2], 5)
self.assertEqual(report[1][2], 5)
@@ -817,7 +819,7 @@ def hooktester(block_count, block_read_size, file_size, _report=report):
_report.append((block_count, block_read_size, file_size))
srcFileName = self.createNewTempFile(b"x" * 8193)
urllib.request.urlretrieve(self.constructLocalFileUrl(srcFileName),
- support.TESTFN, hooktester)
+ os_helper.TESTFN, hooktester)
self.assertEqual(len(report), 3)
self.assertEqual(report[0][2], 8193)
self.assertEqual(report[0][1], 8192)
@@ -1556,7 +1558,7 @@ def test_quoted_open(self):
class DummyURLopener(urllib.request.URLopener):
def open_spam(self, url):
return url
- with support.check_warnings(
+ with warnings_helper.check_warnings(
('DummyURLopener style of invoking requests is deprecated.',
DeprecationWarning)):
self.assertEqual(DummyURLopener().open(
@@ -1567,9 +1569,9 @@ def open_spam(self, url):
"spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"),
"//c:|windows%/:=&?~#+!$,;'@()*[]|/path/")
- @support.ignore_warnings(category=DeprecationWarning)
+ @warnings_helper.ignore_warnings(category=DeprecationWarning)
def test_urlopener_retrieve_file(self):
- with support.temp_dir() as tmpdir:
+ with os_helper.temp_dir() as tmpdir:
fd, tmpfile = tempfile.mkstemp(dir=tmpdir)
os.close(fd)
fileurl = "file:" + urllib.request.pathname2url(tmpfile)
@@ -1577,7 +1579,7 @@ def test_urlopener_retrieve_file(self):
# Some buildbots have TEMP folder that uses a lowercase drive letter.
self.assertEqual(os.path.normcase(filename), os.path.normcase(tmpfile))
- @support.ignore_warnings(category=DeprecationWarning)
+ @warnings_helper.ignore_warnings(category=DeprecationWarning)
def test_urlopener_retrieve_remote(self):
url = "http://www.python.org/file.txt"
self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello!")
@@ -1585,7 +1587,7 @@ def test_urlopener_retrieve_remote(self):
filename, _ = urllib.request.URLopener().retrieve(url)
self.assertEqual(os.path.splitext(filename)[1], ".txt")
- @support.ignore_warnings(category=DeprecationWarning)
+ @warnings_helper.ignore_warnings(category=DeprecationWarning)
def test_local_file_open(self):
# bpo-35907, CVE-2019-9948: urllib must reject local_file:// scheme
class DummyURLopener(urllib.request.URLopener):
diff --git a/Lib/test/test_zipimport_support.py b/Lib/test/test_zipimport_support.py
index 88561017503ff..7bf50a33728e5 100644
--- a/Lib/test/test_zipimport_support.py
+++ b/Lib/test/test_zipimport_support.py
@@ -13,6 +13,7 @@
import inspect
import linecache
import unittest
+from test.support import os_helper
from test.support.script_helper import (spawn_python, kill_python, assert_python_ok,
make_script, make_zip_script)
@@ -77,7 +78,7 @@ def tearDown(self):
def test_inspect_getsource_issue4223(self):
test_src = "def foo(): pass\n"
- with test.support.temp_dir() as d:
+ with os_helper.temp_dir() as d:
init_name = make_script(d, '__init__', test_src)
name_in_zip = os.path.join('zip_pkg',
os.path.basename(init_name))
@@ -117,7 +118,7 @@ def test_doctest_issue4197(self):
mod_name = mod_name.replace("sample_", "sample_zipped_")
sample_sources[mod_name] = src
- with test.support.temp_dir() as d:
+ with os_helper.temp_dir() as d:
script_name = make_script(d, 'test_zipped_doctest',
test_src)
zip_name, run_name = make_zip_script(d, 'test_zip',
@@ -192,7 +193,7 @@ class Test:
doctest.testmod()
""")
pattern = 'File "%s", line 2, in %s'
- with test.support.temp_dir() as d:
+ with os_helper.temp_dir() as d:
script_name = make_script(d, 'script', test_src)
rc, out, err = assert_python_ok(script_name)
expected = pattern % (script_name, "__main__.Test")
@@ -219,7 +220,7 @@ def f():
import pdb
pdb.Pdb(nosigint=True).runcall(f)
""")
- with test.support.temp_dir() as d:
+ with os_helper.temp_dir() as d:
script_name = make_script(d, 'script', test_src)
p = spawn_python(script_name)
p.stdin.write(b'l\n')
1
0
30 Jun '20
https://github.com/python/cpython/commit/c81f9e2d0a78d37209142471dad0fd4332…
commit: c81f9e2d0a78d37209142471dad0fd433220f2ae
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
committer: GitHub <noreply(a)github.com>
date: 2020-06-30T02:51:21-07:00
summary:
Update FAQ release schedule and estimated users (GH-21180)
Update FAQ to include:
* The new yearly release schedule from PEP 602
* Estimated users from "tens of thousands" to "millions"
(cherry picked from commit 3fa4799c3f9d9de7cac30e5db3627e9e125b9ce5)
Co-authored-by: E-Paine <63801254+E-Paine(a)users.noreply.github.com>
files:
M Doc/faq/general.rst
diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst
index 70837341b1b33..eee3c3c203efa 100644
--- a/Doc/faq/general.rst
+++ b/Doc/faq/general.rst
@@ -296,8 +296,8 @@ How stable is Python?
---------------------
Very stable. New, stable releases have been coming out roughly every 6 to 18
-months since 1991, and this seems likely to continue. Currently there are
-usually around 18 months between major releases.
+months since 1991, and this seems likely to continue. As of version 3.9,
+Python will have a major new release every 12 months (:pep:`602`).
The developers issue "bugfix" releases of older versions, so the stability of
existing releases gradually improves. Bugfix releases, indicated by a third
@@ -315,8 +315,8 @@ be maintained after January 1, 2020 <https://www.python.org/dev/peps/pep-0373/>`
How many people are using Python?
---------------------------------
-There are probably tens of thousands of users, though it's difficult to obtain
-an exact count.
+There are probably millions of users, though it's difficult to obtain an exact
+count.
Python is available for free download, so there are no sales figures, and it's
available from many different sites and packaged with many Linux distributions,
1
0
https://github.com/python/cpython/commit/3fa4799c3f9d9de7cac30e5db3627e9e12…
commit: 3fa4799c3f9d9de7cac30e5db3627e9e125b9ce5
branch: master
author: E-Paine <63801254+E-Paine(a)users.noreply.github.com>
committer: GitHub <noreply(a)github.com>
date: 2020-06-30T05:42:43-04:00
summary:
Update FAQ release schedule and estimated users (GH-21180)
Update FAQ to include:
* The new yearly release schedule from PEP 602
* Estimated users from "tens of thousands" to "millions"
files:
M Doc/faq/general.rst
diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst
index 70837341b1b33..eee3c3c203efa 100644
--- a/Doc/faq/general.rst
+++ b/Doc/faq/general.rst
@@ -296,8 +296,8 @@ How stable is Python?
---------------------
Very stable. New, stable releases have been coming out roughly every 6 to 18
-months since 1991, and this seems likely to continue. Currently there are
-usually around 18 months between major releases.
+months since 1991, and this seems likely to continue. As of version 3.9,
+Python will have a major new release every 12 months (:pep:`602`).
The developers issue "bugfix" releases of older versions, so the stability of
existing releases gradually improves. Bugfix releases, indicated by a third
@@ -315,8 +315,8 @@ be maintained after January 1, 2020 <https://www.python.org/dev/peps/pep-0373/>`
How many people are using Python?
---------------------------------
-There are probably tens of thousands of users, though it's difficult to obtain
-an exact count.
+There are probably millions of users, though it's difficult to obtain an exact
+count.
Python is available for free download, so there are no sales figures, and it's
available from many different sites and packaged with many Linux distributions,
1
0
https://github.com/python/cpython/commit/604d95e235d86465b8c17f02095edcaf18…
commit: 604d95e235d86465b8c17f02095edcaf18464d4c
branch: master
author: Lawrence D'Anna <64555057+lawrence-danna-apple(a)users.noreply.github.com>
committer: GitHub <noreply(a)github.com>
date: 2020-06-30T11:15:46+02:00
summary:
bpo-41100: fix _decimal for arm64 Mac OS (GH-21228)
Patch by Lawrence Danna.
files:
A Misc/NEWS.d/next/Core and Builtins/2020-06-30-04-44-29.bpo-41100.PJwA6F.rst
M Modules/_decimal/libmpdec/mpdecimal.h
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-30-04-44-29.bpo-41100.PJwA6F.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-30-04-44-29.bpo-41100.PJwA6F.rst
new file mode 100644
index 0000000000000..d6176d69f0eb0
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-06-30-04-44-29.bpo-41100.PJwA6F.rst
@@ -0,0 +1 @@
+add arm64 to the allowable Mac OS arches in mpdecimal.h
\ No newline at end of file
diff --git a/Modules/_decimal/libmpdec/mpdecimal.h b/Modules/_decimal/libmpdec/mpdecimal.h
index 108b76efa8594..35ce429f60124 100644
--- a/Modules/_decimal/libmpdec/mpdecimal.h
+++ b/Modules/_decimal/libmpdec/mpdecimal.h
@@ -127,6 +127,9 @@ const char *mpd_version(void);
#elif defined(__x86_64__)
#define CONFIG_64
#define ASM
+ #elif defined(__arm64__)
+ #define CONFIG_64
+ #define ANSI
#else
#error "unknown architecture for universal build."
#endif
1
0