[ python-Bugs-1086555 ] refcount problem in syslog

SourceForge.net noreply at sourceforge.net
Fri Dec 17 00:52:25 CET 2004


Bugs item #1086555, was opened at 2004-12-16 11:36
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1086555&group_id=5470

Category: Python Library
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: DSM (dsm001)
Assigned to: Nobody/Anonymous (nobody)
Summary: refcount problem in syslog

Initial Comment:
Refcount problem in syslog.openlog, dating back awhile:

Python 2.5a0 (#10, Dec 15 2004, 19:53:33) 
[GCC 3.3.3 (Debian 20040401)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import syslog
[25538 refs]
>>> syslog.openlog('a')
[25539 refs]
>>> syslog.openlog(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: ident string [, logoption [, facility]]
[25575 refs]
>>> syslog.openlog(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: ident string [, logoption [, facility]]
[25574 refs]
>>> syslog.openlog(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: ident string [, logoption [, facility]]
[25573 refs]

[etc..]

>>> syslog.openlog(0)
Fatal Python error:
/home/doug/cvsroot/python/dist/src/Modules/syslogmodule.c:62
object at 0x402d75d8 has negative ref count -4
Aborted

ISTM there's a misplaced Py_XDECREF in syslog_openlog.
 It's fine as long as no log is open, but after that
each failed PyArg_ParseTuple costs you a ref.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2004-12-16 18:52

Message:
Logged In: YES 
user_id=80475

Fixed.
See Modules/sysmodule.c 2.20


Thanks for submitting the bug report and testing the patch.


----------------------------------------------------------------------

Comment By: DSM (dsm001)
Date: 2004-12-16 13:51

Message:
Logged In: YES 
user_id=1175690

Patch works after correcting typo (*new_S_ident_0 should be
*new_S_ident_o); openlog() and closelog() both seem to
refcount as expected; and passes make test without difficulty.


----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-12-16 11:54

Message:
Logged In: YES 
user_id=80475

See if the attached patch solves your problem.
Also, please run the full test suite.
(I'm on Windows and cannot exercise this code.)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1086555&group_id=5470


More information about the Python-bugs-list mailing list