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

Skip to content

Commit 1d175f7

Browse files
committed
Merge fixes for #1326113 and #12297 from 3.2
2 parents 8b4d64f + ccddc47 commit 1d175f7

4 files changed

Lines changed: 19 additions & 16 deletions

File tree

Doc/library/atexit.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ is detected, or when :func:`os._exit` is called.
2222

2323
Register *func* as a function to be executed at termination. Any optional
2424
arguments that are to be passed to *func* must be passed as arguments to
25-
:func:`register`.
25+
:func:`register`. It is possible to register the same function and arguments
26+
more than once.
2627

2728
At normal program termination (for instance, if :func:`sys.exit` is called or
2829
the main module's execution completes), all functions registered are called in
@@ -35,15 +36,17 @@ is detected, or when :func:`os._exit` is called.
3536
saved. After all exit handlers have had a chance to run the last exception to
3637
be raised is re-raised.
3738

38-
This function returns *func* which makes it possible to use it as a decorator
39-
without binding the original name to ``None``.
39+
This function returns *func*, which makes it possible to use it as a
40+
decorator.
4041

4142

4243
.. function:: unregister(func)
4344

44-
Remove a function *func* from the list of functions to be run at interpreter-
45+
Remove *func* from the list of functions to be run at interpreter
4546
shutdown. After calling :func:`unregister`, *func* is guaranteed not to be
46-
called when the interpreter shuts down.
47+
called when the interpreter shuts down, even if it was registered more than
48+
once. :func:`unregister` silently does nothing if *func* was not previously
49+
registered.
4750

4851

4952
.. seealso::
@@ -100,6 +103,4 @@ Usage as a :term:`decorator`::
100103
def goodbye():
101104
print("You are now leaving the Python sector.")
102105

103-
This obviously only works with functions that don't take arguments.
104-
105-
106+
This only works with functions that can be called without arguments.

Lib/distutils/command/build_ext.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ def finalize_options(self):
165165
if plat_py_include != py_include:
166166
self.include_dirs.append(plat_py_include)
167167

168-
if isinstance(self.libraries, str):
169-
self.libraries = [self.libraries]
168+
self.ensure_string_list('libraries')
170169

171170
# Life is easier if we're not forever checking for None, so
172171
# simplify these options to empty lists if unset

Lib/distutils/tests/test_build_ext.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,21 +178,21 @@ def test_finalize_options(self):
178178
# make sure cmd.libraries is turned into a list
179179
# if it's a string
180180
cmd = build_ext(dist)
181-
cmd.libraries = 'my_lib'
181+
cmd.libraries = 'my_lib, other_lib lastlib'
182182
cmd.finalize_options()
183-
self.assertEqual(cmd.libraries, ['my_lib'])
183+
self.assertEqual(cmd.libraries, ['my_lib', 'other_lib', 'lastlib'])
184184

185185
# make sure cmd.library_dirs is turned into a list
186186
# if it's a string
187187
cmd = build_ext(dist)
188-
cmd.library_dirs = 'my_lib_dir'
188+
cmd.library_dirs = 'my_lib_dir%sother_lib_dir' % os.pathsep
189189
cmd.finalize_options()
190-
self.assertTrue('my_lib_dir' in cmd.library_dirs)
190+
self.assertEqual(cmd.library_dirs, ['my_lib_dir', 'other_lib_dir'])
191191

192192
# make sure rpath is turned into a list
193-
# if it's a list of os.pathsep's paths
193+
# if it's a string
194194
cmd = build_ext(dist)
195-
cmd.rpath = os.pathsep.join(['one', 'two'])
195+
cmd.rpath = 'one%stwo' % os.pathsep
196196
cmd.finalize_options()
197197
self.assertEqual(cmd.rpath, ['one', 'two'])
198198

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,9 @@ Library
472472
- Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
473473
Patch by Suman Saha.
474474

475+
- Issue #1326113: distutils' build_ext command --libraries option now
476+
correctly parses multiple values separated by whitespace or commas.
477+
475478
- Issue #10287: nntplib now queries the server's CAPABILITIES first before
476479
sending MODE READER, and only sends it if not already in READER mode.
477480
Patch by Hynek Schlawack.

0 commit comments

Comments
 (0)