Skip to content

Commit ba0af80

Browse files
committed
Add Null primitive data type
1 parent 8a8e863 commit ba0af80

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

compiler/api/compiler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def finish(self):
125125

126126
f.write("\n 0xbc799737: \"core.BoolFalse\",")
127127
f.write("\n 0x997275b5: \"core.BoolTrue\",")
128+
f.write("\n 0x56730bcc: \"core.Null\",")
128129
f.write("\n 0x1cb5c415: \"core.Vector\",")
129130
f.write("\n 0x73f1f8dc: \"core.MsgContainer\",")
130131
f.write("\n 0xae500895: \"core.FutureSalts\",")

compiler/api/source/main_api.tl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
---types---
88

99
// boolFalse#bc799737 = Bool; // Parsed manually
10-
// boolTrue#997275b5 = Bool; // parsed manually
10+
// boolTrue#997275b5 = Bool; // Parsed manually
1111

1212
// true#3fedd339 = True; // Not used
1313

1414
// vector#1cb5c415 {t:Type} # [ t ] = Vector t; // Parsed manually
1515

1616
// error#c4b9f9bb code:int text:string = Error; // Not used
1717

18-
// null#56730bcc = Null; // Not used
18+
// null#56730bcc = Null; // Parsed manually
1919

2020
inputPeerEmpty#7f3b18ea = InputPeer;
2121
inputPeerSelf#7da07ec9 = InputPeer;

pyrogram/api/core/primitives/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
from .bytes import Bytes
2121
from .double import Double
2222
from .int import Int, Long, Int128, Int256
23+
from .null import Null
2324
from .string import String
2425
from .vector import Vector
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Pyrogram - Telegram MTProto API Client Library for Python
2+
# Copyright (C) 2017 Dan Tès <https://github.com/delivrance>
3+
#
4+
# This file is part of Pyrogram.
5+
#
6+
# Pyrogram is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Lesser General Public License as published
8+
# by the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# Pyrogram is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public License
17+
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
18+
19+
from io import BytesIO
20+
21+
from ..object import Object
22+
23+
24+
class Null(Object):
25+
ID = 0x56730bcc
26+
27+
@staticmethod
28+
def read(b: BytesIO, *args) -> None:
29+
return None
30+
31+
def __new__(cls) -> bytes:
32+
return int.to_bytes(cls.ID, 4, "little")

0 commit comments

Comments
 (0)