Matt Harbison <matt_harbison@yahoo.com> [Thu, 25 Jul 2024 14:40:38 -0400] rev 51741
pure: stringify builtin exception messages
Builtin exceptions usually want strings, and display with a wierd b'' prefix if
given bytes.
Matt Harbison <matt_harbison@yahoo.com> [Mon, 29 Jul 2024 12:10:08 -0400] rev 51740
httppeer: avoid another bad reference before assignment warning
This wasn't a problem, because `b''` from the `AttributeError` handler is in
`bundle2.bundletypes`, so the following loop and conditional always run at least
once. But PyCharm can't figure that out on its own, and it took a little
exploring to figure out it wasn't a problem. The usage in `bundle2.writebundle`
is to look it up in the map of bundle types, so it will break in a more obvious
way in the unlikely event that the empty string is removed from the map in the
future.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 26 Jul 2024 21:59:34 -0400] rev 51739
httppeer: move a variable to avoid a bad reference before assignment warning
No actual bug here, because the conditional used to assign is the same as the
conditional in the `finally` block that guards the reference.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 26 Jul 2024 21:54:07 -0400] rev 51738
httppeer: simplify two-way stream cleanup
No need to conditionalize the cleanup if the filename is assigned outside the
exception handler. I suppose `fd` leaks if `os.fdopen()` fails, but that was
the case before too (and may trigger another exception in the `finally` block on
Windows, when the file is still open).
Raphaël Gomès <rgomes@octobus.net> [Mon, 29 Jul 2024 10:07:53 +0200] rev 51737
rustfmt: update expected Rust edition
In this case it doesn't change anything, but we've been using 2021 for a
while now.
Raphaël Gomès <rgomes@octobus.net> [Mon, 29 Jul 2024 10:04:00 +0200] rev 51736
hghave: update expected rustfmt version
We still use nightly, but have moved to a newer nightly after the last
CI image upgrade in
74f1bf147a6d and
3876d4c6c79e.
Raphaël Gomès <rgomes@octobus.net> [Mon, 29 Jul 2024 10:06:28 +0200] rev 51735
rustfmt: apply formatting expected by newer nightly version
This was missed in
3876d4c6c79ec5c71e8c51b876cc157e93a5eaac somehow.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 25 Jul 2024 15:56:04 -0400] rev 51734
tests: stop skipping `mercurial/pure/osutil.py` during pytype runs
Not sure when the original issue(s) were fixed, but it works for me now.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 25 Jul 2024 13:31:13 -0400] rev 51733
largefiles: avoid a potentially undefined variable in exception case
The `wlock` variable is used to release the lock in the `finally` block, so it
would be undefined if `repo.wlock()` itself failed. Caught by pytype 2024.04.11
with py3.10.11.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 24 Jul 2024 22:40:22 -0400] rev 51732
typing: add trivial type hints to `mercurial.scmutil`
There's still a lot to go, but there's a lot here already, so I tried to keep it
to obvious/trivial things. I didn't bother with contexts, matchers, and
revisions that can be `bytes | int | None`.
Matt Harbison <matt_harbison@yahoo.com> [Wed, 24 Jul 2024 18:17:00 -0400] rev 51731
typing: narrow the scope of some recent disabled import warnings
These comments were added in
39e2b2d062c1, but had the effect of changing the
known type to `Any`, which cascaded through a few function signatures. Just
ignore the import error instead.
Julien Cristau <jcristau@debian.org> [Fri, 26 Jul 2024 10:52:28 +0200] rev 51730
demandimport: don't delay threading import
A recent cpython change breaks demandimport by importing threading
locally in importlib.util.LazyLoader.exec_module; add it (plus warnings
and _weakrefset, which are imported by threading) to demandimport's
ignore list.
```
Traceback (most recent call last):
File "/usr/bin/hg", line 57, in <module>
from mercurial import dispatch
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "/usr/lib/python3/dist-packages/hgdemandimport/demandimportpy3.py", line 52, in exec_module
super().exec_module(module)
File "<frozen importlib.util>", line 257, in exec_module
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "/usr/lib/python3/dist-packages/hgdemandimport/demandimportpy3.py", line 52, in exec_module
super().exec_module(module)
File "<frozen importlib.util>", line 267, in exec_module
AttributeError: partially initialized module 'threading' has no attribute 'RLock' (most likely due to a circular import)
```
Ref: https://github.com/python/cpython/issues/117983
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1076449
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1076747
Matt Harbison <matt_harbison@yahoo.com> [Tue, 23 Jul 2024 19:20:22 -0400] rev 51729
typing: induce pytype to use the standard `attr` instead of the vendored copy
What was previously happening with the vendored copy was that pytype would stub
out all(?) classes that were decorated with `@attr.s` as `Any`. After this, we
get a ton of classes defined, and numerous fields and methods now have proper
types.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 23 Jul 2024 19:14:16 -0400] rev 51728
typing: disable some pytype errors in `mercurial.store`
These seem to be legitimate errors, since one of the two callers
(`encodedstore.data_entries()`) was previously typed to generate
`BaseStoreEntry`. However, that and the other caller only pass
`RevlogStoreEntry` objects. I can't tell if this was a WIP or what, but don't
want to get side tracked on this. So flag as a TODO for later.
Matt Harbison <matt_harbison@yahoo.com> [Tue, 23 Jul 2024 19:05:26 -0400] rev 51727
linelog: correct the default value of `annotateresult.lines`
This was flagged by pytype once it was tricked into using the standard `attr`
package instead of the vendored copy.