Commit Graph

4621 Commits

Author SHA1 Message Date
Jelle Zijlstra
afa2a8e3dd mailbox: improve bytes handling (#9083)
- The _MessageData alias refers to objects handled in the
  _dump_message method: 016c7d37b6/Lib/mailbox.py (L210)
- The path passed to __init__ should be a str path because there are
  many places in the file (search for self._path) where we join it
  with a str, which won't work with a bytes path.
2022-11-08 21:50:51 +00:00
Nikita Sobolev
62a6c3d616 Annotate known magic-method return types (#9131) 2022-11-08 18:28:42 +00:00
Alex Waygood
739460291b Use recursive type aliases in builtins and _typeshed (#9134) 2022-11-08 17:04:09 +00:00
Alex Waygood
4f381af4c5 Upgrade mypy to 0.990 (#9123) 2022-11-07 11:20:47 -08:00
Jelle Zijlstra
68924e00e5 os: improve bytes handling (#9072) 2022-11-06 21:32:46 -08:00
Jelle Zijlstra
340eb1264b unicodedata: accepts ReadOnlyBuffer (#9106) 2022-11-06 21:17:06 -08:00
Jelle Zijlstra
1d4eed1c9d zipfile: improve bytes handling (#9109)
Technically some uses of `pwd` accept more types, but others
use `isinstance()` to enforce only `bytes`. It seems better to
keep the same type throughout the module.
2022-11-06 21:16:27 -08:00
Jelle Zijlstra
6639e2e14c sqlite3: Blob.write accepts buffer (#9097) 2022-11-06 21:06:55 -08:00
Jelle Zijlstra
1f7648976c unittest: cannot use bytes regexes (#9107)
```
>>> from unittest.case import TestCase
>>> c = TestCase()
>>> with c.assertRaisesRegex(Exception, b"x"): 1/0
...
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/case.py", line 274, in __exit__
    if not expected_regex.search(str(exc_value)):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot use a bytes pattern on a string-like object
```
2022-11-05 14:14:53 -07:00
Jelle Zijlstra
3d64286f9e winsound: accepts buffers (#9108)
b5f711185b/PC/winsound.c (L93)
2022-11-05 13:52:31 -07:00
Jelle Zijlstra
0e1ca279a4 struct: add missing pos-only markers (#9099) 2022-11-04 23:00:33 -07:00
Jelle Zijlstra
f678fac75a tokenize: you can tokenize bytearrays too (#9102) 2022-11-04 22:59:05 -07:00
Jelle Zijlstra
cff08b674a isort: Add more to extra_standard_library (#9098) 2022-11-04 22:56:40 -07:00
Jelle Zijlstra
7ef7029f88 smtplib: Improve bytes handling (#9094) 2022-11-04 20:08:10 -07:00
Nikita Sobolev
9f0d0b9af7 zipimport: improve bytes handling (#9087) 2022-11-04 17:58:59 -07:00
Jelle Zijlstra
7299b07790 multiprocessing: improve bytes handling (#9085) 2022-11-04 10:58:58 +01:00
Nikita Sobolev
e68567a1b4 tarfile: improve bytes handling (#9076) 2022-11-03 10:15:46 -07:00
Nikita Sobolev
86f9d93003 Update pyright to 1.1.278 (#9077)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-11-03 15:32:10 +00:00
Jelle Zijlstra
a17fa5001a pickletools: accepts bytearray, use protocol from _typeshed (#9073) 2022-11-03 16:20:03 +01:00
Jelle Zijlstra
2f3f8da90a msvcrt: improve bytes handling (#9071) 2022-11-03 12:11:36 +01:00
Jelle Zijlstra
43631078f0 importlib: improve bytes handling (#9070) 2022-11-03 12:00:24 +01:00
Jelle Zijlstra
82bf494534 quopri: improve types (#9074) 2022-11-03 11:37:59 +01:00
Alex Waygood
22c5afa2d2 http.server.SimpleHTTPRequestHandler: Fix version branching (#9075) 2022-11-03 11:17:50 +01:00
Jelle Zijlstra
6b702452b6 http: improve types (#9055) 2022-11-03 09:55:56 +01:00
Jelle Zijlstra
460158fc40 imaplib: _Authenticator also works with bytearray (#9056) 2022-11-02 20:55:41 -07:00
Nikita Sobolev
f972bdfd96 io, codecs: improve bytes handling (#9059) 2022-11-02 09:32:06 -07:00
Shantanu
a3ce512095 typing: remove metaclass from Sized (#9058)
as per https://github.com/python/typeshed/pull/8977#issuecomment-1297872394
2022-11-01 18:38:52 -07:00
Sebastian Rittau
e7e94dd101 Make unittest.patch.* methods static (#7543) 2022-11-01 13:09:56 +01:00
Jelle Zijlstra
62ddebb65c fcntl: fix fcntl arg type (s#) (#9052) 2022-11-01 12:34:04 +01:00
Jelle Zijlstra
4d40fc6c8a logging: StreamHandler.send takes ReadableBuffer (#9057) 2022-11-01 11:52:30 +01:00
Jelle Zijlstra
7ab933f3c3 email: improve bytes handling (#9032) 2022-11-01 10:13:30 +01:00
Jelle Zijlstra
3e46f9a9ee dbm: fix bytes handling (#9030) 2022-11-01 10:10:37 +01:00
Jelle Zijlstra
39936cd18a hmac: also support bytearray in 3.7 branch (#9054) 2022-10-31 23:28:53 -07:00
Jelle Zijlstra
524cd53d73 gzip: remove Any usage (#9053) 2022-10-31 23:14:12 -07:00
Nikita Sobolev
34e147fcd9 plistlib: improve bytes handling (#9048) 2022-10-31 21:01:23 -07:00
Nikita Sobolev
8036bbdce1 marshal: improve bytes handling (#9047)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-31 13:24:18 -07:00
Jelle Zijlstra
3d8d744eb4 ctypes: improve bytes handling (#9029) 2022-10-31 15:26:09 +01:00
Nikita Sobolev
ae75d68fe9 hmac: improve bytes handling (#9046) 2022-10-31 07:11:50 -07:00
Jelle Zijlstra
c347c29417 builtins: improve bytes handling (#9027) 2022-10-30 17:32:07 -07:00
Nikita Sobolev
6569deaa44 json: improve bytes handling (#9042) 2022-10-30 16:26:48 -07:00
Nikita Sobolev
fb61f37d13 encodings: improve bytes handling (#9043) 2022-10-30 16:24:46 -07:00
Nikita Sobolev
e8595f3df3 gzip: improve bytes handling (#9037) 2022-10-30 13:21:31 -07:00
Nikita Sobolev
b24a22c359 asyncore: improve bytes handling (#9034) 2022-10-30 06:42:32 -07:00
Nikita Sobolev
6fcd68185a zlib: improve bytes handling (#9036) 2022-10-30 06:39:59 -07:00
Nikita Sobolev
a96cb58160 binhex: improve bytes handling (#9035) 2022-10-30 06:36:30 -07:00
Jelle Zijlstra
276a4d7d69 difflib: diff_bytes accepts bytearray (#9031) 2022-10-28 19:42:47 -07:00
Shantanu
4d3cc1f613 dis: fix types (#9025)
`_get_code_object` cannot take bytes
2022-10-28 17:51:29 -07:00
Jelle Zijlstra
583b600db0 asyncio: improve bytes handling (#9013) 2022-10-29 00:36:44 +02:00
Jelle Zijlstra
b8659e69f5 array: one more bad bytes type (#9022) 2022-10-28 14:18:19 -07:00
Nikita Sobolev
49d3393732 imaplib: fix bytes usage (#9021) 2022-10-28 14:06:55 -07:00