mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-106739: Add rtype_cache
to warnings.warn
message when leaked objects found (#106740)
Adding the `rtype_cache` to the `warnings.warn` message improves the previous, somewhat vague message from ``` /Users/username/cpython/Lib/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 6 leaked semaphore objects to clean up at shutdown ``` to ``` /Users/username/cpython/Lib/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 6 leaked semaphore objects to clean up at shutdown: {'/mp-yor5cvj8', '/mp-10jx8eqr', '/mp-eobsx9tt', '/mp-0lml23vl', '/mp-9dgtsa_m', '/mp-frntyv4s'} ``` --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
This commit is contained in:
parent
188000ae4b
commit
fabcbe9c12
2 changed files with 5 additions and 3 deletions
|
@ -221,9 +221,10 @@ def main(fd):
|
|||
for rtype, rtype_cache in cache.items():
|
||||
if rtype_cache:
|
||||
try:
|
||||
warnings.warn('resource_tracker: There appear to be %d '
|
||||
'leaked %s objects to clean up at shutdown' %
|
||||
(len(rtype_cache), rtype))
|
||||
warnings.warn(
|
||||
f'resource_tracker: There appear to be {len(rtype_cache)} '
|
||||
f'leaked {rtype} objects to clean up at shutdown: {rtype_cache}'
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
for name in rtype_cache:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue