This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add sethostname()
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, loewis, pitrou, rosslagerwall
Priority: normal Keywords: patch

Created on 2011-01-08 08:16 by rosslagerwall, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sethostname.patch rosslagerwall, 2011-01-08 08:16 Patch + test for issue
sethostname_v2.patch rosslagerwall, 2011-02-26 08:34 simplified
sethostname_v3.patch pitrou, 2011-02-26 12:18
Messages (8)
msg125761 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2011-01-08 08:16
This patch adds sethostname to the socket module (since socket has gethostname()).
msg129508 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-26 08:11
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.
msg129511 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2011-02-26 08:34
Here is a simplified version.
msg129533 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-26 12:18
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.
msg129567 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2011-02-26 16:07
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?
msg129568 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-26 16:13
> 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.
msg129569 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2011-02-26 16:18
> 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
msg129732 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-28 23:33
Patch committed in r88685 (3.3), closing.
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55075
2011-02-28 23:33:16pitrousetstatus: open -> closed
nosy: loewis, pitrou, giampaolo.rodola, rosslagerwall
messages: + msg129732

resolution: fixed
stage: patch review -> resolved
2011-02-26 16:18:03rosslagerwallsetnosy: loewis, pitrou, giampaolo.rodola, rosslagerwall
messages: + msg129569
2011-02-26 16:13:40pitrousetnosy: loewis, pitrou, giampaolo.rodola, rosslagerwall
messages: + msg129568
2011-02-26 16:07:34rosslagerwallsetnosy: loewis, pitrou, giampaolo.rodola, rosslagerwall
messages: + msg129567
2011-02-26 12:18:48pitrousetfiles: + sethostname_v3.patch
nosy: loewis, pitrou, giampaolo.rodola, rosslagerwall
messages: + msg129533
2011-02-26 08:34:40rosslagerwallsetfiles: + sethostname_v2.patch
nosy: loewis, pitrou, giampaolo.rodola, rosslagerwall
messages: + msg129511
2011-02-26 08:11:04pitrousetnosy: loewis, pitrou, giampaolo.rodola, rosslagerwall
messages: + msg129508
2011-01-10 17:04:37pitrousetnosy: + pitrou

type: enhancement
stage: patch review
2011-01-08 08:16:15rosslagerwallcreate