Skip to content

Commit 871e4c7

Browse files
authored
Merge branch 'master' into fix-changelog-2
2 parents aca433d + f17fedd commit 871e4c7

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

.github/workflows/docs-localization-download.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
working-directory: ./docs
4141
- name: "Crowdin"
4242
id: crowdin
43-
uses: crowdin/[email protected].0
43+
uses: crowdin/[email protected].1
4444
with:
4545
upload_sources: false
4646
upload_translations: false

.github/workflows/docs-localization-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
sphinx-intl update -p ./build/locales ${{ vars.SPHINX_LANGUAGES }}
4545
working-directory: ./docs
4646
- name: "Crowdin"
47-
uses: crowdin/[email protected].0
47+
uses: crowdin/[email protected].1
4848
with:
4949
upload_sources: true
5050
upload_translations: false

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@ These changes are available on the `master` branch, but have not yet been releas
106106
- Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`.
107107
([#2739](https://github.com/Pycord-Development/pycord/pull/2739))
108108
- Fixed missing `None` type hints in `Select.__init__`.
109-
([#2746])(https://github.com/Pycord-Development/pycord/pull/2746)
109+
([#2746](https://github.com/Pycord-Development/pycord/pull/2746))
110+
- Fixed `TypeError` when using `Flag` with Python 3.11+.
111+
([#2759](https://github.com/Pycord-Development/pycord/pull/2759))
110112
- Fixed `TypeError` when specifying `thread_name` in `Webhook.send`.
111-
([#2761])(https://github.com/Pycord-Development/pycord/pull/2761)
113+
([#2761](https://github.com/Pycord-Development/pycord/pull/2761))
112114
- Updated `valid_locales` to support `in` and `es-419`.
113115
([#2767](https://github.com/Pycord-Development/pycord/pull/2767))
114116
- Fixed `Webhook.edit` not working with `attachments=[]`.

discord/ext/commands/flags.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@
3131
from dataclasses import dataclass, field
3232
from typing import TYPE_CHECKING, Any, Iterator, Literal, Pattern, TypeVar, Union
3333

34-
from discord.utils import MISSING, MissingField, maybe_coroutine, resolve_annotation
35-
36-
if sys.version_info >= (3, 11):
37-
_MISSING = MissingField
38-
else:
39-
_MISSING = MISSING
34+
from discord.utils import (
35+
MISSING,
36+
maybe_coroutine,
37+
resolve_annotation,
38+
)
4039

4140
from .converter import run_converters
4241
from .errors import (
@@ -59,6 +58,10 @@
5958
from .context import Context
6059

6160

61+
def _missing_field_factory() -> field:
62+
return field(default_factory=lambda: MISSING)
63+
64+
6265
@dataclass
6366
class Flag:
6467
"""Represents a flag parameter for :class:`FlagConverter`.
@@ -86,13 +89,13 @@ class Flag:
8689
Whether multiple given values overrides the previous value.
8790
"""
8891

89-
name: str = _MISSING
92+
name: str = _missing_field_factory()
9093
aliases: list[str] = field(default_factory=list)
91-
attribute: str = _MISSING
92-
annotation: Any = _MISSING
93-
default: Any = _MISSING
94-
max_args: int = _MISSING
95-
override: bool = _MISSING
94+
attribute: str = _missing_field_factory()
95+
annotation: Any = _missing_field_factory()
96+
default: Any = _missing_field_factory()
97+
max_args: int = _missing_field_factory()
98+
override: bool = _missing_field_factory()
9699
cast_to_dict: bool = False
97100

98101
@property

discord/utils.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import warnings
4040
from base64 import b64encode
4141
from bisect import bisect_left
42-
from dataclasses import field
4342
from inspect import isawaitable as _isawaitable
4443
from inspect import signature as _signature
4544
from operator import attrgetter
@@ -115,11 +114,6 @@ def __repr__(self) -> str:
115114

116115

117116
MISSING: Any = _MissingSentinel()
118-
# As of 3.11, directly setting a dataclass field to MISSING causes a ValueError. Using
119-
# field(default=MISSING) produces the same error, but passing a lambda to
120-
# default_factory produces the same behavior as default=MISSING and does not raise an
121-
# error.
122-
MissingField = field(default_factory=lambda: MISSING)
123117

124118

125119
class _cached_property:

0 commit comments

Comments
 (0)