mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Correct None refcount issue in Mac modules. (Are they
still used?)
This commit is contained in:
parent
c26025c562
commit
5f6861df93
5 changed files with 5 additions and 5 deletions
|
@ -139,7 +139,7 @@ typedef struct DialogObject {
|
||||||
PyObject *DlgObj_New(DialogPtr itself)
|
PyObject *DlgObj_New(DialogPtr itself)
|
||||||
{
|
{
|
||||||
DialogObject *it;
|
DialogObject *it;
|
||||||
if (itself == NULL) return Py_None;
|
if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }
|
||||||
it = PyObject_NEW(DialogObject, &Dialog_Type);
|
it = PyObject_NEW(DialogObject, &Dialog_Type);
|
||||||
if (it == NULL) return NULL;
|
if (it == NULL) return NULL;
|
||||||
it->ob_itself = itself;
|
it->ob_itself = itself;
|
||||||
|
|
|
@ -202,7 +202,7 @@ class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
|
||||||
Output("SetWRefCon(GetDialogWindow(itself), (long)it);")
|
Output("SetWRefCon(GetDialogWindow(itself), (long)it);")
|
||||||
|
|
||||||
def outputCheckNewArg(self):
|
def outputCheckNewArg(self):
|
||||||
Output("if (itself == NULL) return Py_None;")
|
Output("if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }")
|
||||||
|
|
||||||
def outputCheckConvertArg(self):
|
def outputCheckConvertArg(self):
|
||||||
Output("if (v == Py_None) { *p_itself = NULL; return 1; }")
|
Output("if (v == Py_None) { *p_itself = NULL; return 1; }")
|
||||||
|
|
|
@ -153,7 +153,7 @@ typedef struct FSCatalogInfoObject {
|
||||||
static PyObject *FSCatalogInfo_New(FSCatalogInfo *itself)
|
static PyObject *FSCatalogInfo_New(FSCatalogInfo *itself)
|
||||||
{
|
{
|
||||||
FSCatalogInfoObject *it;
|
FSCatalogInfoObject *it;
|
||||||
if (itself == NULL) return Py_None;
|
if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }
|
||||||
it = PyObject_NEW(FSCatalogInfoObject, &FSCatalogInfo_Type);
|
it = PyObject_NEW(FSCatalogInfoObject, &FSCatalogInfo_Type);
|
||||||
if (it == NULL) return NULL;
|
if (it == NULL) return NULL;
|
||||||
it->ob_itself = *itself;
|
it->ob_itself = *itself;
|
||||||
|
|
|
@ -475,7 +475,7 @@ class FSCatalogInfoDefinition(PEP253Mixin, ObjectDefinition):
|
||||||
self.argref = "*" # Store FSSpecs, but pass them by address
|
self.argref = "*" # Store FSSpecs, but pass them by address
|
||||||
|
|
||||||
def outputCheckNewArg(self):
|
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):
|
def output_tp_newBody(self):
|
||||||
Output("PyObject *self;");
|
Output("PyObject *self;");
|
||||||
|
|
|
@ -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
|
/* 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
|
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,
|
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* of the returned package is returned in buf, with the length of
|
||||||
the name in *p_buflen.
|
the name in *p_buflen.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue