]> granicus.if.org Git - python/commitdiff
Correct None refcount issue in Mac modules. (Are they
authorGeorg Brandl <georg@python.org>
Sun, 28 May 2006 21:57:35 +0000 (21:57 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 28 May 2006 21:57:35 +0000 (21:57 +0000)
still used?)

Mac/Modules/dlg/_Dlgmodule.c
Mac/Modules/dlg/dlgsupport.py
Mac/Modules/file/_Filemodule.c
Mac/Modules/file/filesupport.py
Python/import.c

index 64ddac8d3397f9629c2f8b176be18e70f2fbcdc4..46009a8c67a4ee9feb2190ab87f1a35b4932ca6a 100644 (file)
@@ -139,7 +139,7 @@ typedef struct DialogObject {
 PyObject *DlgObj_New(DialogPtr itself)
 {
        DialogObject *it;
-       if (itself == NULL) return Py_None;
+       if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }
        it = PyObject_NEW(DialogObject, &Dialog_Type);
        if (it == NULL) return NULL;
        it->ob_itself = itself;
index 1c0cc6a9f94583d492cde0939c3356b8ff778c35..fa1442ec37bdfe3ebeed25873e97a7468f4f0694 100644 (file)
@@ -202,7 +202,7 @@ class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
         Output("SetWRefCon(GetDialogWindow(itself), (long)it);")
 
     def outputCheckNewArg(self):
-        Output("if (itself == NULL) return Py_None;")
+        Output("if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }")
 
     def outputCheckConvertArg(self):
         Output("if (v == Py_None) { *p_itself = NULL; return 1; }")
index c211de136fac789094c05dc8144ea4b512063eec..07bd34129767ece56649bbe55b8a038815e121eb 100644 (file)
@@ -153,7 +153,7 @@ typedef struct FSCatalogInfoObject {
 static PyObject *FSCatalogInfo_New(FSCatalogInfo *itself)
 {
        FSCatalogInfoObject *it;
-       if (itself == NULL) return Py_None;
+       if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }
        it = PyObject_NEW(FSCatalogInfoObject, &FSCatalogInfo_Type);
        if (it == NULL) return NULL;
        it->ob_itself = *itself;
index f2d419328b2eff455da7b9acada7346c1da8a368..37aeb508a0952790a3e6402becab8cc40240e9d1 100644 (file)
@@ -475,7 +475,7 @@ class FSCatalogInfoDefinition(PEP253Mixin, ObjectDefinition):
         self.argref = "*"       # Store FSSpecs, but pass them by address
 
     def outputCheckNewArg(self):
-        Output("if (itself == NULL) return Py_None;")
+        Output("if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }")
 
     def output_tp_newBody(self):
         Output("PyObject *self;");
index 1a71b5cf6b30ad5096a2fbc22e6d5c918adc1f71..c49a91fc6a6ba02bbca83f9ac3daba604a5978a1 100644 (file)
@@ -2059,7 +2059,7 @@ PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals,
 /* Return the package that an import is being performed in.  If globals comes
    from the module foo.bar.bat (not itself a package), this returns the
    sys.modules entry for foo.bar.  If globals is from a package's __init__.py,
-   the package's entry in sys.modules is returned.
+   the package's entry in sys.modules is returned, as a borrowed reference.
 
    The *name* of the returned package is returned in buf, with the length of
    the name in *p_buflen.