Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention Py_SetProgramName in example for very high level embedding #60574

Closed
asvetlov opened this issue Oct 31, 2012 · 5 comments
Closed

Mention Py_SetProgramName in example for very high level embedding #60574

asvetlov opened this issue Oct 31, 2012 · 5 comments
Labels
docs Documentation in the Doc dir easy type-feature A feature request or enhancement

Comments

@asvetlov
Copy link
Contributor

BPO 16370
Nosy @asvetlov, @cjerdonek
Files
  • issue16370.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-10-31.14:05:39.086>
    created_at = <Date 2012-10-31.10:50:51.584>
    labels = ['easy', 'type-feature', 'docs']
    title = 'Mention Py_SetProgramName in example for very high level embedding'
    updated_at = <Date 2012-10-31.14:05:39.085>
    user = 'https://github.com/asvetlov'

    bugs.python.org fields:

    activity = <Date 2012-10-31.14:05:39.085>
    actor = 'asvetlov'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2012-10-31.14:05:39.086>
    closer = 'asvetlov'
    components = ['Documentation']
    creation = <Date 2012-10-31.10:50:51.584>
    creator = 'asvetlov'
    dependencies = []
    files = ['27805']
    hgrepos = []
    issue_num = 16370
    keywords = ['patch', 'easy']
    message_count = 5.0
    messages = ['174269', '174270', '174274', '174277', '174278']
    nosy_count = 5.0
    nosy_names = ['asvetlov', 'chris.jerdonek', 'docs@python', 'python-dev', 'Matt.Jones']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue16370'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3', 'Python 3.4']

    @asvetlov
    Copy link
    Contributor Author

    On Fri, Oct 26, 2012 at 12:02 AM, Tom Epperly <epperly2@llnl.gov> wrote:
    Regarding this section, http://docs.python.org/extending/embedding.html#very-high-level-embedding, according to http://docs.python.org/c-api/init.html Py_SetProgramName() should be called before Py_Initialize() (see the comment for Py_SetProgramName()). This matters for the particular case of Mac OS X (see http://mail.python.org/pipermail/pythonmac-sig/2012-October/023746.html).

    I recommend adding a Py_SetProgramName() to the example.

    Regards,

    Tom Epperly

    @asvetlov asvetlov added docs Documentation in the Doc dir easy labels Oct 31, 2012
    @asvetlov
    Copy link
    Contributor Author

    Patch for 2.7 applied, the same text should be for 3.2+

    Chris, please check my wording as native English speaker.

    @MattJones
    Copy link
    Mannequin

    MattJones mannequin commented Oct 31, 2012

    Andrew, below is a revision of your comment with a few corrections made by a native english speaker.


    Function :c:func:`Py_SetProgramName` should be called before :c:func:`Py_Initialize` to inform the interpreter about paths to Python run-time libraries. Next initialize the Python interpreter with :c:func:`Py_Initialize`, followed by the execution of a hard-coded Python script that prints the date and time. Afterwards, the :c:func:`Py_Finalize` call shuts the interpreter down, followed by the end of the program. In a real program, you may want to get the Python script from another source, perhaps a text-editor routine, a file, or a database. Getting the Python code from a file can better be done by using the :c:func:`PyRun_SimpleFile` function, which saves you the trouble of allocating memory space and loading the file contents.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 31, 2012

    New changeset 6e24eb832fb2 by Andrew Svetlov in branch '2.7':
    Issue bpo-16370: Mention Py_SetProgramName in example for very high level embedding.
    http://hg.python.org/cpython/rev/6e24eb832fb2

    New changeset 4c35f5ec6acf by Andrew Svetlov in branch '3.2':
    Issue bpo-16370: Mention Py_SetProgramName in example for very high level embedding.
    http://hg.python.org/cpython/rev/4c35f5ec6acf

    New changeset b6a5f54e0a34 by Andrew Svetlov in branch '3.3':
    Merge issue bpo-16370: Mention Py_SetProgramName in example for very high level embedding.
    http://hg.python.org/cpython/rev/b6a5f54e0a34

    New changeset 0c1b81465d9c by Andrew Svetlov in branch 'default':
    Merge issue bpo-16370: Mention Py_SetProgramName in example for very high level embedding.
    http://hg.python.org/cpython/rev/0c1b81465d9c

    @asvetlov
    Copy link
    Contributor Author

    Thanks, Matt!

    @asvetlov asvetlov changed the title Regarding embedding Python in Another Application Mention Py_SetProgramName in example for very high level embedding Oct 31, 2012
    @asvetlov asvetlov added the type-feature A feature request or enhancement label Oct 31, 2012
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir easy type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant