- May 31, 2022
-
-
Manuel Jacob authored
It seems like the original socket file object is always an io.BufferedIO instance. If not, the code will fail and we should try harder to get the socket object (e.g. if the original socket file object is unbuffered, we can get the `_sock` attribute directly from it).
-
Manuel Jacob authored
-
Manuel Jacob authored
-
- May 29, 2022
-
-
Manuel Jacob authored
On Python 3, file descriptors are already non-inheritable by default.
-
Manuel Jacob authored
-
Manuel Jacob authored
-
- May 31, 2022
-
-
Manuel Jacob authored
I’ve checked that both bytes and str gets passed as the `name` parameter, so the rest of the condition is still required. Because there aren’t really any tests for the extensions, I didn’t want to refactor it to pass a single type.
-
- May 30, 2022
-
-
Manuel Jacob authored
-
- May 29, 2022
-
-
Manuel Jacob authored
The O_CLOEXEC flag is passed by default on Python 3.
-
- May 30, 2022
-
-
Manuel Jacob authored
It accepts str and bytes.
-
Manuel Jacob authored
-
Manuel Jacob authored
-
- May 29, 2022
-
-
Manuel Jacob authored
-
Manuel Jacob authored
-
Manuel Jacob authored
Some code used its own xrange() compatibility code instead of pycompat.xrange().
-
Manuel Jacob authored
-
Manuel Jacob authored
I’m quite confident that the error can’t happen on Python 3, as the main motivation for separating bytes and str in Python 3 was to avoid this class of errors.
-
Manuel Jacob authored
-
Manuel Jacob authored
-
- May 28, 2022
-
-
Manuel Jacob authored
The selectors module was added in Python 3.4. Because we require Python 3.6, it will always be available. Therefore the selectors2 module is not imported. I’ve verified that the selectors2-specific workaround in commandserver.py is not necessary with the selectors module from the standard library. It returns an empty list if timeout was exceeded. The pytype directive was needed to silence the following error: File "/tmp/mercurial-ci/mercurial/worker.py", line 299, in _posixworker: No attribute 'close' on int [attribute-error] In Union[_typeshed.HasFileno, int] File "/tmp/mercurial-ci/mercurial/worker.py", line 299, in _posixworker: No attribute 'close' on _typeshed.HasFileno [attribute-error] In Union[_typeshed.HasFileno, int]
-
- Jun 08, 2022
-
-
Raphaël Gomès authored
-
Mathias De Mare authored
-
- Jun 04, 2022
-
-
Manuel Jacob authored
The deleted code didn’t work on Python 3. On Python 2 (or Python 3 after adapting it), the function returned in the error case. The subsequent creation of SSL socket fails during handshake with a nonsense error. Instead, the user should get an error of what went wrong. I don’t see how the deleted code would be useful in the error case. The new code is also closer of what the standard library is doing nowadays that it has proxy support (which we don’t use in the moment). In the test, I use port 0 because all the HGPORTs were already taken. In practice, there should not be any server listening on port 0.
-
- Jun 03, 2022
-
-
Pierre-Yves David authored
This should maybe be called "nodesfromfile", but at least the documentation is correct (it was previously a copy past from follow).
-
- Jun 02, 2022
-
-
Manuel Jacob authored
On Python 3, we have socket.socket.recvmsg(). This makes it possible to receive FDs in pure Python code. The new code behaves like the previous implementations, except that it’s more strict about the format of the ancillary data. This works because we know in which format the FDs are passed. Because the code is (and always has been) specific to chg (payload is 1 byte, number of passed FDs is limited) and we now have only one implementation and the code is very short, I decided to stop exposing a function in mercurial.util. Note on terminology: The SCM_RIGHTS mechanism is used to share open file descriptions to another process over a socket. The sending side passes an array of file descriptors and the receiving side receives an array of file descriptors. The file descriptors are different in general on both sides but refer to the same open file descriptions. The two terms are often conflated, even in the official documentation. That’s why I used “FD” above, which could mean both “file descriptor” and “file description”.
-
Manuel Jacob authored
On Python 2, socket.error was subscriptable. On Python 3, socket.error is an alias to OSError and is not subscriptable. The except block passes the exception to self.send_error(). This fails on both Python 2 (if it was executed) and Python 3, as it expects a string. Getting the attribute .strerror works on Python 2 and Python 3, and has the same effect as the previous code on Python 2.
-
- Jun 06, 2022
-
-
Anton Shestakov authored
GCC gave the following warning during `make local`: mercurial/cext/parsers.c: In function 'dirstate_item_from_v1_data': mercurial/cext/parsers.c:413:30: warning: too many arguments for format [-Wformat-extra-args] 413 | "unknown state: `%c` (%d, %d, %d)", state, mode, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To reproduce, you might need to add the -Wformat-extra-args flag, because it isn't present for me when building for the default python3. But I can see this warning while simply building 6.1 with `make PYTHON=python2 clean local`. I don't think this NULL was useful, because other instances of PyErr_Format() don't have any NULLs as the final argument, but keep in mind that I don't know python's C API.
-
- Jun 02, 2022
-
-
Manuel Jacob authored
-
- Jun 03, 2022
-
-
Pierre-Yves David authored
We return data, it is simpler when we know what these data means.
-
- May 22, 2022
-
-
Manuel Jacob authored
Previously, the code wrote the pickled data using os.write(). However, os.write() can write less bytes than passed to it. To trigger the problem, the pickled data had to be larger than 2147479552 bytes on my system. Instead, open a file object and pass it to pickle.dump(). This also has the advantage that it doesn’t buffer the whole pickled data in memory. Note that the opened file must be buffered because pickle doesn’t support unbuffered streams because unbuffered streams’ write() method might write less bytes than passed to it (like os.write()) but pickle.dump() relies on that all bytes are written (see https://github.com/python/cpython/issues/93050). The side effect of using a file object and a with statement is that wfd is explicitly closed now while it seems like before it was implicitly closed by process exit.
-
- Jun 01, 2022
-
-
Pierre-Yves David authored
Now that phabricator is no longer in us, we should avoid this useless step to save time and simplify things.
-
Pierre-Yves David authored
I though I would affect the template in the menu itself, however it just a normal piece of text that should not be here.
-
- May 31, 2022
-
-
Pierre-Yves David authored
-
Pierre-Yves David authored
-
Pierre-Yves David authored
-
Pierre-Yves David authored
-
Pierre-Yves David authored
-
Pierre-Yves David authored
-
Pierre-Yves David authored
-
Pierre-Yves David authored
-