Re: [Python-checkins] cpython: Fix #14600. Correct reference handling and naming of ImportError convenience

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Python-checkins] cpython: Fix #14600. Correct reference handling and naming of ImportError convenience

Nick Coghlan
On Wed, Apr 18, 2012 at 7:57 AM, brian.curtin
<[hidden email]> wrote:

> diff --git a/Python/errors.c b/Python/errors.c
> --- a/Python/errors.c
> +++ b/Python/errors.c
> @@ -586,50 +586,43 @@
>  #endif /* MS_WINDOWS */
>
>  PyObject *
> -PyErr_SetExcWithArgsKwargs(PyObject *exc, PyObject *args, PyObject *kwargs)
> +PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path)
>  {
> -    PyObject *val;
> +    PyObject *args, *kwargs, *error;
> +
> +    args = PyTuple_New(1);
> +    if (args == NULL)
> +        return NULL;
> +
> +    kwargs = PyDict_New();
> +    if (args == NULL)
> +        return NULL;
> +
> +    if (name == NULL)
> +        name = Py_None;
> +
> +    if (path == NULL)
> +        path = Py_None;

Py_INCREF's?

Regards,
Nick.

--
Nick Coghlan   |   [hidden email]   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%2B1324100855712-1801473%40n6.nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: [Python-checkins] cpython: Fix #14600. Correct reference handling and naming of ImportError convenience

Oleg Broytman
On Wed, Apr 18, 2012 at 09:19:03PM +1000, Nick Coghlan <[hidden email]> wrote:

> On Wed, Apr 18, 2012 at 7:57 AM, brian.curtin
> <[hidden email]> wrote:
> > diff --git a/Python/errors.c b/Python/errors.c
> > --- a/Python/errors.c
> > +++ b/Python/errors.c
> > @@ -586,50 +586,43 @@
> > +  args = PyTuple_New(1);
> > +  if (args == NULL)
> > +    return NULL;
> > +
> > +  kwargs = PyDict_New();
> > +  if (args == NULL)
> > +    return NULL;

   Shouldn't the second test be
if (kwargs == NULL)
   ???

Oleg.
--
     Oleg Broytman            http://phdru.name/            [hidden email]
           Programmers don't die, they just GOSUB without RETURN.
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%2B1324100855712-1801473%40n6.nabble.com