Mark Dickinson dicki...@gmail.com added the comment:
Looks good to me.
I'd prefer 'test_long_as_size' to be called 'test_long_as_size_t' (even though
that's inaccurate for the ssize_t bits :-).
The 'Py_None' reference counting in test_long_as_size and test_long_as_double
looked a little odd
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 4a66a35da3fd by Nadeem Vawda in branch 'default':
Issue #12909: Make PyLong_As* functions consistent in their use of exceptions.
http://hg.python.org/cpython/rev/4a66a35da3fd
--
nosy: +python-dev
Nadeem Vawda nadeem.va...@gmail.com added the comment:
The 'Py_None' reference counting in test_long_as_size and
test_long_as_double looked a little odd at first glance
Indeed, it is rather roundabout, so I added a comment to avoid confusion.
Anyway, those are just nitpicks; I leave it to
Changes by Nadeem Vawda nadeem.va...@gmail.com:
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12909
___
Raymond Hettinger raymond.hettin...@gmail.com added the comment:
+1
--
assignee: nadeem.vawda - rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12909
___
New submission from Nadeem Vawda nadeem.va...@gmail.com:
The C functions for converting a Python 'int' object to a C integer are
inconsistent about what exception gets raised when the object passed to
them is not an integer. Most of these functions raise a TypeError, but
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +mark.dickinson, rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12909
___
___
Mark Dickinson dicki...@gmail.com added the comment:
+1 for turning these into TypeErrors. It makes little sense that
PyLong_AsLongLong and PyLong_AsUnsignedLongLong behave differently here.
Do you have a patch handy?
--
___
Python tracker
Nadeem Vawda nadeem.va...@gmail.com added the comment:
Do you have a patch handy?
See attached.
--
keywords: +patch
Added file: http://bugs.python.org/file23106/pylong-exceptions.diff
___
Python tracker rep...@bugs.python.org
Nadeem Vawda nadeem.va...@gmail.com added the comment:
This probably shouldn't be backported to 3.2; it could break 3rd-party
extension modules (though I would hope that nothing depends on this
behaviour...).
Also, it's worth noting that the error handling between conversion
functions still
Mark Dickinson dicki...@gmail.com added the comment:
This probably shouldn't be backported to 3.2
Agreed; I don't see this as a bugfix (especially since AFAIK it's not
documented that TypeError should be raised here); rather, as a design
improvement.
Also, it's worth noting that the
Mark Dickinson dicki...@gmail.com added the comment:
The patch still needs tests (e.g., in test_capi). I'm not sure whether it
would be good to add information about the TypeError to the docs.
--
___
Python tracker rep...@bugs.python.org
Nadeem Vawda nadeem.va...@gmail.com added the comment:
Attached is an updated patch with tests.
There don't seem to be any tests for PyLong_AsS[s]ize_t() and
PyLong_AsDouble(), so I added new ones for this issue. They should still
be expanded on at some point in the future, but for the
13 matches
Mail list logo