Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e765f7d

Browse files
committed
Fix reference counts of sys_trace and sys_profile
1 parent 33693ea commit e765f7d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Python/sysmodule.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/***********************************************************
2-
Copyright 1991 by Stichting Mathematisch Centrum, Amsterdam, The
2+
Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
33
Netherlands.
44
55
All Rights Reserved
@@ -101,7 +101,9 @@ sys_settrace(self, args)
101101
{
102102
if (args == None)
103103
args = NULL;
104-
XINCREF(args);
104+
else
105+
INCREF(args);
106+
XDECREF(sys_trace);
105107
sys_trace = args;
106108
INCREF(None);
107109
return None;
@@ -114,7 +116,9 @@ sys_setprofile(self, args)
114116
{
115117
if (args == None)
116118
args = NULL;
117-
XINCREF(args);
119+
else
120+
INCREF(args);
121+
XDECREF(sys_profile);
118122
sys_profile = args;
119123
INCREF(None);
120124
return None;

0 commit comments

Comments
 (0)