Browse Source

extras: breakpad: use io types for IO classes

typing.io doesn't seem to exist anymore.

typing.io was in Python 3.5 [^1] but not in 3.6 [^2].

```
Traceback (most recent call last):
  File "/builds/robUx4/vlc/./extras/breakpad/symb_upload.py", line 146, in <module>
    class OutputStore:
        def store(self, dump: typing.io.TextIO, meta):
            assert(False)
  File "/builds/robUx4/vlc/./extras/breakpad/symb_upload.py", line 147, in OutputStore
    def store(self, dump: typing.io.TextIO, meta):
                          ^^^^^^^^^
  File "/usr/lib/python3.13/typing.py", line 3817, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'typing' has no attribute 'io'. Did you mean: 'IO'?
```

[^1]: https://docs.python.org/3.5/library/typing.html#typing.io
[^2]: https://docs.python.org/3.6/library/typing.html
pull/188/head
Steve Lhomme 6 months ago
parent
commit
4bd5e2ecd1
  1. 7
      extras/breakpad/symb_upload.py

7
extras/breakpad/symb_upload.py

@ -7,7 +7,6 @@ import logging
import requests
import io
import shutil
import typing
class Dumper:
@ -147,7 +146,7 @@ class MacDumper(Dumper):
class OutputStore:
def store(self, dump: typing.io.TextIO, meta):
def store(self, dump: io.TextIOBase, meta):
assert (False)
@ -161,7 +160,7 @@ class HTTPOutputStore(OutputStore):
if prod:
self.extra_args["prod"] = prod
def store(self, dump: typing.io.TextIO, meta):
def store(self, dump: io.TextIOBase, meta):
post_args = {**meta, **self.extra_args}
r = requests.post(self.url, post_args, files={"symfile": dump})
if not r.ok:
@ -174,7 +173,7 @@ class LocalDirOutputStore(OutputStore):
super().__init__()
self.rootdir = rootdir
def store(self, dump: typing.io, meta):
def store(self, dump: io.IOBase, meta):
basepath = os.path.join(self.rootdir, meta["debug_file"], meta["debug_identifier"])
if not os.path.exists(basepath):
os.makedirs(basepath)

Loading…
Cancel
Save