summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2014-03-19 15:38:52 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2014-03-19 15:38:52 (GMT)
commit38d872ee5df1dd89c1ce1e04e7e24ef651d63bc7 (patch)
treea9db03447bf5b874da900128d722be11a7908ab4 /Objects
parent8e5d0caf923ba027f21a2a0953a365bc6174d492 (diff)
downloadcpython-38d872ee5df1dd89c1ce1e04e7e24ef651d63bc7.zip
cpython-38d872ee5df1dd89c1ce1e04e7e24ef651d63bc7.tar.gz
cpython-38d872ee5df1dd89c1ce1e04e7e24ef651d63bc7.tar.bz2
Issue19995: passing a non-int to %o, %c, %x, or %X now raises an exception
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 0cb023d..87cc5c2 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -13987,23 +13987,11 @@ mainformatlong(PyObject *v,
goto wrongtype;
/* make sure number is a type of integer */
- /* if not, issue deprecation warning for now */
if (!PyLong_Check(v)) {
if (type == 'o' || type == 'x' || type == 'X') {
iobj = PyNumber_Index(v);
if (iobj == NULL) {
- PyErr_Clear();
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "automatic int conversions have been deprecated",
- 1)) {
- return -1;
- }
- iobj = PyNumber_Long(v);
- if (iobj == NULL ) {
- if (PyErr_ExceptionMatches(PyExc_TypeError))
- goto wrongtype;
- return -1;
- }
+ return -1;
}
}
else {
@@ -14085,22 +14073,10 @@ formatchar(PyObject *v)
PyObject *iobj;
long x;
/* make sure number is a type of integer */
- /* if not, issue deprecation warning for now */
if (!PyLong_Check(v)) {
iobj = PyNumber_Index(v);
if (iobj == NULL) {
- PyErr_Clear();
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "automatic int conversions have been deprecated",
- 1)) {
- return -1;
- }
- iobj = PyNumber_Long(v);
- if (iobj == NULL ) {
- if (PyErr_ExceptionMatches(PyExc_TypeError))
- goto onError;
- return -1;
- }
+ goto onError;
}
v = iobj;
Py_DECREF(iobj);