Skip to content

gh-136839: Refactor simple dict.update calls #136811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ def _create_slots(defined_fields, inherited_slots, field_names, weakref_slot):
doc = getattr(defined_fields.get(slot), 'doc', None)
if doc is not None:
seen_docs = True
slots.update({slot: doc})
slots[slot] = doc
Copy link
Contributor Author

@disconnect3d disconnect3d Jul 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The slots is a dict here defined in line 1256


# We only return dict if there's at least one doc member,
# otherwise we return tuple, which is the old default format.
Expand Down
8 changes: 2 additions & 6 deletions Lib/multiprocessing/resource_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ def cleanup_noop(name):
# absence of POSIX named semaphores. In that case, no named semaphores were
# ever opened, so no cleanup would be necessary.
if hasattr(_multiprocessing, 'sem_unlink'):
_CLEANUP_FUNCS.update({
'semaphore': _multiprocessing.sem_unlink,
})
_CLEANUP_FUNCS.update({
'shared_memory': _posixshmem.shm_unlink,
})
_CLEANUP_FUNCS['semaphore'] = _multiprocessing.sem_unlink
_CLEANUP_FUNCS['shared_memory'] = _posixshmem.shm_unlink
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_CLEANUP_FUNCS is a dict defined in line 35



class ReentrantCallError(RuntimeError):
Expand Down
2 changes: 1 addition & 1 deletion Lib/tkinter/scrolledtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, master=None, **kw):
self.vbar = Scrollbar(self.frame)
self.vbar.pack(side=RIGHT, fill=Y)

kw.update({'yscrollcommand': self.vbar.set})
kw['yscrollcommand'] = self.vbar.set
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kw is a dict as passed to __init__(..., **kw) in line 21

Text.__init__(self, self.frame, **kw)
self.pack(side=LEFT, fill=BOTH, expand=True)
self.vbar['command'] = self.yview
Expand Down
2 changes: 1 addition & 1 deletion Lib/xmlrpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def register_multicall_functions(self):
see http://www.xmlrpc.com/discuss/msgReader$1208"""

self.funcs.update({'system.multicall' : self.system_multicall})
self.funcs['system.multicall'] = self.system_multicall
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.funcs = {} is a dict as defined in line 167 of this file


def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
"""Dispatches an XML-RPC method from marshalled (XML) data.
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy