Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02ac74e

Browse files
committed
merge
2 parents fe77f4e + 2f66ffa commit 02ac74e

9 files changed

Lines changed: 72 additions & 25 deletions

File tree

Doc/glossary.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Glossary
4141

4242
argument
4343
A value passed to a :term:`function` (or :term:`method`) when calling the
44-
function. There are two types of arguments:
44+
function. There are two kinds of argument:
4545

4646
* :dfn:`keyword argument`: an argument preceded by an identifier (e.g.
4747
``name=``) in a function call or passed as a value in a dictionary
@@ -601,7 +601,7 @@ Glossary
601601
parameter
602602
A named entity in a :term:`function` (or method) definition that
603603
specifies an :term:`argument` (or in some cases, arguments) that the
604-
function can accept. There are five types of parameters:
604+
function can accept. There are five kinds of parameter:
605605

606606
* :dfn:`positional-or-keyword`: specifies an argument that can be passed
607607
either :term:`positionally <argument>` or as a :term:`keyword argument
@@ -615,6 +615,8 @@ Glossary
615615
parameters. However, some built-in functions have positional-only
616616
parameters (e.g. :func:`abs`).
617617

618+
.. _keyword-only_parameter:
619+
618620
* :dfn:`keyword-only`: specifies an argument that can be supplied only
619621
by keyword. Keyword-only parameters can be defined by including a
620622
single var-positional parameter or bare ``*`` in the parameter list

Doc/library/asynchat.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
--------------
1212

13-
Note: This module exists for backwards compatibility only. For new code we
14-
recommend using :module:`asyncio`.
13+
.. note::
14+
15+
This module exists for backwards compatibility only. For new code we
16+
recommend using :mod:`asyncio`.
1517

1618
This module builds on the :mod:`asyncore` infrastructure, simplifying
1719
asynchronous clients and servers and making it easier to handle protocols

Doc/library/asyncore.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
--------------
1515

16-
Note: This module exists for backwards compatibility only. For new code we
17-
recommend using :module:`asyncio`.
16+
.. note::
17+
18+
This module exists for backwards compatibility only. For new code we
19+
recommend using :mod:`asyncio`.
1820

1921
This module provides the basic infrastructure for writing asynchronous socket
2022
service clients and servers.

Doc/library/pathlib.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The main point of entry is the :class:`Path` class, which will instantiate
2020
a :ref:`concrete path <concrete-paths>` for the current platform.
2121

2222
.. note::
23-
This module module has been included in the standard library on a
23+
This module has been included in the standard library on a
2424
:term:`provisional basis <provisional package>`. Backwards incompatible
2525
changes (up to and including removal of the package) may occur if deemed
2626
necessary by the core developers.
@@ -250,7 +250,7 @@ property:
250250
Methods and properties
251251
^^^^^^^^^^^^^^^^^^^^^^
252252

253-
Pure paths provide the following methods an properties:
253+
Pure paths provide the following methods and properties:
254254

255255
.. data:: PurePath.drive
256256

@@ -454,7 +454,7 @@ Pure paths provide the following methods an properties:
454454

455455
.. method:: PurePath.joinpath(*other)
456456

457-
Calling this method is equivalent to indexing the path with each of
457+
Calling this method is equivalent to combining the path with each of
458458
the *other* arguments in turn::
459459

460460
>>> PurePosixPath('/etc').joinpath('passwd')
@@ -871,4 +871,3 @@ call fails (for example because the path doesn't exist):
871871

872872
Remove this file or symbolic link. If the path points to a directory,
873873
use :func:`Path.rmdir` instead.
874-

Doc/library/stdtypes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,9 @@ application).
11491149
fail, the entire sort operation will fail (and the list will likely be left
11501150
in a partially modified state).
11511151

1152+
:meth:`sort` accepts two arguments that can only be passed by keyword
1153+
(:ref:`keyword-only arguments <keyword-only_parameter>`):
1154+
11521155
*key* specifies a function of one argument that is used to extract a
11531156
comparison key from each list element (for example, ``key=str.lower``).
11541157
The key corresponding to each item in the list is calculated once and

Lib/distutils/sysconfig.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,11 @@ def get_config_vars(*args):
518518
_config_vars['prefix'] = PREFIX
519519
_config_vars['exec_prefix'] = EXEC_PREFIX
520520

521+
# For backward compatibility, see issue19555
522+
SO = _config_vars.get('EXT_SUFFIX')
523+
if SO is not None:
524+
_config_vars['SO'] = SO
525+
521526
# Always convert srcdir to an absolute path
522527
srcdir = _config_vars.get('srcdir', project_base)
523528
if os.name == 'posix':
@@ -568,4 +573,7 @@ def get_config_var(name):
568573
returned by 'get_config_vars()'. Equivalent to
569574
get_config_vars().get(name)
570575
"""
576+
if name == 'SO':
577+
import warnings
578+
warnings.warn('SO is deprecated, use EXT_SUFFIX', DeprecationWarning)
571579
return get_config_vars().get(name)

Lib/distutils/tests/test_sysconfig.py

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
"""Tests for distutils.sysconfig."""
22
import os
33
import shutil
4-
import test
54
import unittest
65

76
from distutils import sysconfig
87
from distutils.ccompiler import get_default_compiler
98
from distutils.tests import support
109
from test.support import TESTFN, run_unittest
1110

12-
class SysconfigTestCase(support.EnvironGuard,
13-
unittest.TestCase):
11+
class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
1412
def setUp(self):
1513
super(SysconfigTestCase, self).setUp()
1614
self.makefile = None
@@ -32,7 +30,6 @@ def test_get_config_h_filename(self):
3230
self.assertTrue(os.path.isfile(config_h), config_h)
3331

3432
def test_get_python_lib(self):
35-
lib_dir = sysconfig.get_python_lib()
3633
# XXX doesn't work on Linux when Python was never installed before
3734
#self.assertTrue(os.path.isdir(lib_dir), lib_dir)
3835
# test for pythonxx.lib?
@@ -67,8 +64,9 @@ def test_srcdir(self):
6764
self.assertTrue(os.path.exists(Python_h), Python_h)
6865
self.assertTrue(sysconfig._is_python_source_dir(srcdir))
6966
elif os.name == 'posix':
70-
self.assertEqual(os.path.dirname(sysconfig.get_makefile_filename()),
71-
srcdir)
67+
self.assertEqual(
68+
os.path.dirname(sysconfig.get_makefile_filename()),
69+
srcdir)
7270

7371
def test_srcdir_independent_of_cwd(self):
7472
# srcdir should be independent of the current working directory
@@ -129,10 +127,13 @@ def test_parse_makefile_literal_dollar(self):
129127

130128
def test_sysconfig_module(self):
131129
import sysconfig as global_sysconfig
132-
self.assertEqual(global_sysconfig.get_config_var('CFLAGS'), sysconfig.get_config_var('CFLAGS'))
133-
self.assertEqual(global_sysconfig.get_config_var('LDFLAGS'), sysconfig.get_config_var('LDFLAGS'))
130+
self.assertEqual(global_sysconfig.get_config_var('CFLAGS'),
131+
sysconfig.get_config_var('CFLAGS'))
132+
self.assertEqual(global_sysconfig.get_config_var('LDFLAGS'),
133+
sysconfig.get_config_var('LDFLAGS'))
134134

135-
@unittest.skipIf(sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'),'compiler flags customized')
135+
@unittest.skipIf(sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'),
136+
'compiler flags customized')
136137
def test_sysconfig_compiler_vars(self):
137138
# On OS X, binary installers support extension module building on
138139
# various levels of the operating system with differing Xcode
@@ -151,9 +152,29 @@ def test_sysconfig_compiler_vars(self):
151152
import sysconfig as global_sysconfig
152153
if sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'):
153154
return
154-
self.assertEqual(global_sysconfig.get_config_var('LDSHARED'), sysconfig.get_config_var('LDSHARED'))
155-
self.assertEqual(global_sysconfig.get_config_var('CC'), sysconfig.get_config_var('CC'))
156-
155+
self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),
156+
sysconfig.get_config_var('LDSHARED'))
157+
self.assertEqual(global_sysconfig.get_config_var('CC'),
158+
sysconfig.get_config_var('CC'))
159+
160+
@unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
161+
'EXT_SUFFIX required for this test')
162+
def test_SO_deprecation(self):
163+
self.assertWarns(DeprecationWarning,
164+
sysconfig.get_config_var, 'SO')
165+
166+
@unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
167+
'EXT_SUFFIX required for this test')
168+
def test_SO_value(self):
169+
self.assertEqual(sysconfig.get_config_var('SO'),
170+
sysconfig.get_config_var('EXT_SUFFIX'))
171+
172+
@unittest.skipIf(sysconfig.get_config_var('EXT_SUFFIX') is None,
173+
'EXT_SUFFIX required for this test')
174+
def test_SO_in_vars(self):
175+
vars = sysconfig.get_config_vars()
176+
self.assertIsNotNone(vars['SO'])
177+
self.assertEqual(vars['SO'], vars['EXT_SUFFIX'])
157178

158179

159180
def test_suite():

Lib/test/test_pkgutil.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def test_iter_importers(self):
200200
dirname = self.create_init(pkgname)
201201
pathitem = os.path.join(dirname, pkgname)
202202
fullname = '{}.{}'.format(pkgname, modname)
203+
sys.modules.pop(fullname, None)
204+
sys.modules.pop(pkgname, None)
203205
try:
204206
self.create_submodule(dirname, pkgname, modname, 0)
205207

Misc/NEWS

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Projected release date: 2013-11-24
1010
Core and Builtins
1111
-----------------
1212

13-
- Use the repr of a module name in more places in import, especially exceptions.
13+
- Use the repr of a module name in more places in import, especially
14+
exceptions.
1415

1516
- Issue #19619: str.encode, bytes.decode and bytearray.decode now use an
1617
internal API to throw LookupError for known non-text encodings, rather
@@ -79,8 +80,8 @@ Library
7980
CRL enumeration are now two functions. enum_certificates() also returns
8081
purpose flags as set of OIDs.
8182

82-
- Issue #19555: Restore sysconfig.get_config_var('SO'), with a
83-
DeprecationWarning pointing people at $EXT_SUFFIX.
83+
- Issue #19555: Restore sysconfig.get_config_var('SO'), (and the distutils
84+
equivalent) with a DeprecationWarning pointing people at $EXT_SUFFIX.
8485

8586
- Issue #8813: Add SSLContext.verify_flags to change the verification flags
8687
of the context in order to enable certification revocation list (CRL)
@@ -351,6 +352,13 @@ Tests
351352

352353
- Issue 19384: Fix test_py_compile for root user, patch by Claudiu Popa.
353354

355+
Documentation
356+
-------------
357+
358+
- Issue #18326: Clarify that list.sort's arguments are keyword-only. Also,
359+
attempt to reduce confusion in the glossary by not saying there are
360+
different "types" of arguments and parameters.
361+
354362
Build
355363
-----
356364

0 commit comments

Comments
 (0)