FreeBSD Bugzilla – Attachment 74764 Details for
Bug 108085
port devel/py-freebsd: reference counting bug
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.98 KB, created by
Martin Kammerhofer
on 2007-01-18 13:20:15 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Martin Kammerhofer
Created:
2007-01-18 13:20:15 UTC
Size:
1.98 KB
patch
obsolete
>--- TUTORIAL.orig Sun May 8 08:55:00 2005 >+++ TUTORIAL Sat Nov 25 18:06:41 2006 >@@ -165,7 +165,7 @@ > 'rumble' > >>> setproctitle('py-freebsd testing session') > >>> os.system('ps auxw|grep freebsd') >-perky 71593 0.0 0.8 6288 4176 p8 S+ 2:10AM 0:00.16 global: py-freebsd testing session (python) >+perky 71593 0.0 0.8 6288 4176 p8 S+ 2:10AM 0:00.16 rumble: py-freebsd testing session (python) > > > ==== >--- src/process.c.orig Sun May 8 08:55:00 2005 >+++ src/process.c Sat Nov 25 18:12:52 2006 >@@ -51,10 +51,19 @@ > static PyObject * > PyFB_setprogname(PyObject *self, PyObject *args) > { >- char *progname; >+ const char *progname; >+ static PyObject *namestr = NULL; > > if (!PyArg_ParseTuple(args, "s:setprogname", &progname)) > return NULL; >+ /* >+ * Setprogname(3) does not copy the string, it only stores the >+ * string pointer. Make sure that the string object does not >+ * get garbage collected and its memory reused! >+ */ >+ Py_XDECREF(namestr); /* maybe free old progname */ >+ PyArg_ParseTuple(args, "O", &namestr); >+ Py_INCREF(namestr); /* keep new progname object */ > > setprogname(progname); > Py_RETURN_NONE; >@@ -64,16 +73,24 @@ > static char PyFB_setproctitle__doc__[] = > "setproctitle(title):\n" > "The setproctitle() library routine sets the process title that\n" >-"appears on the ps(1) command."; >+"appears on the ps(1) command. The progname and a colon are\n" >+"prepended automatically. This behaviour is suppressed when the\n" >+"title starts with a dash (-) character. Calling with a None\n" >+"argument restores a default process title."; > > static PyObject * > PyFB_setproctitle(PyObject *self, PyObject *args) > { >- char *newtitle; >+ const char *newtitle; > >- if (!PyArg_ParseTuple(args, "s:setproctitle", &newtitle)) >+ if (!PyArg_ParseTuple(args, "z:setproctitle", &newtitle)) > return NULL; > >- setproctitle(newtitle); >+ if (newtitle == NULL) >+ setproctitle(NULL); >+ else if (*newtitle == '-') >+ setproctitle("-%s", newtitle+1); >+ else >+ setproctitle("%s", newtitle); > Py_RETURN_NONE; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 108085
: 74764