GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-29779: new environment variable PYTHONHISTORY. · Pull Request #473 · python/cpython

Conversation

@ghost

@ghost ghost commented Mar 5, 2017

Copy link
Copy Markdown

if this variable is set the user can change the location of
a ~/.python_history file without adding hook to PYTHONSTARTUP.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@the-knights-who-say-ni

the-knights-who-say-ni commented Mar 5, 2017

Copy link
Copy Markdown

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:

  1. If you don't have an account on b.p.o, please create one
  2. Make sure your GitHub username is listed in "Your Details" at b.p.o
  3. If you have not already done so, please sign the PSF contributor agreement. The "bugs.python.org username " requested by the form is the "Login name" field under "Your Details".
  4. If you just signed the CLA, please wait at least one US business day and then check "Your Details" on bugs.python.org to see if your account has been marked as having signed the CLA (the delay is due to a person having to manually check your signed CLA)
  5. Reply here saying you have completed the above steps

Thanks again to your contribution and we look forward to looking at it!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@the-knights-who-say-ni the-knights-who-say-ni added the CLA not signed label Mar 5, 2017
@mention-bot

mention-bot commented Mar 5, 2017

Copy link
Copy Markdown

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Mar 5, 2017

Copy link
Copy Markdown
Author

I signed the CLA 😉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@warsaw

warsaw commented Mar 5, 2017

Copy link
Copy Markdown
Member

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@methane methane removed the CLA not signed label Mar 7, 2017
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Mar 7, 2017
@ghost

ghost commented Mar 8, 2017

Copy link
Copy Markdown
Author

@warsaw I added this to Misc/python.man

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@warsaw

warsaw commented Mar 8, 2017

Copy link
Copy Markdown
Member

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

warsaw
warsaw approved these changes Mar 8, 2017
View reviewed changes

@warsaw warsaw left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with one very minor style nit.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/site.py Outdated

@warsaw warsaw Mar 8, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor style nit: You don't need this extra blank line.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ghost

ghost commented Mar 9, 2017

Copy link
Copy Markdown
Author

@warsaw I updated main.c for python -h,
blank line fixed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@warsaw

warsaw commented Mar 9, 2017

Copy link
Copy Markdown
Member

The changes look great to me, but I'm going to wait just a bit before merging this.

  • I'd like to see if any other core dev has an opinion about the change
  • The AppVeyor test is failing, although I suspect that is unrelated to your change

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)?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ned-deily
ned-deily requested changes Mar 9, 2017
View reviewed changes

@ned-deily ned-deily left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ned-deily

ned-deily commented Mar 9, 2017

Copy link
Copy Markdown
Member

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost changed the title New environment variable PYTHONHISTORY. bpo-29779: new environment variable PYTHONHISTORY. Mar 10, 2017
@ghost

ghost commented Mar 10, 2017

Copy link
Copy Markdown
Author

@warsaw I tried rebasing against master and the build passed!
and Misc/NEWS updated.

@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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

warsaw
warsaw requested changes Mar 10, 2017
View reviewed changes

@warsaw warsaw left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of other thoughts on the implementation and NEWS file entry.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/site.py Outdated

@warsaw warsaw Mar 10, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Misc/NEWS Outdated

@warsaw warsaw Mar 10, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change Issue #29779 to bpo-29779. That's the new style of marking issue numbers.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@warsaw

warsaw commented Mar 10, 2017

Copy link
Copy Markdown
Member

Oh, and it would be nice to add a test for codecov.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ned-deily

ned-deily commented Mar 10, 2017

Copy link
Copy Markdown
Member

Thanks for addressing my comments!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ned-deily
ned-deily approved these changes Mar 10, 2017
View reviewed changes
@ghost

ghost commented Mar 10, 2017 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

@warsaw all done, I changed set_history_file() to gethistoryfile().
and added test.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@warsaw

warsaw commented Mar 14, 2017

Copy link
Copy Markdown
Member

@0xl3vi We still need a test.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@warsaw

warsaw commented Mar 14, 2017

Copy link
Copy Markdown
Member

Oh and yay for Misc/NEWS conflicts. :(

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@warsaw

warsaw commented Mar 14, 2017

Copy link
Copy Markdown
Member

Also note this report which I can confirm.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Mar 15, 2017

Copy link
Copy Markdown
Author

@warsaw sorry for the dealy.
what tests we need add?

regarding this
If the PYTHONHISTORY is empty it will fall back to .python_history.
there is no error on my build

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@warsaw

warsaw commented Mar 15, 2017

Copy link
Copy Markdown
Member

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Levi Sabah
bpo-29779: new environment variable PYTHONHISTORY.
5baa03e
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.
@ghost

ghost commented Mar 15, 2017 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

@warsaw OK updated.

  • In case PYTHONHISTORY will be empty or not set,
    it wil fall back to the default history file.
    if the file pointed by PYTHONHISTORY does not exist readline will create one.

The test checks if gethistoryfile() reads the variable.
Bash will expand '~' so we dont need to to test the path.

what do you think?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

berkerpeksag
berkerpeksag requested changes Mar 22, 2017
View reviewed changes

@berkerpeksag berkerpeksag left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs to be documented in Doc/whatsnew/3.7.rst (and please add "(Contributed by Your Name.)")

Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/using/cmdline.rst
.. 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.

@berkerpeksag berkerpeksag Mar 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

``~/.python_history``

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/using/cmdline.rst

.. envvar:: PYTHONHISTORY

If set to a non-empty string, you can change the location of a python_history

@berkerpeksag berkerpeksag Mar 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"a ``.python_history`` file" or just "a history file".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/site.py
if not use the default ~/.python_history file.
"""
h = os.environ.get("PYTHONHISTORY")
if h != '':

@berkerpeksag berkerpeksag Mar 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if os.environ.get("PYTHONHISTORY") returns None?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_site.py
self.assertEqual(dirs[1], wanted)

def test_gethistoryfile(self):
os.environ['PYTHONHISTORY'] = "xoxo"

@berkerpeksag berkerpeksag Mar 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use EnvironmentVarGuard in test.support to set env variables.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Misc/NEWS
-----------------

- bpo-29779: New environment variable PYTHONHISTORY if
this is set you can change the location of a python_history file.

@berkerpeksag berkerpeksag Mar 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add "Patch by Your Name."

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Misc/python.man
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.

@berkerpeksag berkerpeksag Mar 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Modules/main.c
" 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";

@berkerpeksag berkerpeksag Mar 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is a bit long.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ghost

ghost commented Mar 23, 2017

Copy link
Copy Markdown
Author

OK, I don't have time to do it.
If someone else want to implement this please do so.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost closed this Mar 23, 2017
@warsaw

warsaw commented Mar 27, 2017

Copy link
Copy Markdown
Member

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

ghost commented Mar 28, 2017

Copy link
Copy Markdown
Author

@warsaw sure if you want.
thanks 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZackerySpytz

ZackerySpytz commented May 15, 2019

Copy link
Copy Markdown
Contributor

@warsaw @berkerpeksag I have created a new PR for this feature: GH-13208. It addresses all of @berkerpeksag's comments.

yan12125 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jaraco pushed a commit that referenced this pull request Dec 2, 2022
@dependabot @ambv
Bump sentry-sdk from 1.1.0 to 1.3.1 (#473)
a7ce8c0
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] <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
@0xl3vi 0xl3vi mannequin mentioned this pull request Apr 10, 2022
New environment variable PYTHON_HISTORY #73965
Closed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@the-knights-who-say-ni @mention-bot @warsaw @ned-deily @ZackerySpytz @berkerpeksag @methane
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.