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

Add sethostname() #55075

Closed
rosslagerwall mannequin opened this issue Jan 8, 2011 · 8 comments
Closed

Add sethostname() #55075

rosslagerwall mannequin opened this issue Jan 8, 2011 · 8 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@rosslagerwall
Copy link
Mannequin

rosslagerwall mannequin commented Jan 8, 2011

BPO 10866
Nosy @loewis, @pitrou, @giampaolo
Files
  • sethostname.patch: Patch + test for issue
  • sethostname_v2.patch: simplified
  • sethostname_v3.patch
  • 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 2011-02-28.23:33:16.485>
    created_at = <Date 2011-01-08.08:16:15.567>
    labels = ['type-feature', 'library']
    title = 'Add sethostname()'
    updated_at = <Date 2011-02-28.23:33:16.484>
    user = 'https://bugs.python.org/rosslagerwall'

    bugs.python.org fields:

    activity = <Date 2011-02-28.23:33:16.484>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-02-28.23:33:16.485>
    closer = 'pitrou'
    components = ['Library (Lib)']
    creation = <Date 2011-01-08.08:16:15.567>
    creator = 'rosslagerwall'
    dependencies = []
    files = ['20312', '20904', '20909']
    hgrepos = []
    issue_num = 10866
    keywords = ['patch']
    message_count = 8.0
    messages = ['125761', '129508', '129511', '129533', '129567', '129568', '129569', '129732']
    nosy_count = 4.0
    nosy_names = ['loewis', 'pitrou', 'giampaolo.rodola', 'rosslagerwall']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue10866'
    versions = ['Python 3.3']

    @rosslagerwall
    Copy link
    Mannequin Author

    rosslagerwall mannequin commented Jan 8, 2011

    This patch adds sethostname to the socket module (since socket has gethostname()).

    @rosslagerwall rosslagerwall mannequin added the stdlib Python modules in the Lib dir label Jan 8, 2011
    @pitrou pitrou added the type-feature A feature request or enhancement label Jan 10, 2011
    @pitrou
    Copy link
    Member

    pitrou commented Feb 26, 2011

    I'm not sure why you use PyTuple_Size() and PyTuple_GetItem().
    You should be able to do a first call to PyArg_ParseTuple() (using the "S" specifier to mandate a bytes object), and call PyErr_Clear() and fallback to the second PyArg_ParseTuple() if the first one fails.

    @rosslagerwall
    Copy link
    Mannequin Author

    rosslagerwall mannequin commented Feb 26, 2011

    Here is a simplified version.

    @pitrou
    Copy link
    Member

    pitrou commented Feb 26, 2011

    New patch including a check for PyObject_GetBuffer()'s return value, the missing declaration of HAVE_SETHOSTNAME in pyconfig.h.in, and a test for giving a bytes values to the function.

    @rosslagerwall
    Copy link
    Mannequin Author

    rosslagerwall mannequin commented Feb 26, 2011

    The patch looks good.

    Just to be clear, on my system running "autoreconf" adds the correct stuff to pyconfig.h.in

    Isn't it best to leave it up to the committer to generate "configure" and "pyconfig.h.in", especially since different autoconf versions can create a lot of differences?

    @pitrou
    Copy link
    Member

    pitrou commented Feb 26, 2011

    The patch looks good.

    Just to be clear, on my system running "autoreconf" adds the correct
    stuff to pyconfig.h.in

    Ah, strange. I used "autoconf" and it didn't...

    Isn't it best to leave it up to the committer to generate "configure"
    and "pyconfig.h.in", especially since different autoconf versions can
    create a lot of differences?

    Right, but in this case the version was the same and it was easier to
    create the patch that way.

    @rosslagerwall
    Copy link
    Mannequin Author

    rosslagerwall mannequin commented Feb 26, 2011

    Ah, strange. I used "autoconf" and it didn't...

    From the man page of autoreconf:
    Run autoconf' (and autoheader', aclocal', automake', autopoint' (formerly gettextize'), and libtoolize' where appropriate) repeatedly to remake the GNU Build System files in the DIRECTORIES or the direc‐ tory trees driven by CONFIGURE-AC (defaulting to .').

    I guess it autoheader that regenerates pyconfig.h.in

    @pitrou
    Copy link
    Member

    pitrou commented Feb 28, 2011

    Patch committed in r88685 (3.3), closing.

    @pitrou pitrou closed this as completed Feb 28, 2011
    @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
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant