- Jan 21, 2020
-
-
Gregory Szorc authored
The demand importer functionality isn't working at all on Python 3.5. I'm not sure what's wrong. Since it isn't working, let's disable it completely. ``` $ HGRCPATH= hyperfine -w 1 -r 50 -- "~/.pyenv/versions/3.5.9/bin/python ./hg version" \ "HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version" Benchmark #1: ~/.pyenv/versions/3.5.9/bin/python ./hg version Time (mean ± σ): 163.7 ms ± 2.2 ms [User: 148.5 ms, System: 15.7 ms] Range (min … max): 161.0 ms … 170.2 ms 50 runs Benchmark #2: HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version Time (mean ± σ): 164.3 ms ± 1.4 ms [User: 148.2 ms, System: 16.6 ms] Range (min … max): 161.4 ms … 169.8 ms 50 runs ``` Differential Revision: https://phab.mercurial-scm.org/D7953
-
- Dec 01, 2019
-
-
Matt Harbison authored
This is just removing the b'' prefix (except demandimportpy2), and making sure it is triple quoted. I skipped the mapping.py module in zope because that's 3rd party code. Differential Revision: https://phab.mercurial-scm.org/D7539
-
- Nov 08, 2019
-
-
Augie Fackler authored
This is the promised second step on single-quoted strings. These had existed because our source transformer didn't turn r'' into b'', so we had tagged some strings as r-strings to get "native" strings on both Pythons. Now that the transformer is gone, we can dispense with this nonsense. Methodology: I ran hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$' | xargs egrep --color=never -n -- \[\^b\]\[\^a-z\]r\'\[\^\'\\\\\]\*\'\[\^\'\ in an emacs grep-mode buffer, and then used a keyboard macro to iterate over the results and remove the r prefix as needed. # skip-blame removing unneeded r prefixes left over from Python 3 migration. Differential Revision: https://phab.mercurial-scm.org/D7306
-
- Nov 07, 2019
-
-
Augie Fackler authored
This is only double-quoted strings. I'll do single-quoted strings as a second step. These had existed because our source transformer didn't turn r"" into b"", so we had tagged some strings as r-strings to get "native" strings on both Pythons. Now that the transformer is gone, we can dispense with this nonsense. Methodology: I ran hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$' | xargs egrep --color=never -n -- \[\^a-z\]r\"\[\^\"\\\\\]\*\"\[\^\"\] in an emacs grep-mode buffer, and then used a keyboard macro to iterate over the results and remove the r prefix as needed. # skip-blame removing unneeded r prefixes left over from Python 3 migration. Differential Revision: https://phab.mercurial-scm.org/D7305
-
- Nov 02, 2019
-
-
Gregory Szorc authored
There was an inline comment denoting a bug in the lazy extension loader on Python 3.5 which prevents it from working there. But the code was not conditional on the Python version. The result of this was a myriad of failures on Python 3.5 due to getattr() and friends not working on lazy extension modules. By making extension modules non-lazy on Python 3.5, we reduce the number of test failures from 48 to 22 on that Python version.
-
- Oct 06, 2019
-
-
Augie Fackler authored
This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
-
- Aug 08, 2019
-
-
Pierre-Yves David authored
The `_session` module level variable is set within a function using the `global` keyword. This confuses my `test-check-pyflakes.t`. Explicitly declaring the variable at the top level solves the issue (and seems absolutely reasonable).
-
- Jun 12, 2019
-
-
Augie Fackler authored
Differential Revision: https://phab.mercurial-scm.org/D6526
-
Augie Fackler authored
I'm about to add support for counters, and want to avoid duplicating this logic. Differential Revision: https://phab.mercurial-scm.org/D6525
-
Augie Fackler authored
This makes things feel a little less mysterious when modules are being imported. Differential Revision: https://phab.mercurial-scm.org/D6523
-
- Sep 01, 2018
-
-
Augie Fackler authored
When the pager forks off the main process, we can end up with the pipe closed prematurely. Rather than break hg entirely when that happens and tracing is active, just let lingering events disappear as needed. Differential Revision: https://phab.mercurial-scm.org/D4445
-
- Aug 21, 2018
-
-
Augie Fackler authored
This causes the evaluation of an import in Python 3 to emit some trace data. There's some interesting wrinkles in here, like the fact that before we even hit dispatch we've demand-imported `sys` several times, despite the fact that `sys` was already fully loaded as one of the first few statements in the `hg` script. I don't think that's actually costing us a ton of performance, but it's probably something we should investigate fixing some day. Differential Revision: https://phab.mercurial-scm.org/D4347
-
Augie Fackler authored
This lives in hgdemandimport because I want to instrument a bunch of low-level stuff including the bare `hg` script and demandimport, so it can't live at a higher layer. Differential Revision: https://phab.mercurial-scm.org/D4344
-
- May 06, 2018
-
-
Gregory Szorc authored
The list of modules to ignore is used for membership testing. Yet it is defined as a list. Sets are more efficient for membership testing. So this commit converts the module list to a set. Since we took an API hit, I renamed the variable to further clarify the change. This appears to reduce the CPU time for running 300 invocations of `hg log -r. -T '{rev}'` on my i7-6700K: before: 18.64s after: 18.44s Differential Revision: https://phab.mercurial-scm.org/D3440
-
- Jan 05, 2018
-
-
Pulkit Goyal authored
Differential Revision: https://phab.mercurial-scm.org/D1810
-
- Aug 22, 2017
-
-
durin42 authored
-
- Aug 16, 2017
-
-
Jun Wu authored
In chg's case, making modules lazily loaded could actually slow down things since chg pre-imports them. Therefore disable demandimport if chg is being used. This is not done by setting `HGDEMANDIMPORT` chg client-side because that has side-effects on child processes (hooks, etc). Differential Revision: https://phab.mercurial-scm.org/D351
-
- Aug 18, 2017
-
-
Jun Wu authored
The logic is now shared between demandimport{2,3}. Differential Revision: https://phab.mercurial-scm.org/D445
-
- Jul 16, 2017
-
-
Yuya Nishihara authored
In general, the attribute of the same name is overwritten by executing an import statement. import a.b print(a.b.c) # 'c' of a/b/__init__.py from a.b.c import d print(a.b.c) # a/b/c.py However, this appears not true for the scenario described in the test case, and surprisingly, "from a.b.c import d" works even if "a.b.c" is not a module. This patch works around the problem by taking the right module from sys.modules if available.
-
Yuya Nishihara authored
-
Yuya Nishihara authored
_import() was added by 868282fa29d8, but it is identical to _origimport() now.
-
- Apr 27, 2017
-
-
Yuya Nishihara authored
Proxy __dict__ and __doc__ explicitly instead. I'm not sure which is less evil, but this seems slightly simpler than hooking all attribute accesses.
-
- Apr 28, 2017
-
-
Yuya Nishihara authored
It's widely used in our codebase.
-
- May 01, 2017
-
-
Yuya Nishihara authored
_demandmod class is getting bigger, and I don't want to put more things in a dense form.
-
Yuya Nishihara authored
This looks better, and __eq__() may be overridden in an undesired way.
-
- May 21, 2017
-
-
Siddharth Agarwal authored
This implementation uses the new importlib finder/loader functionality available in Python 3.5 and up. # no-check-commit
-
Siddharth Agarwal authored
We're going to use the same ignore list for Python 3.
-
Siddharth Agarwal authored
In Python 3, demand loading is per-package. Keeping demandimport in the mercurial package would disable demand loading for any modules in mercurial.
-