| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA. This is necessary for legal reasons before we can look at your contribution. Please follow these steps to help rectify the issue:
Thanks again to your contribution and we look forward to looking at it! |
Sorry, something went wrong.
|
@0xl3vi, thanks for your PR! By analyzing the history of the files in this pull request, we identified @brettcannon, @tiran, @vsajip, @doko42 and @freddrake to be potential reviewers. |
Sorry, something went wrong.
|
I signed the CLA 😉 |
Sorry, something went wrong.
|
This is a nice change, and it would probably let me get rid of my $PYTHONSTARTUP setting. I wonder if python3 -h should mention this new envar? |
Sorry, something went wrong.
|
@0xl3vi Thanks, that looks good. It's still not mentioned in python3 -h but I'm not entirely sure it needs to. There are other PYTHON* environment variables not mentioned in the --help output. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, with one very minor style nit.
Sorry, something went wrong.
There was a problem hiding this comment.
Minor style nit: You don't need this extra blank line.
Sorry, something went wrong.
|
@warsaw I updated main.c for python -h, |
Sorry, something went wrong.
|
The changes look great to me, but I'm going to wait just a bit before merging this.
I don't have a Windows environment to test that on. Maybe @zooba can weigh in on that. Alternatively, try rebasing against master if it's been fixed there. If there are no other follow ups by this weekend, I'll merge your change. Can you please also add a Misc/NEWS entry (knowing that our workflow for that kind of sucks and we might get conflicts)? |
Sorry, something went wrong.
There was a problem hiding this comment.
Environment variables are also documented in the Python Setup and Usage document (https://docs.python.org/3/using/cmdline.html#environment-variables) which is generated from Doc/using/cmdline.rst.
Sorry, something went wrong.
|
Also there should be an issue opened on bugs.python.org to document this and the issue number added to the title of this pull request. |
Sorry, something went wrong.
|
@warsaw I tried rebasing against master and the build passed! @ned-deily I updated cmdline.rst and created new issue http://bugs.python.org/issue29779 P.S: I need to add bpo-XXX or just the issue number in bugs.python.org? |
Sorry, something went wrong.
There was a problem hiding this comment.
Just a couple of other thoughts on the implementation and NEWS file entry.
Sorry, something went wrong.
There was a problem hiding this comment.
You could also do something like:
return os.environ.get(
'PYTHONHISTORY',
os.path.expanduser(os.path.join('~', '.python_history')))Also set_history_file() is a little bit of a misnomer since it's not actually setting it, but calculating it instead. OTOH, I bet the more compact form could just be inlined below.
Sorry, something went wrong.
There was a problem hiding this comment.
Change Issue #29779 to bpo-29779. That's the new style of marking issue numbers.
Sorry, something went wrong.
|
Oh, and it would be nice to add a test for codecov. |
Sorry, something went wrong.
|
Thanks for addressing my comments! |
Sorry, something went wrong.
|
@warsaw all done, I changed set_history_file() to gethistoryfile(). |
Sorry, something went wrong.
|
Oh and yay for Misc/NEWS conflicts. :( |
Sorry, something went wrong.
|
Also note this report which I can confirm. |
Sorry, something went wrong.
|
@0xl3vi At the very least, I think a test covering gethistoryfile() would be useful. If you can mock out enough of the readline stuff (or other safeguards so as not to interfere with the environment of a person running the tests), then adding some coverage for enablerlcompleter() would be nice. The bug happens when the file pointed to by PYTHONHISTORY does not exist. |
Sorry, something went wrong.
this patch adds new environment variable PYTHONHISTORY, with this you can change the location of a python_history file, without using readline hook in PYTHONSTARTUP. In case PYTHONHISTORY will be empty or not set, it wil fall back to the default history file.
|
@warsaw OK updated.
The test checks if gethistoryfile() reads the variable. what do you think? |
Sorry, something went wrong.
There was a problem hiding this comment.
This also needs to be documented in Doc/whatsnew/3.7.rst (and please add "(Contributed by Your Name.)")
Thanks!
Sorry, something went wrong.
| .. envvar:: PYTHONHISTORY | ||
|
|
||
| If set to a non-empty string, you can change the location of a python_history | ||
| file, by default it will be in ~/.python_history. |
There was a problem hiding this comment.
``~/.python_history``
Sorry, something went wrong.
|
|
||
| .. envvar:: PYTHONHISTORY | ||
|
|
||
| If set to a non-empty string, you can change the location of a python_history |
There was a problem hiding this comment.
"a ``.python_history`` file" or just "a history file".
Sorry, something went wrong.
| if not use the default ~/.python_history file. | ||
| """ | ||
| h = os.environ.get("PYTHONHISTORY") | ||
| if h != '': |
There was a problem hiding this comment.
What if os.environ.get("PYTHONHISTORY") returns None?
Sorry, something went wrong.
| self.assertEqual(dirs[1], wanted) | ||
|
|
||
| def test_gethistoryfile(self): | ||
| os.environ['PYTHONHISTORY'] = "xoxo" |
There was a problem hiding this comment.
Please use EnvironmentVarGuard in test.support to set env variables.
Sorry, something went wrong.
| ----------------- | ||
|
|
||
| - bpo-29779: New environment variable PYTHONHISTORY if | ||
| this is set you can change the location of a python_history file. |
There was a problem hiding this comment.
Please add "Patch by Your Name."
Sorry, something went wrong.
| the value 0 will disable hash randomization. | ||
| .IP PYTHONHISTORY | ||
| If this is set you can change the location of a | ||
| python_history file, by default it will be ~/.python_history. |
There was a problem hiding this comment.
File names should be italic in man pages so \fI~/.python_history\fI or
python_history file, by default it will be
.IR ~/.python_history .You may need to escape ~ or / characters.
Sorry, something went wrong.
| " on Python memory allocators. Use PYTHONMALLOC=debug to install debug\n" | ||
| " hooks.\n"; | ||
| " hooks.\n" | ||
| "PYTHONHISTORY: If this is set, you can change the location of a python_history file.\n"; |
There was a problem hiding this comment.
This line is a bit long.
Sorry, something went wrong.
|
OK, I don't have time to do it. |
Sorry, something went wrong.
|
@0xl3vi Hi. I'm sorry this has taken so long. Are you saying in your comment that you don't have time to finish this branch? If so, that's okay and we greatly appreciate your contribution so far. I'm willing to finish this branch for you if you'd like. |
Sorry, something went wrong.
|
@warsaw @berkerpeksag I have created a new PR for this feature: GH-13208. It addresses all of @berkerpeksag's comments. |
Sorry, something went wrong.
Bumps [sentry-sdk](https://github.com/getsentry/sentry-python) from 1.1.0 to 1.3.1. - [Release notes](https://github.com/getsentry/sentry-python/releases) - [Changelog](https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md) - [Commits](getsentry/sentry-python@1.1.0...1.3.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
| Back | FazBrowse Home | New Git URL |
if this variable is set the user can change the location of
a ~/.python_history file without adding hook to PYTHONSTARTUP.