mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-12 23:32:13 -04:00
Consistently use collections.abc.Mapping to check frozendict. (#12564)
This commit is contained in:
parent
e8d1ec0e92
commit
8a23bde823
5 changed files with 11 additions and 9 deletions
|
@ -12,11 +12,10 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import collections.abc
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Collection, Dict, Iterable, Optional, Set, Tuple
|
||||
|
||||
from frozendict import frozendict
|
||||
|
||||
from synapse.api.constants import EventTypes, Membership
|
||||
from synapse.api.errors import NotFoundError, UnsupportedRoomVersionError
|
||||
from synapse.api.room_versions import KNOWN_ROOM_VERSIONS, RoomVersion
|
||||
|
@ -160,7 +159,7 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||
predecessor = create_event.content.get("predecessor", None)
|
||||
|
||||
# Ensure the key is a dictionary
|
||||
if not isinstance(predecessor, (dict, frozendict)):
|
||||
if not isinstance(predecessor, collections.abc.Mapping):
|
||||
return None
|
||||
|
||||
# The keys must be strings since the data is JSON.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue