Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Also add types to 'default_type'
  • Loading branch information
erlend-aasland committed May 16, 2023
commit dd1c773bf42521d40477e05561335922b4ba42b6
32 changes: 16 additions & 16 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2957,7 +2957,7 @@ def parser_name(self):

class bool_converter(CConverter):
type: str = 'int'
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
default_type = bool
default_type: bltns.type[bool] = bool
format_unit: str = 'p'
c_ignored_default: str = '0'

Expand Down Expand Up @@ -3008,7 +3008,7 @@ def set_template_dict(self, template_dict):

class char_converter(CConverter):
type: str = 'char'
default_type = (bytes, bytearray)
default_type: tuple[bltns.type[bytes], bltns.type[bytearray]] = (bytes, bytearray)
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
format_unit: str = 'c'
c_ignored_default: str = "'\0'"

Expand Down Expand Up @@ -3042,7 +3042,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:
@add_legacy_c_converter('B', bitwise=True)
class unsigned_char_converter(CConverter):
type: str = 'unsigned char'
default_type = int
default_type: bltns.type[int] = int
format_unit: str = 'b'
c_ignored_default: str = "'\0'"

Expand Down Expand Up @@ -3091,7 +3091,7 @@ class byte_converter(unsigned_char_converter): pass

class short_converter(CConverter):
type: str = 'short'
default_type = int
default_type: bltns.type[int] = int
format_unit: str = 'h'
c_ignored_default: str = "0"

Expand Down Expand Up @@ -3122,7 +3122,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:

class unsigned_short_converter(CConverter):
type: str = 'unsigned short'
default_type = int
default_type: bltns.type[int] = int
c_ignored_default: str = "0"

def converter_init(self, *, bitwise: bool = False) -> None:
Expand All @@ -3144,7 +3144,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:
@add_legacy_c_converter('C', accept={str})
class int_converter(CConverter):
type: str = 'int'
default_type = int
default_type: bltns.type[int] = int
format_unit: str = 'i'
c_ignored_default: str = "0"

Expand Down Expand Up @@ -3184,7 +3184,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:

class unsigned_int_converter(CConverter):
type: str = 'unsigned int'
default_type = int
default_type: bltns.type[int] = int
c_ignored_default: str = "0"

def converter_init(self, *, bitwise: bool = False) -> None:
Expand All @@ -3205,7 +3205,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:

class long_converter(CConverter):
type: str = 'long'
default_type = int
default_type: bltns.type[int] = int
format_unit: str = 'l'
c_ignored_default: str = "0"

Expand All @@ -3221,7 +3221,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:

class unsigned_long_converter(CConverter):
type: str = 'unsigned long'
default_type = int
default_type: bltns.type[int] = int
c_ignored_default: str = "0"

def converter_init(self, *, bitwise: bool = False) -> None:
Expand All @@ -3244,7 +3244,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:

class long_long_converter(CConverter):
type: str = 'long long'
default_type = int
default_type: bltns.type[int] = int
format_unit: str = 'L'
c_ignored_default: str = "0"

Expand All @@ -3260,7 +3260,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:

class unsigned_long_long_converter(CConverter):
type: str = 'unsigned long long'
default_type = int
default_type: bltns.type[int] = int
c_ignored_default: str = "0"

def converter_init(self, *, bitwise: bool = False) -> None:
Expand Down Expand Up @@ -3355,7 +3355,7 @@ def _parse_arg(self, argname: str, displayname: str) -> str:

class float_converter(CConverter):
type: str = 'float'
default_type = float
default_type: bltns.type[float] = float
format_unit: str = 'f'
c_ignored_default: str = "0.0"

Expand All @@ -3377,7 +3377,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:

class double_converter(CConverter):
type: str = 'double'
default_type = float
default_type: bltns.type[float] = float
format_unit: str = 'd'
c_ignored_default: str = "0.0"

Expand All @@ -3400,7 +3400,7 @@ def parse_arg(self, argname: str, displayname: str) -> str:

class Py_complex_converter(CConverter):
type: str = 'Py_complex'
default_type = complex
default_type: bltns.type[complex] = complex
format_unit: str = 'D'
c_ignored_default: str = "{0.0, 0.0}"

Expand Down Expand Up @@ -3691,7 +3691,7 @@ def parse_arg(self, argname: str, argnum: str) -> str:
class Py_buffer_converter(CConverter):
type: str = 'Py_buffer'
format_unit: str = 'y*'
impl_by_reference = True
impl_by_reference: bool = True
c_ignored_default: str = "{NULL, NULL}"

def converter_init(self, *, accept={buffer}) -> None:
Expand Down Expand Up @@ -3789,7 +3789,7 @@ class self_converter(CConverter):
A special-case converter:
this is the default converter used for "self".
"""
type = None
type: str | None = None
format_unit: str = ''

def converter_init(self, *, type=None) -> None:
Expand Down