bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)

Only __index__ should be used to make integer conversions lossless.
This commit is contained in:
Serhiy Storchaka 2020-05-26 18:43:38 +03:00 committed by GitHub
parent 8ad052464a
commit 578c3955e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
87 changed files with 226 additions and 2937 deletions

View File

@ -75,6 +75,12 @@ New Features
Other Language Changes Other Language Changes
====================== ======================
* Builtin and extension functions that take integer arguments no longer accept
:class:`~decimal.Decimal`\ s, :class:`~fractions.Fraction`\ s and other
objects that can be converted to integers only with a loss (e.g. that have
the :meth:`~object.__int__` method but do not have the
:meth:`~object.__index__` method).
(Contributed by Serhiy Storchaka in :issue:`37999`.)
New Modules New Modules

View File

@ -173,23 +173,6 @@ PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
unsigned char* bytes, size_t n, unsigned char* bytes, size_t n,
int little_endian, int is_signed); int little_endian, int is_signed);
/* _PyLong_FromNbInt: Convert the given object to a PyLongObject
using the nb_int slot, if available. Raise TypeError if either the
nb_int slot is not available or the result of the call to nb_int
returns something not of type int.
*/
PyAPI_FUNC(PyObject *) _PyLong_FromNbInt(PyObject *);
/* Convert the given object to a PyLongObject using the nb_index or
nb_int slots, if available (the latter is deprecated).
Raise TypeError if either nb_index and nb_int slots are not
available or the result of the call to nb_index or nb_int
returns something not of type int.
Should be replaced with PyNumber_Index after the end of the
deprecation period.
*/
PyAPI_FUNC(PyObject *) _PyLong_FromNbIndexOrNbInt(PyObject *);
/* _PyLong_Format: Convert the long to a string object with given base, /* _PyLong_Format: Convert the long to a string object with given base,
appending a base prefix of 0[box] if base is 2, 8 or 16. */ appending a base prefix of 0[box] if base is 2, 8 or 16. */
PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *obj, int base); PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *obj, int base);

View File

@ -134,8 +134,7 @@ class NumberTestCase(unittest.TestCase):
for t in signed_types + unsigned_types: for t in signed_types + unsigned_types:
self.assertRaises(TypeError, t, 3.14) self.assertRaises(TypeError, t, 3.14)
self.assertRaises(TypeError, t, f) self.assertRaises(TypeError, t, f)
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, t, d)
self.assertEqual(t(d).value, 2)
self.assertEqual(t(i).value, 2) self.assertEqual(t(i).value, 2)
def test_sizes(self): def test_sizes(self):

View File

@ -11,6 +11,7 @@ __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo",
import time as _time import time as _time
import math as _math import math as _math
import sys import sys
from operator import index as _index
def _cmp(x, y): def _cmp(x, y):
return 0 if x == y else 1 if x > y else -1 return 0 if x == y else 1 if x > y else -1
@ -380,42 +381,10 @@ def _check_utc_offset(name, offset):
"-timedelta(hours=24) and timedelta(hours=24)" % "-timedelta(hours=24) and timedelta(hours=24)" %
(name, offset)) (name, offset))
def _check_int_field(value):
if isinstance(value, int):
return value
if isinstance(value, float):
raise TypeError('integer argument expected, got float')
try:
value = value.__index__()
except AttributeError:
pass
else:
if not isinstance(value, int):
raise TypeError('__index__ returned non-int (type %s)' %
type(value).__name__)
return value
orig = value
try:
value = value.__int__()
except AttributeError:
pass
else:
if not isinstance(value, int):
raise TypeError('__int__ returned non-int (type %s)' %
type(value).__name__)
import warnings
warnings.warn("an integer is required (got type %s)" %
type(orig).__name__,
DeprecationWarning,
stacklevel=2)
return value
raise TypeError('an integer is required (got type %s)' %
type(value).__name__)
def _check_date_fields(year, month, day): def _check_date_fields(year, month, day):
year = _check_int_field(year) year = _index(year)
month = _check_int_field(month) month = _index(month)
day = _check_int_field(day) day = _index(day)
if not MINYEAR <= year <= MAXYEAR: if not MINYEAR <= year <= MAXYEAR:
raise ValueError('year must be in %d..%d' % (MINYEAR, MAXYEAR), year) raise ValueError('year must be in %d..%d' % (MINYEAR, MAXYEAR), year)
if not 1 <= month <= 12: if not 1 <= month <= 12:
@ -426,10 +395,10 @@ def _check_date_fields(year, month, day):
return year, month, day return year, month, day
def _check_time_fields(hour, minute, second, microsecond, fold): def _check_time_fields(hour, minute, second, microsecond, fold):
hour = _check_int_field(hour) hour = _index(hour)
minute = _check_int_field(minute) minute = _index(minute)
second = _check_int_field(second) second = _index(second)
microsecond = _check_int_field(microsecond) microsecond = _index(microsecond)
if not 0 <= hour <= 23: if not 0 <= hour <= 23:
raise ValueError('hour must be in 0..23', hour) raise ValueError('hour must be in 0..23', hour)
if not 0 <= minute <= 59: if not 0 <= minute <= 59:
@ -2539,10 +2508,10 @@ else:
# Clean up unused names # Clean up unused names
del (_DAYNAMES, _DAYS_BEFORE_MONTH, _DAYS_IN_MONTH, _DI100Y, _DI400Y, del (_DAYNAMES, _DAYS_BEFORE_MONTH, _DAYS_IN_MONTH, _DI100Y, _DI400Y,
_DI4Y, _EPOCH, _MAXORDINAL, _MONTHNAMES, _build_struct_time, _DI4Y, _EPOCH, _MAXORDINAL, _MONTHNAMES, _build_struct_time,
_check_date_fields, _check_int_field, _check_time_fields, _check_date_fields, _check_time_fields,
_check_tzinfo_arg, _check_tzname, _check_utc_offset, _cmp, _cmperror, _check_tzinfo_arg, _check_tzname, _check_utc_offset, _cmp, _cmperror,
_date_class, _days_before_month, _days_before_year, _days_in_month, _date_class, _days_before_month, _days_before_year, _days_in_month,
_format_time, _format_offset, _is_leap, _isoweek1monday, _math, _format_time, _format_offset, _index, _is_leap, _isoweek1monday, _math,
_ord2ymd, _time, _time_class, _tzinfo_class, _wrap_strftime, _ymd2ord, _ord2ymd, _time, _time_class, _tzinfo_class, _wrap_strftime, _ymd2ord,
_divide_and_round, _parse_isoformat_date, _parse_isoformat_time, _divide_and_round, _parse_isoformat_date, _parse_isoformat_time,
_parse_hh_mm_ss_ff, _IsoCalendarDate) _parse_hh_mm_ss_ff, _IsoCalendarDate)

View File

@ -418,11 +418,6 @@ test_bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
c = _PyLong_AsInt(args[2]); c = _PyLong_AsInt(args[2]);
if (c == -1 && PyErr_Occurred()) { if (c == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -436,7 +431,7 @@ exit:
static PyObject * static PyObject *
test_bool_converter_impl(PyObject *module, int a, int b, int c) test_bool_converter_impl(PyObject *module, int a, int b, int c)
/*[clinic end generated code: output=25f20963894256a1 input=939854fa9f248c60]*/ /*[clinic end generated code: output=b5ec6409d942e0f9 input=939854fa9f248c60]*/
/*[clinic input] /*[clinic input]
@ -729,11 +724,6 @@ test_unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[0]); long ival = PyLong_AsLong(args[0]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -756,11 +746,6 @@ test_unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[1]); long ival = PyLong_AsLong(args[1]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -783,14 +768,9 @@ test_unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsUnsignedLongMask(args[2]); unsigned long ival = PyLong_AsUnsignedLongMask(args[2]);
if (ival == -1 && PyErr_Occurred()) { if (ival == (unsigned long)-1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
else { else {
@ -807,7 +787,7 @@ exit:
static PyObject * static PyObject *
test_unsigned_char_converter_impl(PyObject *module, unsigned char a, test_unsigned_char_converter_impl(PyObject *module, unsigned char a,
unsigned char b, unsigned char c) unsigned char b, unsigned char c)
/*[clinic end generated code: output=ebf905c5c9414762 input=021414060993e289]*/ /*[clinic end generated code: output=c0a6ab3144481466 input=021414060993e289]*/
/*[clinic input] /*[clinic input]
@ -841,11 +821,6 @@ test_short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[0]); long ival = PyLong_AsLong(args[0]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -874,7 +849,7 @@ exit:
static PyObject * static PyObject *
test_short_converter_impl(PyObject *module, short a) test_short_converter_impl(PyObject *module, short a)
/*[clinic end generated code: output=86fe1a1496a7ff20 input=6a8a7a509a498ff4]*/ /*[clinic end generated code: output=3ccda4bd08b6e4b4 input=6a8a7a509a498ff4]*/
/*[clinic input] /*[clinic input]
@ -925,11 +900,6 @@ test_unsigned_short_converter(PyObject *module, PyObject *const *args, Py_ssize_
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
c = (unsigned short)PyLong_AsUnsignedLongMask(args[2]); c = (unsigned short)PyLong_AsUnsignedLongMask(args[2]);
if (c == (unsigned short)-1 && PyErr_Occurred()) { if (c == (unsigned short)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -944,7 +914,7 @@ exit:
static PyObject * static PyObject *
test_unsigned_short_converter_impl(PyObject *module, unsigned short a, test_unsigned_short_converter_impl(PyObject *module, unsigned short a,
unsigned short b, unsigned short c) unsigned short b, unsigned short c)
/*[clinic end generated code: output=3779fe104319e3ae input=cdfd8eff3d9176b4]*/ /*[clinic end generated code: output=576b5ce48424f351 input=cdfd8eff3d9176b4]*/
/*[clinic input] /*[clinic input]
@ -984,11 +954,6 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
a = _PyLong_AsInt(args[0]); a = _PyLong_AsInt(args[0]);
if (a == -1 && PyErr_Occurred()) { if (a == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -996,11 +961,6 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
b = _PyLong_AsInt(args[1]); b = _PyLong_AsInt(args[1]);
if (b == -1 && PyErr_Occurred()) { if (b == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1023,11 +983,6 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
d = _PyLong_AsInt(args[3]); d = _PyLong_AsInt(args[3]);
if (d == -1 && PyErr_Occurred()) { if (d == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1041,7 +996,7 @@ exit:
static PyObject * static PyObject *
test_int_converter_impl(PyObject *module, int a, int b, int c, myenum d) test_int_converter_impl(PyObject *module, int a, int b, int c, myenum d)
/*[clinic end generated code: output=10a2e48a34af5d7a input=d20541fc1ca0553e]*/ /*[clinic end generated code: output=8a1a7b02ebe9eeac input=d20541fc1ca0553e]*/
/*[clinic input] /*[clinic input]
@ -1092,11 +1047,6 @@ test_unsigned_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
c = (unsigned int)PyLong_AsUnsignedLongMask(args[2]); c = (unsigned int)PyLong_AsUnsignedLongMask(args[2]);
if (c == (unsigned int)-1 && PyErr_Occurred()) { if (c == (unsigned int)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1111,7 +1061,7 @@ exit:
static PyObject * static PyObject *
test_unsigned_int_converter_impl(PyObject *module, unsigned int a, test_unsigned_int_converter_impl(PyObject *module, unsigned int a,
unsigned int b, unsigned int c) unsigned int b, unsigned int c)
/*[clinic end generated code: output=189176ce67c7d2e7 input=5533534828b62fc0]*/ /*[clinic end generated code: output=4f53904bfa1a0250 input=5533534828b62fc0]*/
/*[clinic input] /*[clinic input]
@ -1145,11 +1095,6 @@ test_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
a = PyLong_AsLong(args[0]); a = PyLong_AsLong(args[0]);
if (a == -1 && PyErr_Occurred()) { if (a == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1163,7 +1108,7 @@ exit:
static PyObject * static PyObject *
test_long_converter_impl(PyObject *module, long a) test_long_converter_impl(PyObject *module, long a)
/*[clinic end generated code: output=44cd8823f59d116b input=d2179e3c9cdcde89]*/ /*[clinic end generated code: output=e5e7883fddcf4218 input=d2179e3c9cdcde89]*/
/*[clinic input] /*[clinic input]
@ -1263,11 +1208,6 @@ test_long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
a = PyLong_AsLongLong(args[0]); a = PyLong_AsLongLong(args[0]);
if (a == -1 && PyErr_Occurred()) { if (a == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1281,7 +1221,7 @@ exit:
static PyObject * static PyObject *
test_long_long_converter_impl(PyObject *module, long long a) test_long_long_converter_impl(PyObject *module, long long a)
/*[clinic end generated code: output=7143b585d7e433e8 input=d5fc81577ff4dd02]*/ /*[clinic end generated code: output=0488ac9e8c1d77bb input=d5fc81577ff4dd02]*/
/*[clinic input] /*[clinic input]
@ -1390,11 +1330,6 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -1410,11 +1345,6 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -1443,7 +1373,7 @@ exit:
static PyObject * static PyObject *
test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b, test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
Py_ssize_t c) Py_ssize_t c)
/*[clinic end generated code: output=a46d2aaf40c10398 input=3855f184bb3f299d]*/ /*[clinic end generated code: output=ea781bb7169b3436 input=3855f184bb3f299d]*/
/*[clinic input] /*[clinic input]

View File

@ -5107,43 +5107,21 @@ class Oddballs(unittest.TestCase):
def __int__(self): def __int__(self):
return self.value return self.value
for xx in [decimal.Decimal(10),
decimal.Decimal('10.9'),
Number(10)]:
with self.assertWarns(DeprecationWarning):
self.assertEqual(datetime(10, 10, 10, 10, 10, 10, 10),
datetime(xx, xx, xx, xx, xx, xx, xx))
with self.assertRaisesRegex(TypeError, '^an integer is required '
r'\(got type str\)$'):
datetime(10, 10, '10')
f10 = Number(10.9)
with self.assertRaisesRegex(TypeError, '^__int__ returned non-int '
r'\(type float\)$'):
datetime(10, 10, f10)
class Float(float): class Float(float):
pass pass
s10 = Float(10.9)
with self.assertRaisesRegex(TypeError, '^integer argument expected, '
'got float$'):
datetime(10, 10, s10)
with self.assertRaises(TypeError): for xx in [10.0, Float(10.9),
datetime(10., 10, 10) decimal.Decimal(10), decimal.Decimal('10.9'),
with self.assertRaises(TypeError): Number(10), Number(10.9),
datetime(10, 10., 10) '10']:
with self.assertRaises(TypeError): self.assertRaises(TypeError, datetime, xx, 10, 10, 10, 10, 10, 10)
datetime(10, 10, 10.) self.assertRaises(TypeError, datetime, 10, xx, 10, 10, 10, 10, 10)
with self.assertRaises(TypeError): self.assertRaises(TypeError, datetime, 10, 10, xx, 10, 10, 10, 10)
datetime(10, 10, 10, 10.) self.assertRaises(TypeError, datetime, 10, 10, 10, xx, 10, 10, 10)
with self.assertRaises(TypeError): self.assertRaises(TypeError, datetime, 10, 10, 10, 10, xx, 10, 10)
datetime(10, 10, 10, 10, 10.) self.assertRaises(TypeError, datetime, 10, 10, 10, 10, 10, xx, 10)
with self.assertRaises(TypeError): self.assertRaises(TypeError, datetime, 10, 10, 10, 10, 10, 10, xx)
datetime(10, 10, 10, 10, 10, 10.)
with self.assertRaises(TypeError):
datetime(10, 10, 10, 10, 10, 10, 10.)
############################################################################# #############################################################################
# Local Time Disambiguation # Local Time Disambiguation

View File

@ -161,12 +161,10 @@ class Unsigned_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning): with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_b(BadIndex2())) self.assertEqual(1, getargs_b(BadIndex2()))
self.assertEqual(0, getargs_b(BadIndex3())) self.assertEqual(0, getargs_b(BadIndex3()))
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_b, Int())
self.assertEqual(99, getargs_b(Int()))
self.assertEqual(0, getargs_b(IntSubclass())) self.assertEqual(0, getargs_b(IntSubclass()))
self.assertRaises(TypeError, getargs_b, BadInt()) self.assertRaises(TypeError, getargs_b, BadInt())
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_b, BadInt2())
self.assertEqual(1, getargs_b(BadInt2()))
self.assertEqual(0, getargs_b(BadInt3())) self.assertEqual(0, getargs_b(BadInt3()))
self.assertRaises(OverflowError, getargs_b, -1) self.assertRaises(OverflowError, getargs_b, -1)
@ -187,12 +185,10 @@ class Unsigned_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning): with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_B(BadIndex2())) self.assertEqual(1, getargs_B(BadIndex2()))
self.assertEqual(0, getargs_B(BadIndex3())) self.assertEqual(0, getargs_B(BadIndex3()))
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_B, Int())
self.assertEqual(99, getargs_B(Int()))
self.assertEqual(0, getargs_B(IntSubclass())) self.assertEqual(0, getargs_B(IntSubclass()))
self.assertRaises(TypeError, getargs_B, BadInt()) self.assertRaises(TypeError, getargs_B, BadInt())
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_B, BadInt2())
self.assertEqual(1, getargs_B(BadInt2()))
self.assertEqual(0, getargs_B(BadInt3())) self.assertEqual(0, getargs_B(BadInt3()))
self.assertEqual(UCHAR_MAX, getargs_B(-1)) self.assertEqual(UCHAR_MAX, getargs_B(-1))
@ -213,12 +209,10 @@ class Unsigned_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning): with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_H(BadIndex2())) self.assertEqual(1, getargs_H(BadIndex2()))
self.assertEqual(0, getargs_H(BadIndex3())) self.assertEqual(0, getargs_H(BadIndex3()))
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_H, Int())
self.assertEqual(99, getargs_H(Int()))
self.assertEqual(0, getargs_H(IntSubclass())) self.assertEqual(0, getargs_H(IntSubclass()))
self.assertRaises(TypeError, getargs_H, BadInt()) self.assertRaises(TypeError, getargs_H, BadInt())
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_H, BadInt2())
self.assertEqual(1, getargs_H(BadInt2()))
self.assertEqual(0, getargs_H(BadInt3())) self.assertEqual(0, getargs_H(BadInt3()))
self.assertEqual(USHRT_MAX, getargs_H(-1)) self.assertEqual(USHRT_MAX, getargs_H(-1))
@ -240,12 +234,10 @@ class Unsigned_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning): with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_I(BadIndex2())) self.assertEqual(1, getargs_I(BadIndex2()))
self.assertEqual(0, getargs_I(BadIndex3())) self.assertEqual(0, getargs_I(BadIndex3()))
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_I, Int())
self.assertEqual(99, getargs_I(Int()))
self.assertEqual(0, getargs_I(IntSubclass())) self.assertEqual(0, getargs_I(IntSubclass()))
self.assertRaises(TypeError, getargs_I, BadInt()) self.assertRaises(TypeError, getargs_I, BadInt())
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_I, BadInt2())
self.assertEqual(1, getargs_I(BadInt2()))
self.assertEqual(0, getargs_I(BadInt3())) self.assertEqual(0, getargs_I(BadInt3()))
self.assertEqual(UINT_MAX, getargs_I(-1)) self.assertEqual(UINT_MAX, getargs_I(-1))
@ -293,12 +285,10 @@ class Signed_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning): with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_h(BadIndex2())) self.assertEqual(1, getargs_h(BadIndex2()))
self.assertEqual(0, getargs_h(BadIndex3())) self.assertEqual(0, getargs_h(BadIndex3()))
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_h, Int())
self.assertEqual(99, getargs_h(Int()))
self.assertEqual(0, getargs_h(IntSubclass())) self.assertEqual(0, getargs_h(IntSubclass()))
self.assertRaises(TypeError, getargs_h, BadInt()) self.assertRaises(TypeError, getargs_h, BadInt())
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_h, BadInt2())
self.assertEqual(1, getargs_h(BadInt2()))
self.assertEqual(0, getargs_h(BadInt3())) self.assertEqual(0, getargs_h(BadInt3()))
self.assertRaises(OverflowError, getargs_h, SHRT_MIN-1) self.assertRaises(OverflowError, getargs_h, SHRT_MIN-1)
@ -319,12 +309,10 @@ class Signed_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning): with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_i(BadIndex2())) self.assertEqual(1, getargs_i(BadIndex2()))
self.assertEqual(0, getargs_i(BadIndex3())) self.assertEqual(0, getargs_i(BadIndex3()))
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_i, Int())
self.assertEqual(99, getargs_i(Int()))
self.assertEqual(0, getargs_i(IntSubclass())) self.assertEqual(0, getargs_i(IntSubclass()))
self.assertRaises(TypeError, getargs_i, BadInt()) self.assertRaises(TypeError, getargs_i, BadInt())
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_i, BadInt2())
self.assertEqual(1, getargs_i(BadInt2()))
self.assertEqual(0, getargs_i(BadInt3())) self.assertEqual(0, getargs_i(BadInt3()))
self.assertRaises(OverflowError, getargs_i, INT_MIN-1) self.assertRaises(OverflowError, getargs_i, INT_MIN-1)
@ -345,12 +333,10 @@ class Signed_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning): with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_l(BadIndex2())) self.assertEqual(1, getargs_l(BadIndex2()))
self.assertEqual(0, getargs_l(BadIndex3())) self.assertEqual(0, getargs_l(BadIndex3()))
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_l, Int())
self.assertEqual(99, getargs_l(Int()))
self.assertEqual(0, getargs_l(IntSubclass())) self.assertEqual(0, getargs_l(IntSubclass()))
self.assertRaises(TypeError, getargs_l, BadInt()) self.assertRaises(TypeError, getargs_l, BadInt())
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_l, BadInt2())
self.assertEqual(1, getargs_l(BadInt2()))
self.assertEqual(0, getargs_l(BadInt3())) self.assertEqual(0, getargs_l(BadInt3()))
self.assertRaises(OverflowError, getargs_l, LONG_MIN-1) self.assertRaises(OverflowError, getargs_l, LONG_MIN-1)
@ -400,12 +386,10 @@ class LongLong_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning): with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_L(BadIndex2())) self.assertEqual(1, getargs_L(BadIndex2()))
self.assertEqual(0, getargs_L(BadIndex3())) self.assertEqual(0, getargs_L(BadIndex3()))
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_L, Int())
self.assertEqual(99, getargs_L(Int()))
self.assertEqual(0, getargs_L(IntSubclass())) self.assertEqual(0, getargs_L(IntSubclass()))
self.assertRaises(TypeError, getargs_L, BadInt()) self.assertRaises(TypeError, getargs_L, BadInt())
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, getargs_L, BadInt2())
self.assertEqual(1, getargs_L(BadInt2()))
self.assertEqual(0, getargs_L(BadInt3())) self.assertEqual(0, getargs_L(BadInt3()))
self.assertRaises(OverflowError, getargs_L, LLONG_MIN-1) self.assertRaises(OverflowError, getargs_L, LLONG_MIN-1)

View File

@ -100,8 +100,8 @@ class GroupDatabaseTestCase(unittest.TestCase):
self.skipTest('no groups') self.skipTest('no groups')
# Choose an existent gid. # Choose an existent gid.
gid = entries[0][2] gid = entries[0][2]
self.assertWarns(DeprecationWarning, grp.getgrgid, float(gid)) self.assertRaises(TypeError, grp.getgrgid, float(gid))
self.assertWarns(DeprecationWarning, grp.getgrgid, str(gid)) self.assertRaises(TypeError, grp.getgrgid, str(gid))
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -517,10 +517,7 @@ class IntTestCases(unittest.TestCase):
self.assertIs(type(n), int) self.assertIs(type(n), int)
bad_int = TruncReturnsBadInt() bad_int = TruncReturnsBadInt()
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, int, bad_int)
n = int(bad_int)
self.assertEqual(n, 1)
self.assertIs(type(n), int)
good_int = TruncReturnsIntSubclass() good_int = TruncReturnsIntSubclass()
n = int(good_int) n = int(good_int)

View File

@ -502,14 +502,10 @@ class MathTests(unittest.TestCase):
self.assertRaises(ValueError, math.factorial, -10**100) self.assertRaises(ValueError, math.factorial, -10**100)
def testFactorialNonIntegers(self): def testFactorialNonIntegers(self):
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, math.factorial, 5.0)
self.assertEqual(math.factorial(5.0), 120) self.assertRaises(TypeError, math.factorial, 5.2)
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, math.factorial, -1.0)
self.assertRaises(ValueError, math.factorial, 5.2) self.assertRaises(TypeError, math.factorial, -1e100)
with self.assertWarns(DeprecationWarning):
self.assertRaises(ValueError, math.factorial, -1.0)
with self.assertWarns(DeprecationWarning):
self.assertRaises(ValueError, math.factorial, -1e100)
self.assertRaises(TypeError, math.factorial, decimal.Decimal('5')) self.assertRaises(TypeError, math.factorial, decimal.Decimal('5'))
self.assertRaises(TypeError, math.factorial, decimal.Decimal('5.2')) self.assertRaises(TypeError, math.factorial, decimal.Decimal('5.2'))
self.assertRaises(TypeError, math.factorial, "5") self.assertRaises(TypeError, math.factorial, "5")
@ -520,8 +516,7 @@ class MathTests(unittest.TestCase):
# Currently raises OverflowError for inputs that are too large # Currently raises OverflowError for inputs that are too large
# to fit into a C long. # to fit into a C long.
self.assertRaises(OverflowError, math.factorial, 10**100) self.assertRaises(OverflowError, math.factorial, 10**100)
with self.assertWarns(DeprecationWarning): self.assertRaises(TypeError, math.factorial, 1e100)
self.assertRaises(OverflowError, math.factorial, 1e100)
def testFloor(self): def testFloor(self):
self.assertRaises(TypeError, math.floor) self.assertRaises(TypeError, math.floor)

View File

@ -917,10 +917,8 @@ class GeneralModuleTests(unittest.TestCase):
self.assertIn('not NoneType', str(cm.exception)) self.assertIn('not NoneType', str(cm.exception))
with self.assertRaises(TypeError) as cm: with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', 'bar', sockname) s.sendto(b'foo', 'bar', sockname)
self.assertIn('an integer is required', str(cm.exception))
with self.assertRaises(TypeError) as cm: with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', None, None) s.sendto(b'foo', None, None)
self.assertIn('an integer is required', str(cm.exception))
# wrong number of args # wrong number of args
with self.assertRaises(TypeError) as cm: with self.assertRaises(TypeError) as cm:
s.sendto(b'foo') s.sendto(b'foo')
@ -1899,11 +1897,11 @@ class GeneralModuleTests(unittest.TestCase):
socket.SOCK_STREAM) socket.SOCK_STREAM)
def test_socket_fileno_rejects_float(self): def test_socket_fileno_rejects_float(self):
with self.assertRaisesRegex(TypeError, "integer argument expected"): with self.assertRaises(TypeError):
socket.socket(socket.AF_INET, socket.SOCK_STREAM, fileno=42.5) socket.socket(socket.AF_INET, socket.SOCK_STREAM, fileno=42.5)
def test_socket_fileno_rejects_other_types(self): def test_socket_fileno_rejects_other_types(self):
with self.assertRaisesRegex(TypeError, "integer is required"): with self.assertRaises(TypeError):
socket.socket(socket.AF_INET, socket.SOCK_STREAM, fileno="foo") socket.socket(socket.AF_INET, socket.SOCK_STREAM, fileno="foo")
def test_socket_fileno_rejects_invalid_socket(self): def test_socket_fileno_rejects_invalid_socket(self):

View File

@ -0,0 +1,5 @@
Builtin and extension functions that take integer arguments no longer accept
:class:`~decimal.Decimal`\ s, :class:`~fractions.Fraction`\ s and other
objects that can be converted to integers only with a loss (e.g. that have
the :meth:`~object.__int__` method but do not have the
:meth:`~object.__index__` method).

View File

@ -56,11 +56,6 @@ skip_optional_posonly:
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
if (fastargs[1]) { if (fastargs[1]) {
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
digest_size = _PyLong_AsInt(fastargs[1]); digest_size = _PyLong_AsInt(fastargs[1]);
if (digest_size == -1 && PyErr_Occurred()) { if (digest_size == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -106,11 +101,6 @@ skip_optional_posonly:
} }
} }
if (fastargs[5]) { if (fastargs[5]) {
if (PyFloat_Check(fastargs[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fanout = _PyLong_AsInt(fastargs[5]); fanout = _PyLong_AsInt(fastargs[5]);
if (fanout == -1 && PyErr_Occurred()) { if (fanout == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -120,11 +110,6 @@ skip_optional_posonly:
} }
} }
if (fastargs[6]) { if (fastargs[6]) {
if (PyFloat_Check(fastargs[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
depth = _PyLong_AsInt(fastargs[6]); depth = _PyLong_AsInt(fastargs[6]);
if (depth == -1 && PyErr_Occurred()) { if (depth == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -150,11 +135,6 @@ skip_optional_posonly:
} }
} }
if (fastargs[9]) { if (fastargs[9]) {
if (PyFloat_Check(fastargs[9])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
node_depth = _PyLong_AsInt(fastargs[9]); node_depth = _PyLong_AsInt(fastargs[9]);
if (node_depth == -1 && PyErr_Occurred()) { if (node_depth == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -164,11 +144,6 @@ skip_optional_posonly:
} }
} }
if (fastargs[10]) { if (fastargs[10]) {
if (PyFloat_Check(fastargs[10])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
inner_size = _PyLong_AsInt(fastargs[10]); inner_size = _PyLong_AsInt(fastargs[10]);
if (inner_size == -1 && PyErr_Occurred()) { if (inner_size == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -272,4 +247,4 @@ _blake2_blake2b_hexdigest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored))
{ {
return _blake2_blake2b_hexdigest_impl(self); return _blake2_blake2b_hexdigest_impl(self);
} }
/*[clinic end generated code: output=2d6d0fe9aa42a42a input=a9049054013a1b77]*/ /*[clinic end generated code: output=10eb47aba77f192d input=a9049054013a1b77]*/

View File

@ -56,11 +56,6 @@ skip_optional_posonly:
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
if (fastargs[1]) { if (fastargs[1]) {
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
digest_size = _PyLong_AsInt(fastargs[1]); digest_size = _PyLong_AsInt(fastargs[1]);
if (digest_size == -1 && PyErr_Occurred()) { if (digest_size == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -106,11 +101,6 @@ skip_optional_posonly:
} }
} }
if (fastargs[5]) { if (fastargs[5]) {
if (PyFloat_Check(fastargs[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fanout = _PyLong_AsInt(fastargs[5]); fanout = _PyLong_AsInt(fastargs[5]);
if (fanout == -1 && PyErr_Occurred()) { if (fanout == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -120,11 +110,6 @@ skip_optional_posonly:
} }
} }
if (fastargs[6]) { if (fastargs[6]) {
if (PyFloat_Check(fastargs[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
depth = _PyLong_AsInt(fastargs[6]); depth = _PyLong_AsInt(fastargs[6]);
if (depth == -1 && PyErr_Occurred()) { if (depth == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -150,11 +135,6 @@ skip_optional_posonly:
} }
} }
if (fastargs[9]) { if (fastargs[9]) {
if (PyFloat_Check(fastargs[9])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
node_depth = _PyLong_AsInt(fastargs[9]); node_depth = _PyLong_AsInt(fastargs[9]);
if (node_depth == -1 && PyErr_Occurred()) { if (node_depth == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -164,11 +144,6 @@ skip_optional_posonly:
} }
} }
if (fastargs[10]) { if (fastargs[10]) {
if (PyFloat_Check(fastargs[10])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
inner_size = _PyLong_AsInt(fastargs[10]); inner_size = _PyLong_AsInt(fastargs[10]);
if (inner_size == -1 && PyErr_Occurred()) { if (inner_size == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -272,4 +247,4 @@ _blake2_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
{ {
return _blake2_blake2s_hexdigest_impl(self); return _blake2_blake2s_hexdigest_impl(self);
} }
/*[clinic end generated code: output=c80d8d06ce40a192 input=a9049054013a1b77]*/ /*[clinic end generated code: output=f7ee8092ed67e9c7 input=a9049054013a1b77]*/

View File

@ -354,14 +354,7 @@ PyTypeObject PyCField_Type = {
static int static int
get_long(PyObject *v, long *p) get_long(PyObject *v, long *p)
{ {
long x; long x = PyLong_AsUnsignedLongMask(v);
if (PyFloat_Check(v)) {
PyErr_SetString(PyExc_TypeError,
"int expected instead of float");
return -1;
}
x = PyLong_AsUnsignedLongMask(v);
if (x == -1 && PyErr_Occurred()) if (x == -1 && PyErr_Occurred())
return -1; return -1;
*p = x; *p = x;
@ -373,14 +366,7 @@ get_long(PyObject *v, long *p)
static int static int
get_ulong(PyObject *v, unsigned long *p) get_ulong(PyObject *v, unsigned long *p)
{ {
unsigned long x; unsigned long x = PyLong_AsUnsignedLongMask(v);
if (PyFloat_Check(v)) {
PyErr_SetString(PyExc_TypeError,
"int expected instead of float");
return -1;
}
x = PyLong_AsUnsignedLongMask(v);
if (x == (unsigned long)-1 && PyErr_Occurred()) if (x == (unsigned long)-1 && PyErr_Occurred())
return -1; return -1;
*p = x; *p = x;
@ -392,13 +378,7 @@ get_ulong(PyObject *v, unsigned long *p)
static int static int
get_longlong(PyObject *v, long long *p) get_longlong(PyObject *v, long long *p)
{ {
long long x; long long x = PyLong_AsUnsignedLongLongMask(v);
if (PyFloat_Check(v)) {
PyErr_SetString(PyExc_TypeError,
"int expected instead of float");
return -1;
}
x = PyLong_AsUnsignedLongLongMask(v);
if (x == -1 && PyErr_Occurred()) if (x == -1 && PyErr_Occurred())
return -1; return -1;
*p = x; *p = x;
@ -410,13 +390,7 @@ get_longlong(PyObject *v, long long *p)
static int static int
get_ulonglong(PyObject *v, unsigned long long *p) get_ulonglong(PyObject *v, unsigned long long *p)
{ {
unsigned long long x; unsigned long long x = PyLong_AsUnsignedLongLongMask(v);
if (PyFloat_Check(v)) {
PyErr_SetString(PyExc_TypeError,
"int expected instead of float");
return -1;
}
x = PyLong_AsUnsignedLongLongMask(v);
if (x == (unsigned long long)-1 && PyErr_Occurred()) if (x == (unsigned long long)-1 && PyErr_Occurred())
return -1; return -1;
*p = x; *p = x;

View File

@ -178,11 +178,6 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
} }
} }
if (args[2]) { if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
buffering = _PyLong_AsInt(args[2]); buffering = _PyLong_AsInt(args[2]);
if (buffering == -1 && PyErr_Occurred()) { if (buffering == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -261,11 +256,6 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
} }
} }
if (args[6]) { if (args[6]) {
if (PyFloat_Check(args[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
closefd = _PyLong_AsInt(args[6]); closefd = _PyLong_AsInt(args[6]);
if (closefd == -1 && PyErr_Occurred()) { if (closefd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -323,4 +313,4 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=3df6bc6d91697545 input=a9049054013a1b77]*/ /*[clinic end generated code: output=5c0dd7a262c30ebc input=a9049054013a1b77]*/

View File

@ -120,11 +120,6 @@ _io__Buffered_peek(buffered *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -200,11 +195,6 @@ _io__Buffered_read1(buffered *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -356,11 +346,6 @@ _io__Buffered_seek(buffered *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
whence = _PyLong_AsInt(args[1]); whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) { if (whence == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -434,11 +419,6 @@ _io_BufferedReader___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]); PyObject *iobj = PyNumber_Index(fastargs[1]);
@ -493,11 +473,6 @@ _io_BufferedWriter___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]); PyObject *iobj = PyNumber_Index(fastargs[1]);
@ -590,11 +565,6 @@ _io_BufferedRWPair___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if (PyTuple_GET_SIZE(args) < 3) { if (PyTuple_GET_SIZE(args) < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(PyTuple_GET_ITEM(args, 2))) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 2)); PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 2));
@ -649,11 +619,6 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]); PyObject *iobj = PyNumber_Index(fastargs[1]);
@ -672,4 +637,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=7d9ad40c95bdd808 input=a9049054013a1b77]*/ /*[clinic end generated code: output=1882bb497ddc9375 input=a9049054013a1b77]*/

View File

@ -402,11 +402,6 @@ _io_BytesIO_seek(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) { if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -422,11 +417,6 @@ _io_BytesIO_seek(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
whence = _PyLong_AsInt(args[1]); whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) { if (whence == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -515,4 +505,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=4ec2506def9c8eb9 input=a9049054013a1b77]*/ /*[clinic end generated code: output=ba0f302f16397741 input=a9049054013a1b77]*/

View File

@ -87,11 +87,6 @@ _io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
} }
} }
if (fastargs[2]) { if (fastargs[2]) {
if (PyFloat_Check(fastargs[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
closefd = _PyLong_AsInt(fastargs[2]); closefd = _PyLong_AsInt(fastargs[2]);
if (closefd == -1 && PyErr_Occurred()) { if (closefd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -351,11 +346,6 @@ _io_FileIO_seek(fileio *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
whence = _PyLong_AsInt(args[1]); whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) { if (whence == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -447,4 +437,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF #ifndef _IO_FILEIO_TRUNCATE_METHODDEF
#define _IO_FILEIO_TRUNCATE_METHODDEF #define _IO_FILEIO_TRUNCATE_METHODDEF
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */ #endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
/*[clinic end generated code: output=e7682d0a3264d284 input=a9049054013a1b77]*/ /*[clinic end generated code: output=3479912ec0f7e029 input=a9049054013a1b77]*/

View File

@ -274,11 +274,6 @@ _io__RawIOBase_read(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -315,4 +310,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
{ {
return _io__RawIOBase_readall_impl(self); return _io__RawIOBase_readall_impl(self);
} }
/*[clinic end generated code: output=61b6ea7153ef9940 input=a9049054013a1b77]*/ /*[clinic end generated code: output=1f9ce590549593be input=a9049054013a1b77]*/

View File

@ -177,11 +177,6 @@ _io_StringIO_seek(stringio *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) { if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -197,11 +192,6 @@ _io_StringIO_seek(stringio *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
whence = _PyLong_AsInt(args[1]); whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) { if (whence == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -348,4 +338,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored))
{ {
return _io_StringIO_seekable_impl(self); return _io_StringIO_seekable_impl(self);
} }
/*[clinic end generated code: output=7aad5ab2e64a25b8 input=a9049054013a1b77]*/ /*[clinic end generated code: output=9c428b2942d54991 input=a9049054013a1b77]*/

View File

@ -39,11 +39,6 @@ _io_IncrementalNewlineDecoder___init__(PyObject *self, PyObject *args, PyObject
goto exit; goto exit;
} }
decoder = fastargs[0]; decoder = fastargs[0];
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
translate = _PyLong_AsInt(fastargs[1]); translate = _PyLong_AsInt(fastargs[1]);
if (translate == -1 && PyErr_Occurred()) { if (translate == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -90,11 +85,6 @@ _io_IncrementalNewlineDecoder_decode(nldecoder_object *self, PyObject *const *ar
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[1]); final = _PyLong_AsInt(args[1]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -266,11 +256,6 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
} }
} }
if (fastargs[4]) { if (fastargs[4]) {
if (PyFloat_Check(fastargs[4])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
line_buffering = _PyLong_AsInt(fastargs[4]); line_buffering = _PyLong_AsInt(fastargs[4]);
if (line_buffering == -1 && PyErr_Occurred()) { if (line_buffering == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -279,11 +264,6 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(fastargs[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
write_through = _PyLong_AsInt(fastargs[5]); write_through = _PyLong_AsInt(fastargs[5]);
if (write_through == -1 && PyErr_Occurred()) { if (write_through == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -470,11 +450,6 @@ _io_TextIOWrapper_readline(textio *self, PyObject *const *args, Py_ssize_t nargs
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -519,11 +494,6 @@ _io_TextIOWrapper_seek(textio *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
whence = _PyLong_AsInt(args[1]); whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) { if (whence == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -701,4 +671,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{ {
return _io_TextIOWrapper_close_impl(self); return _io_TextIOWrapper_close_impl(self);
} }
/*[clinic end generated code: output=b1bae4f4cdf6019e input=a9049054013a1b77]*/ /*[clinic end generated code: output=ea96ee1eb3a71f77 input=a9049054013a1b77]*/

View File

@ -86,11 +86,6 @@ _io__WindowsConsoleIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
} }
} }
if (fastargs[2]) { if (fastargs[2]) {
if (PyFloat_Check(fastargs[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
closefd = _PyLong_AsInt(fastargs[2]); closefd = _PyLong_AsInt(fastargs[2]);
if (closefd == -1 && PyErr_Occurred()) { if (closefd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -386,4 +381,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF #ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF #define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */ #endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
/*[clinic end generated code: output=f5b8860a658a001a input=a9049054013a1b77]*/ /*[clinic end generated code: output=a28b3120fa53b256 input=a9049054013a1b77]*/

View File

@ -255,12 +255,6 @@ _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
self->fd = -1; self->fd = -1;
} }
if (PyFloat_Check(nameobj)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float");
return -1;
}
fd = _PyLong_AsInt(nameobj); fd = _PyLong_AsInt(nameobj);
if (fd < 0) { if (fd < 0) {
if (!PyErr_Occurred()) { if (!PyErr_Occurred()) {
@ -895,10 +889,6 @@ portable_lseek(fileio *self, PyObject *posobj, int whence, bool suppress_pipe_er
pos = 0; pos = 0;
} }
else { else {
if(PyFloat_Check(posobj)) {
PyErr_SetString(PyExc_TypeError, "an integer is required");
return NULL;
}
#if defined(HAVE_LARGEFILE_SUPPORT) #if defined(HAVE_LARGEFILE_SUPPORT)
pos = PyLong_AsLongLong(posobj); pos = PyLong_AsLongLong(posobj);
#else #else

View File

@ -281,12 +281,6 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
self->handle = INVALID_HANDLE_VALUE; self->handle = INVALID_HANDLE_VALUE;
} }
if (PyFloat_Check(nameobj)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float");
return -1;
}
fd = _PyLong_AsInt(nameobj); fd = _PyLong_AsInt(nameobj);
if (fd < 0) { if (fd < 0) {
if (!PyErr_Occurred()) { if (!PyErr_Occurred()) {

View File

@ -42,11 +42,6 @@ _posixshmem_shm_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
goto exit; goto exit;
} }
path = args[0]; path = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[1]); flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) { if (flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -54,11 +49,6 @@ _posixshmem_shm_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(args[2]); mode = _PyLong_AsInt(args[2]);
if (mode == -1 && PyErr_Occurred()) { if (mode == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -130,4 +120,4 @@ exit:
#ifndef _POSIXSHMEM_SHM_UNLINK_METHODDEF #ifndef _POSIXSHMEM_SHM_UNLINK_METHODDEF
#define _POSIXSHMEM_SHM_UNLINK_METHODDEF #define _POSIXSHMEM_SHM_UNLINK_METHODDEF
#endif /* !defined(_POSIXSHMEM_SHM_UNLINK_METHODDEF) */ #endif /* !defined(_POSIXSHMEM_SHM_UNLINK_METHODDEF) */
/*[clinic end generated code: output=9132861c61d8c2d8 input=a9049054013a1b77]*/ /*[clinic end generated code: output=bca8e78d0f43ef1a input=a9049054013a1b77]*/

View File

@ -337,17 +337,6 @@ II_getitem(arrayobject *ap, Py_ssize_t i)
(unsigned long) ((unsigned int *)ap->ob_item)[i]); (unsigned long) ((unsigned int *)ap->ob_item)[i]);
} }
static PyObject *
get_int_unless_float(PyObject *v)
{
if (PyFloat_Check(v)) {
PyErr_SetString(PyExc_TypeError,
"array item must be integer");
return NULL;
}
return _PyLong_FromNbIndexOrNbInt(v);
}
static int static int
II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
{ {
@ -355,7 +344,7 @@ II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
int do_decref = 0; /* if nb_int was called */ int do_decref = 0; /* if nb_int was called */
if (!PyLong_Check(v)) { if (!PyLong_Check(v)) {
v = get_int_unless_float(v); v = PyNumber_Index(v);
if (NULL == v) { if (NULL == v) {
return -1; return -1;
} }
@ -415,7 +404,7 @@ LL_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
int do_decref = 0; /* if nb_int was called */ int do_decref = 0; /* if nb_int was called */
if (!PyLong_Check(v)) { if (!PyLong_Check(v)) {
v = get_int_unless_float(v); v = PyNumber_Index(v);
if (NULL == v) { if (NULL == v) {
return -1; return -1;
} }
@ -468,7 +457,7 @@ QQ_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
int do_decref = 0; /* if nb_int was called */ int do_decref = 0; /* if nb_int was called */
if (!PyLong_Check(v)) { if (!PyLong_Check(v)) {
v = get_int_unless_float(v); v = PyNumber_Index(v);
if (NULL == v) { if (NULL == v) {
return -1; return -1;
} }

View File

@ -171,11 +171,6 @@ _multibytecodec_MultibyteIncrementalEncoder_encode(MultibyteIncrementalEncoderOb
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[1]); final = _PyLong_AsInt(args[1]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -288,11 +283,6 @@ _multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderOb
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[1]); final = _PyLong_AsInt(args[1]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -525,4 +515,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \ #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__}, {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
/*[clinic end generated code: output=5ce6fd4ca1f95620 input=a9049054013a1b77]*/ /*[clinic end generated code: output=5c0f74129db07c87 input=a9049054013a1b77]*/

View File

@ -46,11 +46,6 @@ _bisect_bisect_right(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[2]) { if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -122,11 +117,6 @@ _bisect_insort_right(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[2]) { if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -197,11 +187,6 @@ _bisect_bisect_left(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[2]) { if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -273,11 +258,6 @@ _bisect_insort_left(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[2]) { if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -303,4 +283,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=bcbd6c77331a08f0 input=a9049054013a1b77]*/ /*[clinic end generated code: output=e9097a9acd10b13f input=a9049054013a1b77]*/

View File

@ -95,11 +95,6 @@ _bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if (PyTuple_GET_SIZE(args) < 1) { if (PyTuple_GET_SIZE(args) < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(PyTuple_GET_ITEM(args, 0))) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
compresslevel = _PyLong_AsInt(PyTuple_GET_ITEM(args, 0)); compresslevel = _PyLong_AsInt(PyTuple_GET_ITEM(args, 0));
if (compresslevel == -1 && PyErr_Occurred()) { if (compresslevel == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -162,11 +157,6 @@ _bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *const *args, Py
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -220,4 +210,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=3f3f1e788fe28ee1 input=a9049054013a1b77]*/ /*[clinic end generated code: output=c69a7de8e26c2ad1 input=a9049054013a1b77]*/

View File

@ -424,11 +424,6 @@ _codecs_utf_7_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -499,11 +494,6 @@ _codecs_utf_8_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -574,11 +564,6 @@ _codecs_utf_16_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -649,11 +634,6 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -724,11 +704,6 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -801,11 +776,6 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
byteorder = _PyLong_AsInt(args[2]); byteorder = _PyLong_AsInt(args[2]);
if (byteorder == -1 && PyErr_Occurred()) { if (byteorder == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -813,11 +783,6 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[3]); final = _PyLong_AsInt(args[3]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -888,11 +853,6 @@ _codecs_utf_32_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -963,11 +923,6 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1038,11 +993,6 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1115,11 +1065,6 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
byteorder = _PyLong_AsInt(args[2]); byteorder = _PyLong_AsInt(args[2]);
if (byteorder == -1 && PyErr_Occurred()) { if (byteorder == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1127,11 +1072,6 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[3]); final = _PyLong_AsInt(args[3]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1539,11 +1479,6 @@ _codecs_mbcs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1618,11 +1553,6 @@ _codecs_oem_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[2]); final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1667,11 +1597,6 @@ _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (!_PyArg_CheckPositional("code_page_decode", nargs, 2, 4)) { if (!_PyArg_CheckPositional("code_page_decode", nargs, 2, 4)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
codepage = _PyLong_AsInt(args[0]); codepage = _PyLong_AsInt(args[0]);
if (codepage == -1 && PyErr_Occurred()) { if (codepage == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1707,11 +1632,6 @@ _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
final = _PyLong_AsInt(args[3]); final = _PyLong_AsInt(args[3]);
if (final == -1 && PyErr_Occurred()) { if (final == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1973,11 +1893,6 @@ _codecs_utf_16_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
byteorder = _PyLong_AsInt(args[2]); byteorder = _PyLong_AsInt(args[2]);
if (byteorder == -1 && PyErr_Occurred()) { if (byteorder == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2160,11 +2075,6 @@ _codecs_utf_32_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
byteorder = _PyLong_AsInt(args[2]); byteorder = _PyLong_AsInt(args[2]);
if (byteorder == -1 && PyErr_Occurred()) { if (byteorder == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2765,11 +2675,6 @@ _codecs_code_page_encode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (!_PyArg_CheckPositional("code_page_encode", nargs, 2, 3)) { if (!_PyArg_CheckPositional("code_page_encode", nargs, 2, 3)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
code_page = _PyLong_AsInt(args[0]); code_page = _PyLong_AsInt(args[0]);
if (code_page == -1 && PyErr_Occurred()) { if (code_page == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2922,4 +2827,4 @@ exit:
#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF #define _CODECS_CODE_PAGE_ENCODE_METHODDEF
#endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */ #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
/*[clinic end generated code: output=51b42d170889524c input=a9049054013a1b77]*/ /*[clinic end generated code: output=eeead01414be6e42 input=a9049054013a1b77]*/

View File

@ -50,11 +50,6 @@ tuplegetter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
if (!_PyArg_CheckPositional("_tuplegetter", PyTuple_GET_SIZE(args), 2, 2)) { if (!_PyArg_CheckPositional("_tuplegetter", PyTuple_GET_SIZE(args), 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(PyTuple_GET_ITEM(args, 0))) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 0)); PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 0));
@ -73,4 +68,4 @@ tuplegetter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=9d2bfcc9df5faf35 input=a9049054013a1b77]*/ /*[clinic end generated code: output=439d77631a056b4d input=a9049054013a1b77]*/

View File

@ -152,20 +152,10 @@ _curses_panel_panel_move(PyCursesPanelObject *self, PyObject *const *args, Py_ss
if (!_PyArg_CheckPositional("move", nargs, 2, 2)) { if (!_PyArg_CheckPositional("move", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
y = _PyLong_AsInt(args[0]); y = _PyLong_AsInt(args[0]);
if (y == -1 && PyErr_Occurred()) { if (y == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
x = _PyLong_AsInt(args[1]); x = _PyLong_AsInt(args[1]);
if (x == -1 && PyErr_Occurred()) { if (x == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -335,4 +325,4 @@ _curses_panel_update_panels(PyObject *module, PyObject *Py_UNUSED(ignored))
{ {
return _curses_panel_update_panels_impl(module); return _curses_panel_update_panels_impl(module);
} }
/*[clinic end generated code: output=d96dc1fd68e898d9 input=a9049054013a1b77]*/ /*[clinic end generated code: output=1226d5f94361ebfb input=a9049054013a1b77]*/

View File

@ -252,11 +252,6 @@ _curses_window_bkgd(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
attr = PyLong_AsLong(args[1]); attr = PyLong_AsLong(args[1]);
if (attr == -1 && PyErr_Occurred()) { if (attr == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -286,11 +281,6 @@ _curses_window_attroff(PyCursesWindowObject *self, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
long attr; long attr;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
attr = PyLong_AsLong(arg); attr = PyLong_AsLong(arg);
if (attr == -1 && PyErr_Occurred()) { if (attr == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -319,11 +309,6 @@ _curses_window_attron(PyCursesWindowObject *self, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
long attr; long attr;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
attr = PyLong_AsLong(arg); attr = PyLong_AsLong(arg);
if (attr == -1 && PyErr_Occurred()) { if (attr == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -352,11 +337,6 @@ _curses_window_attrset(PyCursesWindowObject *self, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
long attr; long attr;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
attr = PyLong_AsLong(arg); attr = PyLong_AsLong(arg);
if (attr == -1 && PyErr_Occurred()) { if (attr == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -399,11 +379,6 @@ _curses_window_bkgdset(PyCursesWindowObject *self, PyObject *const *args, Py_ssi
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
attr = PyLong_AsLong(args[1]); attr = PyLong_AsLong(args[1]);
if (attr == -1 && PyErr_Occurred()) { if (attr == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -687,11 +662,6 @@ _curses_window_echochar(PyCursesWindowObject *self, PyObject *const *args, Py_ss
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
attr = PyLong_AsLong(args[1]); attr = PyLong_AsLong(args[1]);
if (attr == -1 && PyErr_Occurred()) { if (attr == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -733,20 +703,10 @@ _curses_window_enclose(PyCursesWindowObject *self, PyObject *const *args, Py_ssi
if (!_PyArg_CheckPositional("enclose", nargs, 2, 2)) { if (!_PyArg_CheckPositional("enclose", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
y = _PyLong_AsInt(args[0]); y = _PyLong_AsInt(args[0]);
if (y == -1 && PyErr_Occurred()) { if (y == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
x = _PyLong_AsInt(args[1]); x = _PyLong_AsInt(args[1]);
if (x == -1 && PyErr_Occurred()) { if (x == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1303,11 +1263,6 @@ _curses_window_is_linetouched(PyCursesWindowObject *self, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int line; int line;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
line = _PyLong_AsInt(arg); line = _PyLong_AsInt(arg);
if (line == -1 && PyErr_Occurred()) { if (line == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1552,20 +1507,10 @@ _curses_window_redrawln(PyCursesWindowObject *self, PyObject *const *args, Py_ss
if (!_PyArg_CheckPositional("redrawln", nargs, 2, 2)) { if (!_PyArg_CheckPositional("redrawln", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
beg = _PyLong_AsInt(args[0]); beg = _PyLong_AsInt(args[0]);
if (beg == -1 && PyErr_Occurred()) { if (beg == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
num = _PyLong_AsInt(args[1]); num = _PyLong_AsInt(args[1]);
if (num == -1 && PyErr_Occurred()) { if (num == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1661,20 +1606,10 @@ _curses_window_setscrreg(PyCursesWindowObject *self, PyObject *const *args, Py_s
if (!_PyArg_CheckPositional("setscrreg", nargs, 2, 2)) { if (!_PyArg_CheckPositional("setscrreg", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
top = _PyLong_AsInt(args[0]); top = _PyLong_AsInt(args[0]);
if (top == -1 && PyErr_Occurred()) { if (top == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
bottom = _PyLong_AsInt(args[1]); bottom = _PyLong_AsInt(args[1]);
if (bottom == -1 && PyErr_Occurred()) { if (bottom == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2005,11 +1940,6 @@ _curses_cbreak(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(args[0]); flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2045,11 +1975,6 @@ _curses_color_content(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
short color_number; short color_number;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(arg); long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2099,11 +2024,6 @@ _curses_color_pair(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
short color_number; short color_number;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(arg); long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2155,11 +2075,6 @@ _curses_curs_set(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int visibility; int visibility;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
visibility = _PyLong_AsInt(arg); visibility = _PyLong_AsInt(arg);
if (visibility == -1 && PyErr_Occurred()) { if (visibility == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2235,11 +2150,6 @@ _curses_delay_output(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int ms; int ms;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
ms = _PyLong_AsInt(arg); ms = _PyLong_AsInt(arg);
if (ms == -1 && PyErr_Occurred()) { if (ms == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2297,11 +2207,6 @@ _curses_echo(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(args[0]); flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2469,11 +2374,6 @@ _curses_ungetmouse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("ungetmouse", nargs, 5, 5)) { if (!_PyArg_CheckPositional("ungetmouse", nargs, 5, 5)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[0]); long ival = PyLong_AsLong(args[0]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2493,29 +2393,14 @@ _curses_ungetmouse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
id = (short) ival; id = (short) ival;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
x = _PyLong_AsInt(args[1]); x = _PyLong_AsInt(args[1]);
if (x == -1 && PyErr_Occurred()) { if (x == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
y = _PyLong_AsInt(args[2]); y = _PyLong_AsInt(args[2]);
if (y == -1 && PyErr_Occurred()) { if (y == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
z = _PyLong_AsInt(args[3]); z = _PyLong_AsInt(args[3]);
if (z == -1 && PyErr_Occurred()) { if (z == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2568,11 +2453,6 @@ _curses_halfdelay(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
unsigned char tenths; unsigned char tenths;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(arg); long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2675,11 +2555,6 @@ _curses_has_key(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int key; int key;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
key = _PyLong_AsInt(arg); key = _PyLong_AsInt(arg);
if (key == -1 && PyErr_Occurred()) { if (key == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -2730,11 +2605,6 @@ _curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("init_color", nargs, 4, 4)) { if (!_PyArg_CheckPositional("init_color", nargs, 4, 4)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[0]); long ival = PyLong_AsLong(args[0]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2754,11 +2624,6 @@ _curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
color_number = (short) ival; color_number = (short) ival;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[1]); long ival = PyLong_AsLong(args[1]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2778,11 +2643,6 @@ _curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
r = (short) ival; r = (short) ival;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[2]); long ival = PyLong_AsLong(args[2]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2802,11 +2662,6 @@ _curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
g = (short) ival; g = (short) ival;
} }
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[3]); long ival = PyLong_AsLong(args[3]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2866,11 +2721,6 @@ _curses_init_pair(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("init_pair", nargs, 3, 3)) { if (!_PyArg_CheckPositional("init_pair", nargs, 3, 3)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[0]); long ival = PyLong_AsLong(args[0]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2890,11 +2740,6 @@ _curses_init_pair(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
pair_number = (short) ival; pair_number = (short) ival;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[1]); long ival = PyLong_AsLong(args[1]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -2914,11 +2759,6 @@ _curses_init_pair(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
fg = (short) ival; fg = (short) ival;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(args[2]); long ival = PyLong_AsLong(args[2]);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -3024,11 +2864,6 @@ _curses_setupterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyO
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(args[1]); fd = _PyLong_AsInt(args[1]);
if (fd == -1 && PyErr_Occurred()) { if (fd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3093,11 +2928,6 @@ _curses_set_escdelay(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int ms; int ms;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
ms = _PyLong_AsInt(arg); ms = _PyLong_AsInt(arg);
if (ms == -1 && PyErr_Occurred()) { if (ms == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3161,11 +2991,6 @@ _curses_set_tabsize(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int size; int size;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
size = _PyLong_AsInt(arg); size = _PyLong_AsInt(arg);
if (size == -1 && PyErr_Occurred()) { if (size == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3195,11 +3020,6 @@ _curses_intrflush(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int flag; int flag;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(arg); flag = _PyLong_AsInt(arg);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3257,20 +3077,10 @@ _curses_is_term_resized(PyObject *module, PyObject *const *args, Py_ssize_t narg
if (!_PyArg_CheckPositional("is_term_resized", nargs, 2, 2)) { if (!_PyArg_CheckPositional("is_term_resized", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
nlines = _PyLong_AsInt(args[0]); nlines = _PyLong_AsInt(args[0]);
if (nlines == -1 && PyErr_Occurred()) { if (nlines == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
ncols = _PyLong_AsInt(args[1]); ncols = _PyLong_AsInt(args[1]);
if (ncols == -1 && PyErr_Occurred()) { if (ncols == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3304,11 +3114,6 @@ _curses_keyname(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int key; int key;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
key = _PyLong_AsInt(arg); key = _PyLong_AsInt(arg);
if (key == -1 && PyErr_Occurred()) { if (key == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3379,11 +3184,6 @@ _curses_meta(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int yes; int yes;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
yes = _PyLong_AsInt(arg); yes = _PyLong_AsInt(arg);
if (yes == -1 && PyErr_Occurred()) { if (yes == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3421,11 +3221,6 @@ _curses_mouseinterval(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int interval; int interval;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
interval = _PyLong_AsInt(arg); interval = _PyLong_AsInt(arg);
if (interval == -1 && PyErr_Occurred()) { if (interval == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3497,11 +3292,6 @@ _curses_napms(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int ms; int ms;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
ms = _PyLong_AsInt(arg); ms = _PyLong_AsInt(arg);
if (ms == -1 && PyErr_Occurred()) { if (ms == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3539,20 +3329,10 @@ _curses_newpad(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("newpad", nargs, 2, 2)) { if (!_PyArg_CheckPositional("newpad", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
nlines = _PyLong_AsInt(args[0]); nlines = _PyLong_AsInt(args[0]);
if (nlines == -1 && PyErr_Occurred()) { if (nlines == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
ncols = _PyLong_AsInt(args[1]); ncols = _PyLong_AsInt(args[1]);
if (ncols == -1 && PyErr_Occurred()) { if (ncols == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3648,11 +3428,6 @@ _curses_nl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(args[0]); flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3787,11 +3562,6 @@ _curses_pair_content(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
short pair_number; short pair_number;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
long ival = PyLong_AsLong(arg); long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) { if (ival == -1 && PyErr_Occurred()) {
@ -3837,11 +3607,6 @@ _curses_pair_number(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int attr; int attr;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
attr = _PyLong_AsInt(arg); attr = _PyLong_AsInt(arg);
if (attr == -1 && PyErr_Occurred()) { if (attr == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3911,11 +3676,6 @@ _curses_qiflush(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(args[0]); flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -3979,11 +3739,6 @@ _curses_raw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(args[0]); flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -4081,20 +3836,10 @@ _curses_resizeterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("resizeterm", nargs, 2, 2)) { if (!_PyArg_CheckPositional("resizeterm", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
nlines = _PyLong_AsInt(args[0]); nlines = _PyLong_AsInt(args[0]);
if (nlines == -1 && PyErr_Occurred()) { if (nlines == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
ncols = _PyLong_AsInt(args[1]); ncols = _PyLong_AsInt(args[1]);
if (ncols == -1 && PyErr_Occurred()) { if (ncols == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -4142,20 +3887,10 @@ _curses_resize_term(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("resize_term", nargs, 2, 2)) { if (!_PyArg_CheckPositional("resize_term", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
nlines = _PyLong_AsInt(args[0]); nlines = _PyLong_AsInt(args[0]);
if (nlines == -1 && PyErr_Occurred()) { if (nlines == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
ncols = _PyLong_AsInt(args[1]); ncols = _PyLong_AsInt(args[1]);
if (ncols == -1 && PyErr_Occurred()) { if (ncols == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -4217,20 +3952,10 @@ _curses_setsyx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("setsyx", nargs, 2, 2)) { if (!_PyArg_CheckPositional("setsyx", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
y = _PyLong_AsInt(args[0]); y = _PyLong_AsInt(args[0]);
if (y == -1 && PyErr_Occurred()) { if (y == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
x = _PyLong_AsInt(args[1]); x = _PyLong_AsInt(args[1]);
if (x == -1 && PyErr_Occurred()) { if (x == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -4500,11 +4225,6 @@ _curses_typeahead(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int fd; int fd;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(arg); fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) { if (fd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -4580,11 +4300,6 @@ _curses_use_env(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int flag; int flag;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(arg); flag = _PyLong_AsInt(arg);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -4713,4 +4428,4 @@ _curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF #ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
#define _CURSES_USE_DEFAULT_COLORS_METHODDEF #define _CURSES_USE_DEFAULT_COLORS_METHODDEF
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */ #endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
/*[clinic end generated code: output=b53652f8acafd817 input=a9049054013a1b77]*/ /*[clinic end generated code: output=478d93f7692385eb input=a9049054013a1b77]*/

View File

@ -35,29 +35,14 @@ iso_calendar_date_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
if (!fastargs) { if (!fastargs) {
goto exit; goto exit;
} }
if (PyFloat_Check(fastargs[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
year = _PyLong_AsInt(fastargs[0]); year = _PyLong_AsInt(fastargs[0]);
if (year == -1 && PyErr_Occurred()) { if (year == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
week = _PyLong_AsInt(fastargs[1]); week = _PyLong_AsInt(fastargs[1]);
if (week == -1 && PyErr_Occurred()) { if (week == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(fastargs[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
weekday = _PyLong_AsInt(fastargs[2]); weekday = _PyLong_AsInt(fastargs[2]);
if (weekday == -1 && PyErr_Occurred()) { if (weekday == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -109,4 +94,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=5e17549f29a439a5 input=a9049054013a1b77]*/ /*[clinic end generated code: output=f61310936e3d8091 input=a9049054013a1b77]*/

View File

@ -162,11 +162,6 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(args[2]); mode = _PyLong_AsInt(args[2]);
if (mode == -1 && PyErr_Occurred()) { if (mode == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -177,4 +172,4 @@ skip_optional:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=7ced103488cbca7a input=a9049054013a1b77]*/ /*[clinic end generated code: output=ba4ff07b8c8bbfe4 input=a9049054013a1b77]*/

View File

@ -430,11 +430,6 @@ _elementtree_Element_insert(ElementObject *self, PyObject *const *args, Py_ssize
if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) { if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -920,4 +915,4 @@ skip_optional:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=b7f6a32462fc42a9 input=a9049054013a1b77]*/ /*[clinic end generated code: output=c98b210c525a9338 input=a9049054013a1b77]*/

View File

@ -283,11 +283,6 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(args[2]); mode = _PyLong_AsInt(args[2]);
if (mode == -1 && PyErr_Occurred()) { if (mode == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -298,4 +293,4 @@ skip_optional:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=2766471b2fa1a816 input=a9049054013a1b77]*/ /*[clinic end generated code: output=c9d43f42677f4efb input=a9049054013a1b77]*/

View File

@ -92,11 +92,6 @@ EVPXOF_digest(EVPobject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!args) { if (!args) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -144,11 +139,6 @@ EVPXOF_hexdigest(EVPobject *self, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!args) { if (!args) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -936,11 +926,6 @@ pbkdf2_hmac(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
_PyArg_BadArgument("pbkdf2_hmac", "argument 'salt'", "contiguous buffer", args[2]); _PyArg_BadArgument("pbkdf2_hmac", "argument 'salt'", "contiguous buffer", args[2]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
iterations = PyLong_AsLong(args[3]); iterations = PyLong_AsLong(args[3]);
if (iterations == -1 && PyErr_Occurred()) { if (iterations == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1055,11 +1040,6 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
} }
} }
if (args[5]) { if (args[5]) {
if (PyFloat_Check(args[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
maxmem = PyLong_AsLong(args[5]); maxmem = PyLong_AsLong(args[5]);
if (maxmem == -1 && PyErr_Occurred()) { if (maxmem == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1068,11 +1048,6 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
} }
if (PyFloat_Check(args[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
dklen = PyLong_AsLong(args[6]); dklen = PyLong_AsLong(args[6]);
if (dklen == -1 && PyErr_Occurred()) { if (dklen == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1402,4 +1377,4 @@ exit:
#ifndef _HASHLIB_GET_FIPS_MODE_METHODDEF #ifndef _HASHLIB_GET_FIPS_MODE_METHODDEF
#define _HASHLIB_GET_FIPS_MODE_METHODDEF #define _HASHLIB_GET_FIPS_MODE_METHODDEF
#endif /* !defined(_HASHLIB_GET_FIPS_MODE_METHODDEF) */ #endif /* !defined(_HASHLIB_GET_FIPS_MODE_METHODDEF) */
/*[clinic end generated code: output=a0bff5dcef88de6a input=a9049054013a1b77]*/ /*[clinic end generated code: output=d8dddcd85fb11dde input=a9049054013a1b77]*/

View File

@ -116,11 +116,6 @@ _lzma_LZMADecompressor_decompress(Decompressor *self, PyObject *const *args, Py_
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -194,11 +189,6 @@ _lzma_LZMADecompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs
goto skip_optional_pos; goto skip_optional_pos;
} }
if (fastargs[0]) { if (fastargs[0]) {
if (PyFloat_Check(fastargs[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
format = _PyLong_AsInt(fastargs[0]); format = _PyLong_AsInt(fastargs[0]);
if (format == -1 && PyErr_Occurred()) { if (format == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -241,11 +231,6 @@ _lzma_is_check_supported(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int check_id; int check_id;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
check_id = _PyLong_AsInt(arg); check_id = _PyLong_AsInt(arg);
if (check_id == -1 && PyErr_Occurred()) { if (check_id == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -334,4 +319,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=f7477a10e86a717d input=a9049054013a1b77]*/ /*[clinic end generated code: output=a87074ca902bd432 input=a9049054013a1b77]*/

View File

@ -32,11 +32,6 @@ _opcode_stack_effect(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
if (!args) { if (!args) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
opcode = _PyLong_AsInt(args[0]); opcode = _PyLong_AsInt(args[0]);
if (opcode == -1 && PyErr_Occurred()) { if (opcode == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -61,4 +56,4 @@ skip_optional_kwonly:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=7bc08f2835b2cf89 input=a9049054013a1b77]*/ /*[clinic end generated code: output=bcf66d25c2624197 input=a9049054013a1b77]*/

View File

@ -1424,11 +1424,6 @@ _operator_length_hint(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -1491,4 +1486,4 @@ _operator__compare_digest(PyObject *module, PyObject *const *args, Py_ssize_t na
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=e7ed71a8c475a901 input=a9049054013a1b77]*/ /*[clinic end generated code: output=1fe4adf4f5761420 input=a9049054013a1b77]*/

View File

@ -100,11 +100,6 @@ _random_Random_getrandbits(RandomObject *self, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int k; int k;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
k = _PyLong_AsInt(arg); k = _PyLong_AsInt(arg);
if (k == -1 && PyErr_Occurred()) { if (k == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -114,4 +109,4 @@ _random_Random_getrandbits(RandomObject *self, PyObject *arg)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=a7feb0c9c8d1b627 input=a9049054013a1b77]*/ /*[clinic end generated code: output=cc8a23b2757dc6ba input=a9049054013a1b77]*/

107
Modules/clinic/_sre.c.h generated
View File

@ -47,11 +47,6 @@ _sre_ascii_iscased(PyObject *module, PyObject *arg)
int character; int character;
int _return_value; int _return_value;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
character = _PyLong_AsInt(arg); character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) { if (character == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -84,11 +79,6 @@ _sre_unicode_iscased(PyObject *module, PyObject *arg)
int character; int character;
int _return_value; int _return_value;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
character = _PyLong_AsInt(arg); character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) { if (character == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -121,11 +111,6 @@ _sre_ascii_tolower(PyObject *module, PyObject *arg)
int character; int character;
int _return_value; int _return_value;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
character = _PyLong_AsInt(arg); character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) { if (character == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -158,11 +143,6 @@ _sre_unicode_tolower(PyObject *module, PyObject *arg)
int character; int character;
int _return_value; int _return_value;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
character = _PyLong_AsInt(arg); character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) { if (character == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -211,11 +191,6 @@ _sre_SRE_Pattern_match(PatternObject *self, PyObject *const *args, Py_ssize_t na
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -232,11 +207,6 @@ _sre_SRE_Pattern_match(PatternObject *self, PyObject *const *args, Py_ssize_t na
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -290,11 +260,6 @@ _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *const *args, Py_ssize_
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -311,11 +276,6 @@ _sre_SRE_Pattern_fullmatch(PatternObject *self, PyObject *const *args, Py_ssize_
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -371,11 +331,6 @@ _sre_SRE_Pattern_search(PatternObject *self, PyObject *const *args, Py_ssize_t n
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -392,11 +347,6 @@ _sre_SRE_Pattern_search(PatternObject *self, PyObject *const *args, Py_ssize_t n
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -450,11 +400,6 @@ _sre_SRE_Pattern_findall(PatternObject *self, PyObject *const *args, Py_ssize_t
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -471,11 +416,6 @@ _sre_SRE_Pattern_findall(PatternObject *self, PyObject *const *args, Py_ssize_t
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -531,11 +471,6 @@ _sre_SRE_Pattern_finditer(PatternObject *self, PyObject *const *args, Py_ssize_t
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -552,11 +487,6 @@ _sre_SRE_Pattern_finditer(PatternObject *self, PyObject *const *args, Py_ssize_t
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -609,11 +539,6 @@ _sre_SRE_Pattern_scanner(PatternObject *self, PyObject *const *args, Py_ssize_t
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -630,11 +555,6 @@ _sre_SRE_Pattern_scanner(PatternObject *self, PyObject *const *args, Py_ssize_t
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -686,11 +606,6 @@ _sre_SRE_Pattern_split(PatternObject *self, PyObject *const *args, Py_ssize_t na
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -744,11 +659,6 @@ _sre_SRE_Pattern_sub(PatternObject *self, PyObject *const *args, Py_ssize_t narg
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -802,11 +712,6 @@ _sre_SRE_Pattern_subn(PatternObject *self, PyObject *const *args, Py_ssize_t nar
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -884,11 +789,6 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
goto exit; goto exit;
} }
pattern = args[0]; pattern = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[1]); flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) { if (flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -898,11 +798,6 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
goto exit; goto exit;
} }
code = args[2]; code = args[2];
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[3]); PyObject *iobj = PyNumber_Index(args[3]);
@ -1207,4 +1102,4 @@ _sre_SRE_Scanner_search(ScannerObject *self, PyObject *Py_UNUSED(ignored))
{ {
return _sre_SRE_Scanner_search_impl(self); return _sre_SRE_Scanner_search_impl(self);
} }
/*[clinic end generated code: output=1adeddce58ae284c input=a9049054013a1b77]*/ /*[clinic end generated code: output=7a3360917b40a808 input=a9049054013a1b77]*/

View File

@ -406,11 +406,6 @@ _ssl__SSLContext(PyTypeObject *type, PyObject *args, PyObject *kwargs)
if (!_PyArg_CheckPositional("_SSLContext", PyTuple_GET_SIZE(args), 1, 1)) { if (!_PyArg_CheckPositional("_SSLContext", PyTuple_GET_SIZE(args), 1, 1)) {
goto exit; goto exit;
} }
if (PyFloat_Check(PyTuple_GET_ITEM(args, 0))) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
proto_version = _PyLong_AsInt(PyTuple_GET_ITEM(args, 0)); proto_version = _PyLong_AsInt(PyTuple_GET_ITEM(args, 0));
if (proto_version == -1 && PyErr_Occurred()) { if (proto_version == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -694,11 +689,6 @@ _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *const *args, Py_ssiz
goto exit; goto exit;
} }
sock = args[0]; sock = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
server_side = _PyLong_AsInt(args[1]); server_side = _PyLong_AsInt(args[1]);
if (server_side == -1 && PyErr_Occurred()) { if (server_side == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -774,11 +764,6 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
goto exit; goto exit;
} }
outgoing = (PySSLMemoryBIO *)args[1]; outgoing = (PySSLMemoryBIO *)args[1];
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
server_side = _PyLong_AsInt(args[2]); server_side = _PyLong_AsInt(args[2]);
if (server_side == -1 && PyErr_Occurred()) { if (server_side == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -977,11 +962,6 @@ _ssl_MemoryBIO_read(PySSLMemoryBIO *self, PyObject *const *args, Py_ssize_t narg
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
len = _PyLong_AsInt(args[0]); len = _PyLong_AsInt(args[0]);
if (len == -1 && PyErr_Occurred()) { if (len == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1132,11 +1112,6 @@ _ssl_RAND_bytes(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int n; int n;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
n = _PyLong_AsInt(arg); n = _PyLong_AsInt(arg);
if (n == -1 && PyErr_Occurred()) { if (n == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1168,11 +1143,6 @@ _ssl_RAND_pseudo_bytes(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int n; int n;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
n = _PyLong_AsInt(arg); n = _PyLong_AsInt(arg);
if (n == -1 && PyErr_Occurred()) { if (n == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1333,11 +1303,6 @@ _ssl_nid2obj(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int nid; int nid;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
nid = _PyLong_AsInt(arg); nid = _PyLong_AsInt(arg);
if (nid == -1 && PyErr_Occurred()) { if (nid == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1482,4 +1447,4 @@ exit:
#ifndef _SSL_ENUM_CRLS_METHODDEF #ifndef _SSL_ENUM_CRLS_METHODDEF
#define _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF
#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
/*[clinic end generated code: output=a4aeb3f92a091c64 input=a9049054013a1b77]*/ /*[clinic end generated code: output=d4e4f9cdd08819f4 input=a9049054013a1b77]*/

View File

@ -124,11 +124,6 @@ Struct_unpack_from(PyStructObject *self, PyObject *const *args, Py_ssize_t nargs
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -315,11 +310,6 @@ unpack_from(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -386,4 +376,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=6a6228cfc4b7099c input=a9049054013a1b77]*/ /*[clinic end generated code: output=1205daf7f616f0cf input=a9049054013a1b77]*/

View File

@ -434,11 +434,6 @@ _tkinter_tkapp_createfilehandler(TkappObject *self, PyObject *const *args, Py_ss
goto exit; goto exit;
} }
file = args[0]; file = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mask = _PyLong_AsInt(args[1]); mask = _PyLong_AsInt(args[1]);
if (mask == -1 && PyErr_Occurred()) { if (mask == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -503,11 +498,6 @@ _tkinter_tkapp_createtimerhandler(TkappObject *self, PyObject *const *args, Py_s
if (!_PyArg_CheckPositional("createtimerhandler", nargs, 2, 2)) { if (!_PyArg_CheckPositional("createtimerhandler", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
milliseconds = _PyLong_AsInt(args[0]); milliseconds = _PyLong_AsInt(args[0]);
if (milliseconds == -1 && PyErr_Occurred()) { if (milliseconds == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -542,11 +532,6 @@ _tkinter_tkapp_mainloop(TkappObject *self, PyObject *const *args, Py_ssize_t nar
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
threshold = _PyLong_AsInt(args[0]); threshold = _PyLong_AsInt(args[0]);
if (threshold == -1 && PyErr_Occurred()) { if (threshold == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -581,11 +566,6 @@ _tkinter_tkapp_dooneevent(TkappObject *self, PyObject *const *args, Py_ssize_t n
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[0]); flags = _PyLong_AsInt(args[0]);
if (flags == -1 && PyErr_Occurred()) { if (flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -769,11 +749,6 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
interactive = _PyLong_AsInt(args[3]); interactive = _PyLong_AsInt(args[3]);
if (interactive == -1 && PyErr_Occurred()) { if (interactive == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -781,11 +756,6 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 5) { if (nargs < 5) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[4])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
wantobjects = _PyLong_AsInt(args[4]); wantobjects = _PyLong_AsInt(args[4]);
if (wantobjects == -1 && PyErr_Occurred()) { if (wantobjects == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -793,11 +763,6 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 6) { if (nargs < 6) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
wantTk = _PyLong_AsInt(args[5]); wantTk = _PyLong_AsInt(args[5]);
if (wantTk == -1 && PyErr_Occurred()) { if (wantTk == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -805,11 +770,6 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 7) { if (nargs < 7) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
sync = _PyLong_AsInt(args[6]); sync = _PyLong_AsInt(args[6]);
if (sync == -1 && PyErr_Occurred()) { if (sync == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -862,11 +822,6 @@ _tkinter_setbusywaitinterval(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int new_val; int new_val;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
new_val = _PyLong_AsInt(arg); new_val = _PyLong_AsInt(arg);
if (new_val == -1 && PyErr_Occurred()) { if (new_val == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -912,4 +867,4 @@ exit:
#ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */ #endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */
/*[clinic end generated code: output=492b8b833fe54bc9 input=a9049054013a1b77]*/ /*[clinic end generated code: output=ab311480dd044fe4 input=a9049054013a1b77]*/

View File

@ -101,11 +101,6 @@ _tracemalloc_start(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
nframe = _PyLong_AsInt(args[0]); nframe = _PyLong_AsInt(args[0]);
if (nframe == -1 && PyErr_Occurred()) { if (nframe == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -217,4 +212,4 @@ _tracemalloc_reset_peak(PyObject *module, PyObject *Py_UNUSED(ignored))
{ {
return _tracemalloc_reset_peak_impl(module); return _tracemalloc_reset_peak_impl(module);
} }
/*[clinic end generated code: output=a130117b1af821da input=a9049054013a1b77]*/ /*[clinic end generated code: output=bafca0a19b0b0823 input=a9049054013a1b77]*/

View File

@ -82,11 +82,6 @@ array_array_pop(arrayobject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -137,11 +132,6 @@ array_array_insert(arrayobject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) { if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -253,11 +243,6 @@ array_array_fromfile(arrayobject *self, PyObject *const *args, Py_ssize_t nargs)
goto exit; goto exit;
} }
f = args[0]; f = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -483,11 +468,6 @@ array__array_reconstructor(PyObject *module, PyObject *const *args, Py_ssize_t n
goto exit; goto exit;
} }
typecode = PyUnicode_READ_CHAR(args[1], 0); typecode = PyUnicode_READ_CHAR(args[1], 0);
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mformat_code = _PyLong_AsInt(args[2]); mformat_code = _PyLong_AsInt(args[2]);
if (mformat_code == -1 && PyErr_Occurred()) { if (mformat_code == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -534,4 +514,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \ #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__}, {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
/*[clinic end generated code: output=9f70748dd3bc532f input=a9049054013a1b77]*/ /*[clinic end generated code: output=c953eb8486c7c8da input=a9049054013a1b77]*/

View File

@ -33,20 +33,10 @@ audioop_getsample(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("getsample", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("getsample", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -99,11 +89,6 @@ audioop_max(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("max", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("max", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -148,11 +133,6 @@ audioop_minmax(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("minmax", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("minmax", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -197,11 +177,6 @@ audioop_avg(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("avg", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("avg", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -246,11 +221,6 @@ audioop_rms(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("rms", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("rms", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -400,11 +370,6 @@ audioop_findmax(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("findmax", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("findmax", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -457,11 +422,6 @@ audioop_avgpp(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("avgpp", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("avgpp", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -506,11 +466,6 @@ audioop_maxpp(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("maxpp", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("maxpp", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -555,11 +510,6 @@ audioop_cross(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("cross", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("cross", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -606,11 +556,6 @@ audioop_mul(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("mul", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("mul", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -668,11 +613,6 @@ audioop_tomono(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("tomono", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("tomono", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -740,11 +680,6 @@ audioop_tostereo(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("tostereo", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("tostereo", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -818,11 +753,6 @@ audioop_add(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("add", "argument 2", "contiguous buffer", args[1]); _PyArg_BadArgument("add", "argument 2", "contiguous buffer", args[1]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[2]); width = _PyLong_AsInt(args[2]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -872,20 +802,10 @@ audioop_bias(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("bias", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("bias", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
bias = _PyLong_AsInt(args[2]); bias = _PyLong_AsInt(args[2]);
if (bias == -1 && PyErr_Occurred()) { if (bias == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -930,11 +850,6 @@ audioop_reverse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("reverse", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("reverse", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -979,11 +894,6 @@ audioop_byteswap(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("byteswap", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("byteswap", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1030,20 +940,10 @@ audioop_lin2lin(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("lin2lin", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("lin2lin", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
newwidth = _PyLong_AsInt(args[2]); newwidth = _PyLong_AsInt(args[2]);
if (newwidth == -1 && PyErr_Occurred()) { if (newwidth == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1097,38 +997,18 @@ audioop_ratecv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("ratecv", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("ratecv", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
nchannels = _PyLong_AsInt(args[2]); nchannels = _PyLong_AsInt(args[2]);
if (nchannels == -1 && PyErr_Occurred()) { if (nchannels == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
inrate = _PyLong_AsInt(args[3]); inrate = _PyLong_AsInt(args[3]);
if (inrate == -1 && PyErr_Occurred()) { if (inrate == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[4])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
outrate = _PyLong_AsInt(args[4]); outrate = _PyLong_AsInt(args[4]);
if (outrate == -1 && PyErr_Occurred()) { if (outrate == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1137,11 +1017,6 @@ audioop_ratecv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 7) { if (nargs < 7) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
weightA = _PyLong_AsInt(args[6]); weightA = _PyLong_AsInt(args[6]);
if (weightA == -1 && PyErr_Occurred()) { if (weightA == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1149,11 +1024,6 @@ audioop_ratecv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 8) { if (nargs < 8) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[7])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
weightB = _PyLong_AsInt(args[7]); weightB = _PyLong_AsInt(args[7]);
if (weightB == -1 && PyErr_Occurred()) { if (weightB == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1199,11 +1069,6 @@ audioop_lin2ulaw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("lin2ulaw", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("lin2ulaw", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1248,11 +1113,6 @@ audioop_ulaw2lin(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("ulaw2lin", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("ulaw2lin", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1297,11 +1157,6 @@ audioop_lin2alaw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("lin2alaw", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("lin2alaw", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1346,11 +1201,6 @@ audioop_alaw2lin(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("alaw2lin", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("alaw2lin", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1397,11 +1247,6 @@ audioop_lin2adpcm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("lin2adpcm", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("lin2adpcm", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1449,11 +1294,6 @@ audioop_adpcm2lin(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("adpcm2lin", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("adpcm2lin", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
width = _PyLong_AsInt(args[1]); width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) { if (width == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1469,4 +1309,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=6b4f2c597f295abc input=a9049054013a1b77]*/ /*[clinic end generated code: output=343e5ae478fc0359 input=a9049054013a1b77]*/

View File

@ -70,11 +70,6 @@ binascii_b2a_uu(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!noptargs) { if (!noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
backtick = _PyLong_AsInt(args[1]); backtick = _PyLong_AsInt(args[1]);
if (backtick == -1 && PyErr_Occurred()) { if (backtick == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -159,11 +154,6 @@ binascii_b2a_base64(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
if (!noptargs) { if (!noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
newline = _PyLong_AsInt(args[1]); newline = _PyLong_AsInt(args[1]);
if (newline == -1 && PyErr_Occurred()) { if (newline == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -348,11 +338,6 @@ binascii_crc_hqx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("crc_hqx", "argument 1", "contiguous buffer", args[0]); _PyArg_BadArgument("crc_hqx", "argument 1", "contiguous buffer", args[0]);
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (crc == (unsigned int)-1 && PyErr_Occurred()) { if (crc == (unsigned int)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -401,11 +386,6 @@ binascii_crc32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); crc = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (crc == (unsigned int)-1 && PyErr_Occurred()) { if (crc == (unsigned int)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -488,11 +468,6 @@ binascii_b2a_hex(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
bytes_per_sep = _PyLong_AsInt(args[2]); bytes_per_sep = _PyLong_AsInt(args[2]);
if (bytes_per_sep == -1 && PyErr_Occurred()) { if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -563,11 +538,6 @@ binascii_hexlify(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
bytes_per_sep = _PyLong_AsInt(args[2]); bytes_per_sep = _PyLong_AsInt(args[2]);
if (bytes_per_sep == -1 && PyErr_Occurred()) { if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -684,11 +654,6 @@ binascii_a2b_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
header = _PyLong_AsInt(args[1]); header = _PyLong_AsInt(args[1]);
if (header == -1 && PyErr_Occurred()) { if (header == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -749,11 +714,6 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
quotetabs = _PyLong_AsInt(args[1]); quotetabs = _PyLong_AsInt(args[1]);
if (quotetabs == -1 && PyErr_Occurred()) { if (quotetabs == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -763,11 +723,6 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
} }
} }
if (args[2]) { if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
istext = _PyLong_AsInt(args[2]); istext = _PyLong_AsInt(args[2]);
if (istext == -1 && PyErr_Occurred()) { if (istext == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -776,11 +731,6 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
header = _PyLong_AsInt(args[3]); header = _PyLong_AsInt(args[3]);
if (header == -1 && PyErr_Occurred()) { if (header == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -796,4 +746,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=a1e878d3963b615e input=a9049054013a1b77]*/ /*[clinic end generated code: output=95a0178f30801b89 input=a9049054013a1b77]*/

View File

@ -38,11 +38,6 @@ fcntl_fcntl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!conv_descriptor(args[0], &fd)) { if (!conv_descriptor(args[0], &fd)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
code = _PyLong_AsInt(args[1]); code = _PyLong_AsInt(args[1]);
if (code == -1 && PyErr_Occurred()) { if (code == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -113,11 +108,6 @@ fcntl_ioctl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!conv_descriptor(args[0], &fd)) { if (!conv_descriptor(args[0], &fd)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
code = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); code = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (code == (unsigned int)-1 && PyErr_Occurred()) { if (code == (unsigned int)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -168,11 +158,6 @@ fcntl_flock(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!conv_descriptor(args[0], &fd)) { if (!conv_descriptor(args[0], &fd)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
code = _PyLong_AsInt(args[1]); code = _PyLong_AsInt(args[1]);
if (code == -1 && PyErr_Occurred()) { if (code == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -233,11 +218,6 @@ fcntl_lockf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!conv_descriptor(args[0], &fd)) { if (!conv_descriptor(args[0], &fd)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
code = _PyLong_AsInt(args[1]); code = _PyLong_AsInt(args[1]);
if (code == -1 && PyErr_Occurred()) { if (code == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -253,11 +233,6 @@ fcntl_lockf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 5) { if (nargs < 5) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[4])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
whence = _PyLong_AsInt(args[4]); whence = _PyLong_AsInt(args[4]);
if (whence == -1 && PyErr_Occurred()) { if (whence == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -268,4 +243,4 @@ skip_optional:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=e912d25e28362c52 input=a9049054013a1b77]*/ /*[clinic end generated code: output=91c2295402509595 input=a9049054013a1b77]*/

View File

@ -102,11 +102,6 @@ gc_collect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
generation = _PyLong_AsInt(args[0]); generation = _PyLong_AsInt(args[0]);
if (generation == -1 && PyErr_Occurred()) { if (generation == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -151,11 +146,6 @@ gc_set_debug(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int flags; int flags;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(arg); flags = _PyLong_AsInt(arg);
if (flags == -1 && PyErr_Occurred()) { if (flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -382,4 +372,4 @@ gc_get_freeze_count(PyObject *module, PyObject *Py_UNUSED(ignored))
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=bd6a8056989e2e69 input=a9049054013a1b77]*/ /*[clinic end generated code: output=61e15f3a549f3ab5 input=a9049054013a1b77]*/

View File

@ -170,11 +170,6 @@ itertools_tee(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -356,11 +351,6 @@ itertools_combinations(PyTypeObject *type, PyObject *args, PyObject *kwargs)
goto exit; goto exit;
} }
iterable = fastargs[0]; iterable = fastargs[0];
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]); PyObject *iobj = PyNumber_Index(fastargs[1]);
@ -409,11 +399,6 @@ itertools_combinations_with_replacement(PyTypeObject *type, PyObject *args, PyOb
goto exit; goto exit;
} }
iterable = fastargs[0]; iterable = fastargs[0];
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]); PyObject *iobj = PyNumber_Index(fastargs[1]);
@ -642,4 +627,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=392c9706e79f6710 input=a9049054013a1b77]*/ /*[clinic end generated code: output=07211f86c4153050 input=a9049054013a1b77]*/

File diff suppressed because it is too large Load Diff

View File

@ -31,11 +31,6 @@ pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *const *args, Py_ssize_t
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
isfinal = _PyLong_AsInt(args[1]); isfinal = _PyLong_AsInt(args[1]);
if (isfinal == -1 && PyErr_Occurred()) { if (isfinal == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -221,11 +216,6 @@ pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int flag; int flag;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(arg); flag = _PyLong_AsInt(arg);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -384,11 +374,6 @@ pyexpat_ErrorString(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
long code; long code;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
code = PyLong_AsLong(arg); code = PyLong_AsLong(arg);
if (code == -1 && PyErr_Occurred()) { if (code == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -402,4 +387,4 @@ exit:
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */ #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
/*[clinic end generated code: output=68ce25024280af41 input=a9049054013a1b77]*/ /*[clinic end generated code: output=14e37efc4ec10be2 input=a9049054013a1b77]*/

View File

@ -19,11 +19,6 @@ resource_getrusage(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int who; int who;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
who = _PyLong_AsInt(arg); who = _PyLong_AsInt(arg);
if (who == -1 && PyErr_Occurred()) { if (who == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -51,11 +46,6 @@ resource_getrlimit(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int resource; int resource;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
resource = _PyLong_AsInt(arg); resource = _PyLong_AsInt(arg);
if (resource == -1 && PyErr_Occurred()) { if (resource == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -87,11 +77,6 @@ resource_setrlimit(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("setrlimit", nargs, 2, 2)) { if (!_PyArg_CheckPositional("setrlimit", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
resource = _PyLong_AsInt(args[0]); resource = _PyLong_AsInt(args[0]);
if (resource == -1 && PyErr_Occurred()) { if (resource == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -178,4 +163,4 @@ exit:
#ifndef RESOURCE_PRLIMIT_METHODDEF #ifndef RESOURCE_PRLIMIT_METHODDEF
#define RESOURCE_PRLIMIT_METHODDEF #define RESOURCE_PRLIMIT_METHODDEF
#endif /* !defined(RESOURCE_PRLIMIT_METHODDEF) */ #endif /* !defined(RESOURCE_PRLIMIT_METHODDEF) */
/*[clinic end generated code: output=ef3034f291156a34 input=a9049054013a1b77]*/ /*[clinic end generated code: output=ad190fb33d647d1e input=a9049054013a1b77]*/

View File

@ -528,11 +528,6 @@ select_epoll(PyTypeObject *type, PyObject *args, PyObject *kwargs)
goto skip_optional_pos; goto skip_optional_pos;
} }
if (fastargs[0]) { if (fastargs[0]) {
if (PyFloat_Check(fastargs[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
sizehint = _PyLong_AsInt(fastargs[0]); sizehint = _PyLong_AsInt(fastargs[0]);
if (sizehint == -1 && PyErr_Occurred()) { if (sizehint == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -541,11 +536,6 @@ select_epoll(PyTypeObject *type, PyObject *args, PyObject *kwargs)
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(fastargs[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(fastargs[1]); flags = _PyLong_AsInt(fastargs[1]);
if (flags == -1 && PyErr_Occurred()) { if (flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -625,11 +615,6 @@ select_epoll_fromfd(PyTypeObject *type, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int fd; int fd;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(arg); fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) { if (fd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -685,11 +670,6 @@ select_epoll_register(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t na
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (eventmask == (unsigned int)-1 && PyErr_Occurred()) { if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -740,11 +720,6 @@ select_epoll_modify(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t narg
if (!fildes_converter(args[0], &fd)) { if (!fildes_converter(args[0], &fd)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (eventmask == (unsigned int)-1 && PyErr_Occurred()) { if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -846,11 +821,6 @@ select_epoll_poll(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs,
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
maxevents = _PyLong_AsInt(args[1]); maxevents = _PyLong_AsInt(args[1]);
if (maxevents == -1 && PyErr_Occurred()) { if (maxevents == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1041,11 +1011,6 @@ select_kqueue_fromfd(PyTypeObject *type, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int fd; int fd;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(arg); fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) { if (fd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1094,11 +1059,6 @@ select_kqueue_control(kqueue_queue_Object *self, PyObject *const *args, Py_ssize
goto exit; goto exit;
} }
changelist = args[0]; changelist = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
maxevents = _PyLong_AsInt(args[1]); maxevents = _PyLong_AsInt(args[1]);
if (maxevents == -1 && PyErr_Occurred()) { if (maxevents == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1215,4 +1175,4 @@ exit:
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF #ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define SELECT_KQUEUE_CONTROL_METHODDEF #define SELECT_KQUEUE_CONTROL_METHODDEF
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */ #endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
/*[clinic end generated code: output=029f23fbe000d7f7 input=a9049054013a1b77]*/ /*[clinic end generated code: output=a055330869acbd16 input=a9049054013a1b77]*/

View File

@ -23,11 +23,6 @@ signal_alarm(PyObject *module, PyObject *arg)
int seconds; int seconds;
long _return_value; long _return_value;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
seconds = _PyLong_AsInt(arg); seconds = _PyLong_AsInt(arg);
if (seconds == -1 && PyErr_Occurred()) { if (seconds == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -84,11 +79,6 @@ signal_raise_signal(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int signalnum; int signalnum;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
signalnum = _PyLong_AsInt(arg); signalnum = _PyLong_AsInt(arg);
if (signalnum == -1 && PyErr_Occurred()) { if (signalnum == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -128,11 +118,6 @@ signal_signal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("signal", nargs, 2, 2)) { if (!_PyArg_CheckPositional("signal", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
signalnum = _PyLong_AsInt(args[0]); signalnum = _PyLong_AsInt(args[0]);
if (signalnum == -1 && PyErr_Occurred()) { if (signalnum == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -168,11 +153,6 @@ signal_getsignal(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int signalnum; int signalnum;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
signalnum = _PyLong_AsInt(arg); signalnum = _PyLong_AsInt(arg);
if (signalnum == -1 && PyErr_Occurred()) { if (signalnum == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -204,11 +184,6 @@ signal_strsignal(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int signalnum; int signalnum;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
signalnum = _PyLong_AsInt(arg); signalnum = _PyLong_AsInt(arg);
if (signalnum == -1 && PyErr_Occurred()) { if (signalnum == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -246,20 +221,10 @@ signal_siginterrupt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("siginterrupt", nargs, 2, 2)) { if (!_PyArg_CheckPositional("siginterrupt", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
signalnum = _PyLong_AsInt(args[0]); signalnum = _PyLong_AsInt(args[0]);
if (signalnum == -1 && PyErr_Occurred()) { if (signalnum == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(args[1]); flag = _PyLong_AsInt(args[1]);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -303,11 +268,6 @@ signal_setitimer(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("setitimer", nargs, 2, 3)) { if (!_PyArg_CheckPositional("setitimer", nargs, 2, 3)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
which = _PyLong_AsInt(args[0]); which = _PyLong_AsInt(args[0]);
if (which == -1 && PyErr_Occurred()) { if (which == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -346,11 +306,6 @@ signal_getitimer(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int which; int which;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
which = _PyLong_AsInt(arg); which = _PyLong_AsInt(arg);
if (which == -1 && PyErr_Occurred()) { if (which == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -387,11 +342,6 @@ signal_pthread_sigmask(PyObject *module, PyObject *const *args, Py_ssize_t nargs
if (!_PyArg_CheckPositional("pthread_sigmask", nargs, 2, 2)) { if (!_PyArg_CheckPositional("pthread_sigmask", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
how = _PyLong_AsInt(args[0]); how = _PyLong_AsInt(args[0]);
if (how == -1 && PyErr_Occurred()) { if (how == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -594,11 +544,6 @@ signal_pthread_kill(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
goto exit; goto exit;
} }
thread_id = PyLong_AsUnsignedLongMask(args[0]); thread_id = PyLong_AsUnsignedLongMask(args[0]);
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
signalnum = _PyLong_AsInt(args[1]); signalnum = _PyLong_AsInt(args[1]);
if (signalnum == -1 && PyErr_Occurred()) { if (signalnum == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -638,20 +583,10 @@ signal_pidfd_send_signal(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (!_PyArg_CheckPositional("pidfd_send_signal", nargs, 2, 4)) { if (!_PyArg_CheckPositional("pidfd_send_signal", nargs, 2, 4)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
pidfd = _PyLong_AsInt(args[0]); pidfd = _PyLong_AsInt(args[0]);
if (pidfd == -1 && PyErr_Occurred()) { if (pidfd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
signalnum = _PyLong_AsInt(args[1]); signalnum = _PyLong_AsInt(args[1]);
if (signalnum == -1 && PyErr_Occurred()) { if (signalnum == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -663,11 +598,6 @@ signal_pidfd_send_signal(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) { if (nargs < 4) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[3]); flags = _PyLong_AsInt(args[3]);
if (flags == -1 && PyErr_Occurred()) { if (flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -732,4 +662,4 @@ exit:
#ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF #ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
#define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF #define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
#endif /* !defined(SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF) */ #endif /* !defined(SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF) */
/*[clinic end generated code: output=b41b4b6bd9ad4da2 input=a9049054013a1b77]*/ /*[clinic end generated code: output=dff93c869101f043 input=a9049054013a1b77]*/

View File

@ -44,11 +44,6 @@ zlib_compress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
level = _PyLong_AsInt(args[1]); level = _PyLong_AsInt(args[1]);
if (level == -1 && PyErr_Occurred()) { if (level == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -112,11 +107,6 @@ zlib_decompress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
wbits = _PyLong_AsInt(args[1]); wbits = _PyLong_AsInt(args[1]);
if (wbits == -1 && PyErr_Occurred()) { if (wbits == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -125,8 +115,17 @@ zlib_decompress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (!ssize_t_converter(args[2], &bufsize)) { {
goto exit; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
bufsize = ival;
} }
skip_optional_pos: skip_optional_pos:
return_value = zlib_decompress_impl(module, &data, wbits, bufsize); return_value = zlib_decompress_impl(module, &data, wbits, bufsize);
@ -200,11 +199,6 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[0]) { if (args[0]) {
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
level = _PyLong_AsInt(args[0]); level = _PyLong_AsInt(args[0]);
if (level == -1 && PyErr_Occurred()) { if (level == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -214,11 +208,6 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
} }
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
method = _PyLong_AsInt(args[1]); method = _PyLong_AsInt(args[1]);
if (method == -1 && PyErr_Occurred()) { if (method == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -228,11 +217,6 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
} }
} }
if (args[2]) { if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
wbits = _PyLong_AsInt(args[2]); wbits = _PyLong_AsInt(args[2]);
if (wbits == -1 && PyErr_Occurred()) { if (wbits == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -242,11 +226,6 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
} }
} }
if (args[3]) { if (args[3]) {
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
memLevel = _PyLong_AsInt(args[3]); memLevel = _PyLong_AsInt(args[3]);
if (memLevel == -1 && PyErr_Occurred()) { if (memLevel == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -256,11 +235,6 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
} }
} }
if (args[4]) { if (args[4]) {
if (PyFloat_Check(args[4])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
strategy = _PyLong_AsInt(args[4]); strategy = _PyLong_AsInt(args[4]);
if (strategy == -1 && PyErr_Occurred()) { if (strategy == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -325,11 +299,6 @@ zlib_decompressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[0]) { if (args[0]) {
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
wbits = _PyLong_AsInt(args[0]); wbits = _PyLong_AsInt(args[0]);
if (wbits == -1 && PyErr_Occurred()) { if (wbits == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -438,8 +407,17 @@ zlib_Decompress_decompress(compobject *self, PyObject *const *args, Py_ssize_t n
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (!ssize_t_converter(args[1], &max_length)) { {
goto exit; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
max_length = ival;
} }
skip_optional_pos: skip_optional_pos:
return_value = zlib_Decompress_decompress_impl(self, &data, max_length); return_value = zlib_Decompress_decompress_impl(self, &data, max_length);
@ -483,11 +461,6 @@ zlib_Compress_flush(compobject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(args[0]); mode = _PyLong_AsInt(args[0]);
if (mode == -1 && PyErr_Occurred()) { if (mode == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -636,8 +609,17 @@ zlib_Decompress_flush(compobject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (!ssize_t_converter(args[0], &length)) { {
goto exit; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj);
Py_DECREF(iobj);
}
if (ival == -1 && PyErr_Occurred()) {
goto exit;
}
length = ival;
} }
skip_optional: skip_optional:
return_value = zlib_Decompress_flush_impl(self, length); return_value = zlib_Decompress_flush_impl(self, length);
@ -683,11 +665,6 @@ zlib_adler32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
value = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); value = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (value == (unsigned int)-1 && PyErr_Occurred()) { if (value == (unsigned int)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -741,11 +718,6 @@ zlib_crc32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
value = (unsigned int)PyLong_AsUnsignedLongMask(args[1]); value = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (value == (unsigned int)-1 && PyErr_Occurred()) { if (value == (unsigned int)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -785,4 +757,4 @@ exit:
#ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF #ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF #define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */ #endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
/*[clinic end generated code: output=faae38ef96b88b16 input=a9049054013a1b77]*/ /*[clinic end generated code: output=06b6438506aab0cb input=a9049054013a1b77]*/

View File

@ -111,30 +111,14 @@ static PyObject *
grp_getgrgid_impl(PyObject *module, PyObject *id) grp_getgrgid_impl(PyObject *module, PyObject *id)
/*[clinic end generated code: output=30797c289504a1ba input=15fa0e2ccf5cda25]*/ /*[clinic end generated code: output=30797c289504a1ba input=15fa0e2ccf5cda25]*/
{ {
PyObject *py_int_id, *retval = NULL; PyObject *retval = NULL;
int nomem = 0; int nomem = 0;
char *buf = NULL, *buf2 = NULL; char *buf = NULL, *buf2 = NULL;
gid_t gid; gid_t gid;
struct group *p; struct group *p;
if (!_Py_Gid_Converter(id, &gid)) { if (!_Py_Gid_Converter(id, &gid)) {
if (!PyErr_ExceptionMatches(PyExc_TypeError)) { return NULL;
return NULL;
}
PyErr_Clear();
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"group id must be int, not %.200",
Py_TYPE(id)->tp_name) < 0) {
return NULL;
}
py_int_id = PyNumber_Long(id);
if (!py_int_id)
return NULL;
if (!_Py_Gid_Converter(py_int_id, &gid)) {
Py_DECREF(py_int_id);
return NULL;
}
Py_DECREF(py_int_id);
} }
#ifdef HAVE_GETGRGID_R #ifdef HAVE_GETGRGID_R
int status; int status;

View File

@ -2047,37 +2047,9 @@ math_factorial(PyObject *module, PyObject *arg)
{ {
long x, two_valuation; long x, two_valuation;
int overflow; int overflow;
PyObject *result, *odd_part, *pyint_form; PyObject *result, *odd_part;
if (PyFloat_Check(arg)) {
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"Using factorial() with floats is deprecated",
1) < 0)
{
return NULL;
}
PyObject *lx;
double dx = PyFloat_AS_DOUBLE((PyFloatObject *)arg);
if (!(Py_IS_FINITE(dx) && dx == floor(dx))) {
PyErr_SetString(PyExc_ValueError,
"factorial() only accepts integral values");
return NULL;
}
lx = PyLong_FromDouble(dx);
if (lx == NULL)
return NULL;
x = PyLong_AsLongAndOverflow(lx, &overflow);
Py_DECREF(lx);
}
else {
pyint_form = PyNumber_Index(arg);
if (pyint_form == NULL) {
return NULL;
}
x = PyLong_AsLongAndOverflow(pyint_form, &overflow);
Py_DECREF(pyint_form);
}
x = PyLong_AsLongAndOverflow(arg, &overflow);
if (x == -1 && PyErr_Occurred()) { if (x == -1 && PyErr_Occurred()) {
return NULL; return NULL;
} }

View File

@ -13903,11 +13903,6 @@ static PyObject *
os_waitstatus_to_exitcode_impl(PyObject *module, PyObject *status_obj) os_waitstatus_to_exitcode_impl(PyObject *module, PyObject *status_obj)
/*[clinic end generated code: output=db50b1b0ba3c7153 input=7fe2d7fdaea3db42]*/ /*[clinic end generated code: output=db50b1b0ba3c7153 input=7fe2d7fdaea3db42]*/
{ {
if (PyFloat_Check(status_obj)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
return NULL;
}
#ifndef MS_WINDOWS #ifndef MS_WINDOWS
int status = _PyLong_AsInt(status_obj); int status = _PyLong_AsInt(status_obj);
if (status == -1 && PyErr_Occurred()) { if (status == -1 && PyErr_Occurred()) {

View File

@ -5196,13 +5196,6 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds)
else else
#endif #endif
{ {
if (PyFloat_Check(fdobj)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float");
return -1;
}
fd = PyLong_AsSocket_t(fdobj); fd = PyLong_AsSocket_t(fdobj);
if (fd == (SOCKET_T)(-1) && PyErr_Occurred()) if (fd == (SOCKET_T)(-1) && PyErr_Occurred())
return -1; return -1;

View File

@ -287,37 +287,6 @@ zlib_compress_impl(PyObject *module, Py_buffer *data, int level)
return NULL; return NULL;
} }
/*[python input]
class ssize_t_converter(CConverter):
type = 'Py_ssize_t'
converter = 'ssize_t_converter'
c_ignored_default = "0"
[python start generated code]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=5f34ba1b394cb8e7]*/
static int
ssize_t_converter(PyObject *obj, void *ptr)
{
PyObject *long_obj;
Py_ssize_t val;
/* XXX Should be replaced with PyNumber_AsSsize_t after the end of the
deprecation period. */
long_obj = _PyLong_FromNbIndexOrNbInt(obj);
if (long_obj == NULL) {
return 0;
}
val = PyLong_AsSsize_t(long_obj);
Py_DECREF(long_obj);
if (val == -1 && PyErr_Occurred()) {
return 0;
}
*(Py_ssize_t *)ptr = val;
return 1;
}
/*[clinic input] /*[clinic input]
zlib.decompress zlib.decompress
@ -326,7 +295,7 @@ zlib.decompress
/ /
wbits: int(c_default="MAX_WBITS") = MAX_WBITS wbits: int(c_default="MAX_WBITS") = MAX_WBITS
The window buffer size and container format. The window buffer size and container format.
bufsize: ssize_t(c_default="DEF_BUF_SIZE") = DEF_BUF_SIZE bufsize: Py_ssize_t(c_default="DEF_BUF_SIZE") = DEF_BUF_SIZE
The initial output buffer size. The initial output buffer size.
Returns a bytes object containing the uncompressed data. Returns a bytes object containing the uncompressed data.
@ -335,7 +304,7 @@ Returns a bytes object containing the uncompressed data.
static PyObject * static PyObject *
zlib_decompress_impl(PyObject *module, Py_buffer *data, int wbits, zlib_decompress_impl(PyObject *module, Py_buffer *data, int wbits,
Py_ssize_t bufsize) Py_ssize_t bufsize)
/*[clinic end generated code: output=77c7e35111dc8c42 input=21960936208e9a5b]*/ /*[clinic end generated code: output=77c7e35111dc8c42 input=a9ac17beff1f893f]*/
{ {
PyObject *RetVal = NULL; PyObject *RetVal = NULL;
Byte *ibuf; Byte *ibuf;
@ -756,7 +725,7 @@ zlib.Decompress.decompress
data: Py_buffer data: Py_buffer
The binary data to decompress. The binary data to decompress.
/ /
max_length: ssize_t = 0 max_length: Py_ssize_t = 0
The maximum allowable length of the decompressed data. The maximum allowable length of the decompressed data.
Unconsumed input data will be stored in Unconsumed input data will be stored in
the unconsumed_tail attribute. the unconsumed_tail attribute.
@ -771,7 +740,7 @@ Call the flush() method to clear these buffers.
static PyObject * static PyObject *
zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data, zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data,
Py_ssize_t max_length) Py_ssize_t max_length)
/*[clinic end generated code: output=6e5173c74e710352 input=b85a212a012b770a]*/ /*[clinic end generated code: output=6e5173c74e710352 input=0a95d05a3bceaeaa]*/
{ {
int err = Z_OK; int err = Z_OK;
Py_ssize_t ibuflen, obuflen = DEF_BUF_SIZE, hard_limit; Py_ssize_t ibuflen, obuflen = DEF_BUF_SIZE, hard_limit;
@ -1113,7 +1082,7 @@ zlib_Decompress___deepcopy__(compobject *self, PyObject *memo)
/*[clinic input] /*[clinic input]
zlib.Decompress.flush zlib.Decompress.flush
length: ssize_t(c_default="DEF_BUF_SIZE") = zlib.DEF_BUF_SIZE length: Py_ssize_t(c_default="DEF_BUF_SIZE") = zlib.DEF_BUF_SIZE
the initial size of the output buffer. the initial size of the output buffer.
/ /
@ -1122,7 +1091,7 @@ Return a bytes object containing any remaining decompressed data.
static PyObject * static PyObject *
zlib_Decompress_flush_impl(compobject *self, Py_ssize_t length) zlib_Decompress_flush_impl(compobject *self, Py_ssize_t length)
/*[clinic end generated code: output=68c75ea127cbe654 input=aa4ec37f3aef4da0]*/ /*[clinic end generated code: output=68c75ea127cbe654 input=427f2a05a8c2113a]*/
{ {
int err, flush; int err, flush;
Py_buffer data; Py_buffer data;

View File

@ -1426,14 +1426,32 @@ PyNumber_Long(PyObject *o)
} }
m = Py_TYPE(o)->tp_as_number; m = Py_TYPE(o)->tp_as_number;
if (m && m->nb_int) { /* This should include subclasses of int */ if (m && m->nb_int) { /* This should include subclasses of int */
result = _PyLong_FromNbInt(o); /* Convert using the nb_int slot, which should return something
if (result != NULL && !PyLong_CheckExact(result)) { of exact type int. */
Py_SETREF(result, _PyLong_Copy((PyLongObject *)result)); result = m->nb_int(o);
if (!result || PyLong_CheckExact(result))
return result;
if (!PyLong_Check(result)) {
PyErr_Format(PyExc_TypeError,
"__int__ returned non-int (type %.200s)",
result->ob_type->tp_name);
Py_DECREF(result);
return NULL;
} }
/* Issue #17576: warn if 'result' not of exact type int. */
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"__int__ returned non-int (type %.200s). "
"The ability to return an instance of a strict subclass of int "
"is deprecated, and may be removed in a future version of Python.",
result->ob_type->tp_name)) {
Py_DECREF(result);
return NULL;
}
Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
return result; return result;
} }
if (m && m->nb_index) { if (m && m->nb_index) {
result = _PyLong_FromNbIndexOrNbInt(o); result = PyNumber_Index(o);
if (result != NULL && !PyLong_CheckExact(result)) { if (result != NULL && !PyLong_CheckExact(result)) {
Py_SETREF(result, _PyLong_Copy((PyLongObject *)result)); Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
} }
@ -1452,8 +1470,7 @@ PyNumber_Long(PyObject *o)
} }
/* __trunc__ is specified to return an Integral type, /* __trunc__ is specified to return an Integral type,
but int() needs to return an int. */ but int() needs to return an int. */
m = Py_TYPE(result)->tp_as_number; if (!PyIndex_Check(result)) {
if (m == NULL || (m->nb_index == NULL && m->nb_int == NULL)) {
PyErr_Format( PyErr_Format(
PyExc_TypeError, PyExc_TypeError,
"__trunc__ returned non-Integral (type %.200s)", "__trunc__ returned non-Integral (type %.200s)",
@ -1461,7 +1478,7 @@ PyNumber_Long(PyObject *o)
Py_DECREF(result); Py_DECREF(result);
return NULL; return NULL;
} }
Py_SETREF(result, _PyLong_FromNbIndexOrNbInt(result)); Py_SETREF(result, PyNumber_Index(result));
if (result != NULL && !PyLong_CheckExact(result)) { if (result != NULL && !PyLong_CheckExact(result)) {
Py_SETREF(result, _PyLong_Copy((PyLongObject *)result)); Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
} }

View File

@ -268,11 +268,6 @@ bytearray_replace(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -346,11 +341,6 @@ bytearray_split(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t nargs
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -450,11 +440,6 @@ bytearray_rsplit(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t narg
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -519,11 +504,6 @@ bytearray_insert(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t narg
if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) { if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -617,11 +597,6 @@ bytearray_pop(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -896,11 +871,6 @@ bytearray_splitlines(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
keepends = _PyLong_AsInt(args[0]); keepends = _PyLong_AsInt(args[0]);
if (keepends == -1 && PyErr_Occurred()) { if (keepends == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1000,11 +970,6 @@ bytearray_hex(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t nargs,
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
bytes_per_sep = _PyLong_AsInt(args[1]); bytes_per_sep = _PyLong_AsInt(args[1]);
if (bytes_per_sep == -1 && PyErr_Occurred()) { if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1058,11 +1023,6 @@ bytearray_reduce_ex(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t n
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
proto = _PyLong_AsInt(args[0]); proto = _PyLong_AsInt(args[0]);
if (proto == -1 && PyErr_Occurred()) { if (proto == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1091,4 +1051,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{ {
return bytearray_sizeof_impl(self); return bytearray_sizeof_impl(self);
} }
/*[clinic end generated code: output=b2919f76709e48dc input=a9049054013a1b77]*/ /*[clinic end generated code: output=920748990279fb9d input=a9049054013a1b77]*/

View File

@ -46,11 +46,6 @@ bytes_split(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -202,11 +197,6 @@ bytes_rsplit(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -493,11 +483,6 @@ bytes_replace(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -715,11 +700,6 @@ bytes_splitlines(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, P
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
keepends = _PyLong_AsInt(args[0]); keepends = _PyLong_AsInt(args[0]);
if (keepends == -1 && PyErr_Occurred()) { if (keepends == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -819,11 +799,6 @@ bytes_hex(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
bytes_per_sep = _PyLong_AsInt(args[1]); bytes_per_sep = _PyLong_AsInt(args[1]);
if (bytes_per_sep == -1 && PyErr_Occurred()) { if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -834,4 +809,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=220388917d7bf751 input=a9049054013a1b77]*/ /*[clinic end generated code: output=a0c31faea2671a8c input=a9049054013a1b77]*/

View File

@ -59,11 +59,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
if (args[0]) { if (args[0]) {
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
co_argcount = _PyLong_AsInt(args[0]); co_argcount = _PyLong_AsInt(args[0]);
if (co_argcount == -1 && PyErr_Occurred()) { if (co_argcount == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -73,11 +68,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
} }
} }
if (args[1]) { if (args[1]) {
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
co_posonlyargcount = _PyLong_AsInt(args[1]); co_posonlyargcount = _PyLong_AsInt(args[1]);
if (co_posonlyargcount == -1 && PyErr_Occurred()) { if (co_posonlyargcount == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -87,11 +77,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
} }
} }
if (args[2]) { if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
co_kwonlyargcount = _PyLong_AsInt(args[2]); co_kwonlyargcount = _PyLong_AsInt(args[2]);
if (co_kwonlyargcount == -1 && PyErr_Occurred()) { if (co_kwonlyargcount == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -101,11 +86,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
} }
} }
if (args[3]) { if (args[3]) {
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
co_nlocals = _PyLong_AsInt(args[3]); co_nlocals = _PyLong_AsInt(args[3]);
if (co_nlocals == -1 && PyErr_Occurred()) { if (co_nlocals == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -115,11 +95,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
} }
} }
if (args[4]) { if (args[4]) {
if (PyFloat_Check(args[4])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
co_stacksize = _PyLong_AsInt(args[4]); co_stacksize = _PyLong_AsInt(args[4]);
if (co_stacksize == -1 && PyErr_Occurred()) { if (co_stacksize == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -129,11 +104,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
} }
} }
if (args[5]) { if (args[5]) {
if (PyFloat_Check(args[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
co_flags = _PyLong_AsInt(args[5]); co_flags = _PyLong_AsInt(args[5]);
if (co_flags == -1 && PyErr_Occurred()) { if (co_flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -143,11 +113,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
} }
} }
if (args[6]) { if (args[6]) {
if (PyFloat_Check(args[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
co_firstlineno = _PyLong_AsInt(args[6]); co_firstlineno = _PyLong_AsInt(args[6]);
if (co_firstlineno == -1 && PyErr_Occurred()) { if (co_firstlineno == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -253,4 +218,4 @@ skip_optional_kwonly:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=27fe34e82106b220 input=a9049054013a1b77]*/ /*[clinic end generated code: output=f9f23e912a3955b9 input=a9049054013a1b77]*/

View File

@ -24,11 +24,6 @@ list_insert(PyListObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) { if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -128,11 +123,6 @@ list_pop(PyListObject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -196,11 +186,6 @@ list_sort(PyListObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
reverse = _PyLong_AsInt(args[1]); reverse = _PyLong_AsInt(args[1]);
if (reverse == -1 && PyErr_Occurred()) { if (reverse == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -367,4 +352,4 @@ list___reversed__(PyListObject *self, PyObject *Py_UNUSED(ignored))
{ {
return list___reversed___impl(self); return list___reversed___impl(self);
} }
/*[clinic end generated code: output=1ff61490c091d165 input=a9049054013a1b77]*/ /*[clinic end generated code: output=137db7b11196b581 input=a9049054013a1b77]*/

View File

@ -209,11 +209,6 @@ int_to_bytes(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *
if (!args) { if (!args) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -313,4 +308,4 @@ skip_optional_kwonly:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=77bc3b2615822cb8 input=a9049054013a1b77]*/ /*[clinic end generated code: output=46d40c8aa6d420b7 input=a9049054013a1b77]*/

View File

@ -56,11 +56,6 @@ memoryview_hex(PyMemoryViewObject *self, PyObject *const *args, Py_ssize_t nargs
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
bytes_per_sep = _PyLong_AsInt(args[1]); bytes_per_sep = _PyLong_AsInt(args[1]);
if (bytes_per_sep == -1 && PyErr_Occurred()) { if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -71,4 +66,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=ee265a73f68b0077 input=a9049054013a1b77]*/ /*[clinic end generated code: output=91106ef704134b19 input=a9049054013a1b77]*/

View File

@ -166,11 +166,6 @@ object___reduce_ex__(PyObject *self, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int protocol; int protocol;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
protocol = _PyLong_AsInt(arg); protocol = _PyLong_AsInt(arg);
if (protocol == -1 && PyErr_Occurred()) { if (protocol == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -248,4 +243,4 @@ object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored))
{ {
return object___dir___impl(self); return object___dir___impl(self);
} }
/*[clinic end generated code: output=7a6d272d282308f3 input=a9049054013a1b77]*/ /*[clinic end generated code: output=b4fb62939b08baf9 input=a9049054013a1b77]*/

View File

@ -86,11 +86,6 @@ unicode_center(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("center", nargs, 1, 2)) { if (!_PyArg_CheckPositional("center", nargs, 1, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -224,11 +219,6 @@ unicode_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
tabsize = _PyLong_AsInt(args[0]); tabsize = _PyLong_AsInt(args[0]);
if (tabsize == -1 && PyErr_Occurred()) { if (tabsize == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -530,11 +520,6 @@ unicode_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) { if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -730,11 +715,6 @@ unicode_replace(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -849,11 +829,6 @@ unicode_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) { if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -923,11 +898,6 @@ unicode_split(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -1025,11 +995,6 @@ unicode_rsplit(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
goto skip_optional_pos; goto skip_optional_pos;
} }
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]); PyObject *iobj = PyNumber_Index(args[1]);
@ -1081,11 +1046,6 @@ unicode_splitlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
keepends = _PyLong_AsInt(args[0]); keepends = _PyLong_AsInt(args[0]);
if (keepends == -1 && PyErr_Occurred()) { if (keepends == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1231,11 +1191,6 @@ unicode_zfill(PyObject *self, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
Py_ssize_t width; Py_ssize_t width;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(arg); PyObject *iobj = PyNumber_Index(arg);
@ -1303,4 +1258,4 @@ unicode_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
{ {
return unicode_sizeof_impl(self); return unicode_sizeof_impl(self);
} }
/*[clinic end generated code: output=b91233f3722643be input=a9049054013a1b77]*/ /*[clinic end generated code: output=ea1aff10c743be14 input=a9049054013a1b77]*/

View File

@ -119,123 +119,6 @@ long_normalize(PyLongObject *v)
return v; return v;
} }
/* _PyLong_FromNbInt: Convert the given object to a PyLongObject
using the nb_int slot, if available. Raise TypeError if either the
nb_int slot is not available or the result of the call to nb_int
returns something not of type int.
*/
PyObject *
_PyLong_FromNbInt(PyObject *integral)
{
PyNumberMethods *nb;
PyObject *result;
/* Fast path for the case that we already have an int. */
if (PyLong_CheckExact(integral)) {
Py_INCREF(integral);
return integral;
}
nb = Py_TYPE(integral)->tp_as_number;
if (nb == NULL || nb->nb_int == NULL) {
PyErr_Format(PyExc_TypeError,
"an integer is required (got type %.200s)",
Py_TYPE(integral)->tp_name);
return NULL;
}
/* Convert using the nb_int slot, which should return something
of exact type int. */
result = nb->nb_int(integral);
if (!result || PyLong_CheckExact(result))
return result;
if (!PyLong_Check(result)) {
PyErr_Format(PyExc_TypeError,
"__int__ returned non-int (type %.200s)",
Py_TYPE(result)->tp_name);
Py_DECREF(result);
return NULL;
}
/* Issue #17576: warn if 'result' not of exact type int. */
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"__int__ returned non-int (type %.200s). "
"The ability to return an instance of a strict subclass of int "
"is deprecated, and may be removed in a future version of Python.",
Py_TYPE(result)->tp_name)) {
Py_DECREF(result);
return NULL;
}
return result;
}
/* Convert the given object to a PyLongObject using the nb_index or
nb_int slots, if available (the latter is deprecated).
Raise TypeError if either nb_index and nb_int slots are not
available or the result of the call to nb_index or nb_int
returns something not of type int.
Should be replaced with PyNumber_Index after the end of the
deprecation period.
*/
PyObject *
_PyLong_FromNbIndexOrNbInt(PyObject *integral)
{
PyNumberMethods *nb;
PyObject *result;
/* Fast path for the case that we already have an int. */
if (PyLong_CheckExact(integral)) {
Py_INCREF(integral);
return integral;
}
nb = Py_TYPE(integral)->tp_as_number;
if (nb == NULL || (nb->nb_index == NULL && nb->nb_int == NULL)) {
PyErr_Format(PyExc_TypeError,
"an integer is required (got type %.200s)",
Py_TYPE(integral)->tp_name);
return NULL;
}
if (nb->nb_index) {
/* Convert using the nb_index slot, which should return something
of exact type int. */
result = nb->nb_index(integral);
if (!result || PyLong_CheckExact(result))
return result;
if (!PyLong_Check(result)) {
PyErr_Format(PyExc_TypeError,
"__index__ returned non-int (type %.200s)",
Py_TYPE(result)->tp_name);
Py_DECREF(result);
return NULL;
}
/* Issue #17576: warn if 'result' not of exact type int. */
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"__index__ returned non-int (type %.200s). "
"The ability to return an instance of a strict subclass of int "
"is deprecated, and may be removed in a future version of Python.",
Py_TYPE(result)->tp_name))
{
Py_DECREF(result);
return NULL;
}
return result;
}
result = _PyLong_FromNbInt(integral);
if (result && PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"an integer is required (got type %.200s). "
"Implicit conversion to integers using __int__ is deprecated, "
"and may be removed in a future version of Python.",
Py_TYPE(integral)->tp_name))
{
Py_DECREF(result);
return NULL;
}
return result;
}
/* Allocate a new int object with size digits. /* Allocate a new int object with size digits.
Return NULL and set exception if we run out of memory. */ Return NULL and set exception if we run out of memory. */
@ -511,7 +394,7 @@ PyLong_AsLongAndOverflow(PyObject *vv, int *overflow)
v = (PyLongObject *)vv; v = (PyLongObject *)vv;
} }
else { else {
v = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(vv); v = (PyLongObject *)PyNumber_Index(vv);
if (v == NULL) if (v == NULL)
return -1; return -1;
do_decref = 1; do_decref = 1;
@ -791,7 +674,7 @@ PyLong_AsUnsignedLongMask(PyObject *op)
return _PyLong_AsUnsignedLongMask(op); return _PyLong_AsUnsignedLongMask(op);
} }
lo = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(op); lo = (PyLongObject *)PyNumber_Index(op);
if (lo == NULL) if (lo == NULL)
return (unsigned long)-1; return (unsigned long)-1;
@ -1249,7 +1132,7 @@ PyLong_AsLongLong(PyObject *vv)
v = (PyLongObject *)vv; v = (PyLongObject *)vv;
} }
else { else {
v = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(vv); v = (PyLongObject *)PyNumber_Index(vv);
if (v == NULL) if (v == NULL)
return -1; return -1;
do_decref = 1; do_decref = 1;
@ -1364,7 +1247,7 @@ PyLong_AsUnsignedLongLongMask(PyObject *op)
return _PyLong_AsUnsignedLongLongMask(op); return _PyLong_AsUnsignedLongLongMask(op);
} }
lo = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(op); lo = (PyLongObject *)PyNumber_Index(op);
if (lo == NULL) if (lo == NULL)
return (unsigned long long)-1; return (unsigned long long)-1;
@ -1404,7 +1287,7 @@ PyLong_AsLongLongAndOverflow(PyObject *vv, int *overflow)
v = (PyLongObject *)vv; v = (PyLongObject *)vv;
} }
else { else {
v = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(vv); v = (PyLongObject *)PyNumber_Index(vv);
if (v == NULL) if (v == NULL)
return -1; return -1;
do_decref = 1; do_decref = 1;

View File

@ -33,11 +33,6 @@ stringlib_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, Py
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
tabsize = _PyLong_AsInt(args[0]); tabsize = _PyLong_AsInt(args[0]);
if (tabsize == -1 && PyErr_Occurred()) { if (tabsize == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -73,11 +68,6 @@ stringlib_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) { if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -134,11 +124,6 @@ stringlib_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) { if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -195,11 +180,6 @@ stringlib_center(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("center", nargs, 1, 2)) { if (!_PyArg_CheckPositional("center", nargs, 1, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]); PyObject *iobj = PyNumber_Index(args[0]);
@ -252,11 +232,6 @@ stringlib_zfill(PyObject *self, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
Py_ssize_t width; Py_ssize_t width;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(arg); PyObject *iobj = PyNumber_Index(arg);
@ -274,4 +249,4 @@ stringlib_zfill(PyObject *self, PyObject *arg)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=15be047aef999b4e input=a9049054013a1b77]*/ /*[clinic end generated code: output=cd5ecdbf1d9e849a input=a9049054013a1b77]*/

View File

@ -53,29 +53,14 @@ msvcrt_locking(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("locking", nargs, 3, 3)) { if (!_PyArg_CheckPositional("locking", nargs, 3, 3)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(args[0]); fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) { if (fd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(args[1]); mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) { if (mode == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
nbytes = PyLong_AsLong(args[2]); nbytes = PyLong_AsLong(args[2]);
if (nbytes == -1 && PyErr_Occurred()) { if (nbytes == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -114,20 +99,10 @@ msvcrt_setmode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("setmode", nargs, 2, 2)) { if (!_PyArg_CheckPositional("setmode", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(args[0]); fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) { if (fd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[1]); flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) { if (flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -201,11 +176,6 @@ msvcrt_get_osfhandle(PyObject *module, PyObject *arg)
int fd; int fd;
void *_return_value; void *_return_value;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
fd = _PyLong_AsInt(arg); fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) { if (fd == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -561,20 +531,10 @@ msvcrt_CrtSetReportMode(PyObject *module, PyObject *const *args, Py_ssize_t narg
if (!_PyArg_CheckPositional("CrtSetReportMode", nargs, 2, 2)) { if (!_PyArg_CheckPositional("CrtSetReportMode", nargs, 2, 2)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
type = _PyLong_AsInt(args[0]); type = _PyLong_AsInt(args[0]);
if (type == -1 && PyErr_Occurred()) { if (type == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(args[1]); mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) { if (mode == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -614,11 +574,6 @@ msvcrt_set_error_mode(PyObject *module, PyObject *arg)
int mode; int mode;
long _return_value; long _return_value;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = _PyLong_AsInt(arg); mode = _PyLong_AsInt(arg);
if (mode == -1 && PyErr_Occurred()) { if (mode == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -653,11 +608,6 @@ msvcrt_SetErrorMode(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
unsigned int mode; unsigned int mode;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
mode = (unsigned int)PyLong_AsUnsignedLongMask(arg); mode = (unsigned int)PyLong_AsUnsignedLongMask(arg);
if (mode == (unsigned int)-1 && PyErr_Occurred()) { if (mode == (unsigned int)-1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -679,4 +629,4 @@ exit:
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF #ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
#define MSVCRT_SET_ERROR_MODE_METHODDEF #define MSVCRT_SET_ERROR_MODE_METHODDEF
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */ #endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
/*[clinic end generated code: output=7cc6ffaf64f268f7 input=a9049054013a1b77]*/ /*[clinic end generated code: output=ab3b5ce5c1447f0e input=a9049054013a1b77]*/

12
PC/clinic/winreg.c.h generated
View File

@ -435,11 +435,6 @@ winreg_EnumKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!clinic_HKEY_converter(args[0], &key)) { if (!clinic_HKEY_converter(args[0], &key)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
index = _PyLong_AsInt(args[1]); index = _PyLong_AsInt(args[1]);
if (index == -1 && PyErr_Occurred()) { if (index == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -493,11 +488,6 @@ winreg_EnumValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!clinic_HKEY_converter(args[0], &key)) { if (!clinic_HKEY_converter(args[0], &key)) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
index = _PyLong_AsInt(args[1]); index = _PyLong_AsInt(args[1]);
if (index == -1 && PyErr_Occurred()) { if (index == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -1121,4 +1111,4 @@ winreg_QueryReflectionKey(PyObject *module, PyObject *arg)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=015afbbd690eb59d input=a9049054013a1b77]*/ /*[clinic end generated code: output=f4f996d40d06f14c input=a9049054013a1b77]*/

22
PC/clinic/winsound.c.h generated
View File

@ -34,11 +34,6 @@ winsound_PlaySound(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
goto exit; goto exit;
} }
sound = args[0]; sound = args[0];
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[1]); flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) { if (flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -81,20 +76,10 @@ winsound_Beep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
if (!args) { if (!args) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
frequency = _PyLong_AsInt(args[0]); frequency = _PyLong_AsInt(args[0]);
if (frequency == -1 && PyErr_Occurred()) { if (frequency == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
duration = _PyLong_AsInt(args[1]); duration = _PyLong_AsInt(args[1]);
if (duration == -1 && PyErr_Occurred()) { if (duration == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -136,11 +121,6 @@ winsound_MessageBeep(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
if (!noptargs) { if (!noptargs) {
goto skip_optional_pos; goto skip_optional_pos;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
type = _PyLong_AsInt(args[0]); type = _PyLong_AsInt(args[0]);
if (type == -1 && PyErr_Occurred()) { if (type == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -151,4 +131,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=28d1cd033282723d input=a9049054013a1b77]*/ /*[clinic end generated code: output=16b3c1a96861cd3a input=a9049054013a1b77]*/

View File

@ -43,11 +43,6 @@ warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
} }
} }
if (args[2]) { if (args[2]) {
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
{ {
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]); PyObject *iobj = PyNumber_Index(args[2]);
@ -71,4 +66,4 @@ skip_optional_pos:
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=b7bb54c73b5433ec input=a9049054013a1b77]*/ /*[clinic end generated code: output=484e5ffe94edf0f0 input=a9049054013a1b77]*/

View File

@ -134,11 +134,6 @@ builtin_chr(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int i; int i;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
i = _PyLong_AsInt(arg); i = _PyLong_AsInt(arg);
if (i == -1 && PyErr_Occurred()) { if (i == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -216,11 +211,6 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos; goto skip_optional_pos;
} }
if (args[3]) { if (args[3]) {
if (PyFloat_Check(args[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flags = _PyLong_AsInt(args[3]); flags = _PyLong_AsInt(args[3]);
if (flags == -1 && PyErr_Occurred()) { if (flags == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -230,11 +220,6 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
} }
} }
if (args[4]) { if (args[4]) {
if (PyFloat_Check(args[4])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
dont_inherit = _PyLong_AsInt(args[4]); dont_inherit = _PyLong_AsInt(args[4]);
if (dont_inherit == -1 && PyErr_Occurred()) { if (dont_inherit == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -244,11 +229,6 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
} }
} }
if (args[5]) { if (args[5]) {
if (PyFloat_Check(args[5])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
optimize = _PyLong_AsInt(args[5]); optimize = _PyLong_AsInt(args[5]);
if (optimize == -1 && PyErr_Occurred()) { if (optimize == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -261,11 +241,6 @@ skip_optional_pos:
if (!noptargs) { if (!noptargs) {
goto skip_optional_kwonly; goto skip_optional_kwonly;
} }
if (PyFloat_Check(args[6])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
feature_version = _PyLong_AsInt(args[6]); feature_version = _PyLong_AsInt(args[6]);
if (feature_version == -1 && PyErr_Occurred()) { if (feature_version == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -855,4 +830,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=29686a89b739d600 input=a9049054013a1b77]*/ /*[clinic end generated code: output=780fd9712ec6a6db input=a9049054013a1b77]*/

View File

@ -420,11 +420,6 @@ _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
if (!args) { if (!args) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
key = PyLong_AsLong(args[0]); key = PyLong_AsLong(args[0]);
if (key == -1 && PyErr_Occurred()) { if (key == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -454,4 +449,4 @@ exit:
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF #ifndef _IMP_EXEC_DYNAMIC_METHODDEF
#define _IMP_EXEC_DYNAMIC_METHODDEF #define _IMP_EXEC_DYNAMIC_METHODDEF
#endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */
/*[clinic end generated code: output=3dc495e9c64d944e input=a9049054013a1b77]*/ /*[clinic end generated code: output=7c31c433af88af6b input=a9049054013a1b77]*/

View File

@ -42,11 +42,6 @@ marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) { if (nargs < 3) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
version = _PyLong_AsInt(args[2]); version = _PyLong_AsInt(args[2]);
if (version == -1 && PyErr_Occurred()) { if (version == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -111,11 +106,6 @@ marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) { if (nargs < 2) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[1])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
version = _PyLong_AsInt(args[1]); version = _PyLong_AsInt(args[1]);
if (version == -1 && PyErr_Occurred()) { if (version == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -165,4 +155,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=a859dabe8b0afeb6 input=a9049054013a1b77]*/ /*[clinic end generated code: output=68b78f38bfe0c06d input=a9049054013a1b77]*/

View File

@ -372,11 +372,6 @@ sys_setrecursionlimit(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int new_limit; int new_limit;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
new_limit = _PyLong_AsInt(arg); new_limit = _PyLong_AsInt(arg);
if (new_limit == -1 && PyErr_Occurred()) { if (new_limit == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -417,11 +412,6 @@ sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args,
if (!args) { if (!args) {
goto exit; goto exit;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
depth = _PyLong_AsInt(args[0]); depth = _PyLong_AsInt(args[0]);
if (depth == -1 && PyErr_Occurred()) { if (depth == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -590,11 +580,6 @@ sys_setdlopenflags(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int new_val; int new_val;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
new_val = _PyLong_AsInt(arg); new_val = _PyLong_AsInt(arg);
if (new_val == -1 && PyErr_Occurred()) { if (new_val == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -650,11 +635,6 @@ sys_mdebug(PyObject *module, PyObject *arg)
PyObject *return_value = NULL; PyObject *return_value = NULL;
int flag; int flag;
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
flag = _PyLong_AsInt(arg); flag = _PyLong_AsInt(arg);
if (flag == -1 && PyErr_Occurred()) { if (flag == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -790,11 +770,6 @@ sys__getframe(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) { if (nargs < 1) {
goto skip_optional; goto skip_optional;
} }
if (PyFloat_Check(args[0])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
depth = _PyLong_AsInt(args[0]); depth = _PyLong_AsInt(args[0]);
if (depth == -1 && PyErr_Occurred()) { if (depth == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -970,4 +945,4 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF #ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
#define SYS_GETANDROIDAPILEVEL_METHODDEF #define SYS_GETANDROIDAPILEVEL_METHODDEF
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */ #endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
/*[clinic end generated code: output=39eb34a01fb9a919 input=a9049054013a1b77]*/ /*[clinic end generated code: output=87baa3357293ea65 input=a9049054013a1b77]*/

View File

@ -36,20 +36,10 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
goto exit; goto exit;
} }
tb_frame = (PyFrameObject *)fastargs[1]; tb_frame = (PyFrameObject *)fastargs[1];
if (PyFloat_Check(fastargs[2])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
tb_lasti = _PyLong_AsInt(fastargs[2]); tb_lasti = _PyLong_AsInt(fastargs[2]);
if (tb_lasti == -1 && PyErr_Occurred()) { if (tb_lasti == -1 && PyErr_Occurred()) {
goto exit; goto exit;
} }
if (PyFloat_Check(fastargs[3])) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}
tb_lineno = _PyLong_AsInt(fastargs[3]); tb_lineno = _PyLong_AsInt(fastargs[3]);
if (tb_lineno == -1 && PyErr_Occurred()) { if (tb_lineno == -1 && PyErr_Occurred()) {
goto exit; goto exit;
@ -59,4 +49,4 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: output=3def6c06248feed8 input=a9049054013a1b77]*/ /*[clinic end generated code: output=403778d7af5ebef9 input=a9049054013a1b77]*/

View File

@ -643,22 +643,6 @@ converterr(const char *expected, PyObject *arg, char *msgbuf, size_t bufsize)
#define CONV_UNICODE "(unicode conversion error)" #define CONV_UNICODE "(unicode conversion error)"
/* Explicitly check for float arguments when integers are expected.
Return 1 for error, 0 if ok.
XXX Should be removed after the end of the deprecation period in
_PyLong_FromNbIndexOrNbInt. */
static int
float_argument_error(PyObject *arg)
{
if (PyFloat_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
return 1;
}
else
return 0;
}
/* Convert a non-tuple argument. Return NULL if conversion went OK, /* Convert a non-tuple argument. Return NULL if conversion went OK,
or a string with a message describing the failure. The message is or a string with a message describing the failure. The message is
formatted as "must be <desired type>, not <actual type>". formatted as "must be <desired type>, not <actual type>".
@ -704,10 +688,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'b': { /* unsigned byte -- very short int */ case 'b': { /* unsigned byte -- very short int */
char *p = va_arg(*p_va, char *); char *p = va_arg(*p_va, char *);
long ival; long ival = PyLong_AsLong(arg);
if (float_argument_error(arg))
RETURN_ERR_OCCURRED;
ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED; RETURN_ERR_OCCURRED;
else if (ival < 0) { else if (ival < 0) {
@ -728,11 +709,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'B': {/* byte sized bitfield - both signed and unsigned case 'B': {/* byte sized bitfield - both signed and unsigned
values allowed */ values allowed */
char *p = va_arg(*p_va, char *); char *p = va_arg(*p_va, char *);
long ival; unsigned long ival = PyLong_AsUnsignedLongMask(arg);
if (float_argument_error(arg)) if (ival == (unsigned long)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
ival = PyLong_AsUnsignedLongMask(arg);
if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED; RETURN_ERR_OCCURRED;
else else
*p = (unsigned char) ival; *p = (unsigned char) ival;
@ -741,10 +719,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'h': {/* signed short int */ case 'h': {/* signed short int */
short *p = va_arg(*p_va, short *); short *p = va_arg(*p_va, short *);
long ival; long ival = PyLong_AsLong(arg);
if (float_argument_error(arg))
RETURN_ERR_OCCURRED;
ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED; RETURN_ERR_OCCURRED;
else if (ival < SHRT_MIN) { else if (ival < SHRT_MIN) {
@ -765,11 +740,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'H': { /* short int sized bitfield, both signed and case 'H': { /* short int sized bitfield, both signed and
unsigned allowed */ unsigned allowed */
unsigned short *p = va_arg(*p_va, unsigned short *); unsigned short *p = va_arg(*p_va, unsigned short *);
long ival; unsigned long ival = PyLong_AsUnsignedLongMask(arg);
if (float_argument_error(arg)) if (ival == (unsigned long)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
ival = PyLong_AsUnsignedLongMask(arg);
if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED; RETURN_ERR_OCCURRED;
else else
*p = (unsigned short) ival; *p = (unsigned short) ival;
@ -778,10 +750,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'i': {/* signed int */ case 'i': {/* signed int */
int *p = va_arg(*p_va, int *); int *p = va_arg(*p_va, int *);
long ival; long ival = PyLong_AsLong(arg);
if (float_argument_error(arg))
RETURN_ERR_OCCURRED;
ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED; RETURN_ERR_OCCURRED;
else if (ival > INT_MAX) { else if (ival > INT_MAX) {
@ -802,14 +771,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'I': { /* int sized bitfield, both signed and case 'I': { /* int sized bitfield, both signed and
unsigned allowed */ unsigned allowed */
unsigned int *p = va_arg(*p_va, unsigned int *); unsigned int *p = va_arg(*p_va, unsigned int *);
unsigned int ival; unsigned long ival = PyLong_AsUnsignedLongMask(arg);
if (float_argument_error(arg)) if (ival == (unsigned long)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
ival = (unsigned int)PyLong_AsUnsignedLongMask(arg);
if (ival == (unsigned int)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED; RETURN_ERR_OCCURRED;
else else
*p = ival; *p = (unsigned int) ival;
break; break;
} }
@ -818,8 +784,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
PyObject *iobj; PyObject *iobj;
Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *); Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *);
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
if (float_argument_error(arg))
RETURN_ERR_OCCURRED;
iobj = PyNumber_Index(arg); iobj = PyNumber_Index(arg);
if (iobj != NULL) { if (iobj != NULL) {
ival = PyLong_AsSsize_t(iobj); ival = PyLong_AsSsize_t(iobj);
@ -832,10 +796,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
} }
case 'l': {/* long int */ case 'l': {/* long int */
long *p = va_arg(*p_va, long *); long *p = va_arg(*p_va, long *);
long ival; long ival = PyLong_AsLong(arg);
if (float_argument_error(arg))
RETURN_ERR_OCCURRED;
ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED; RETURN_ERR_OCCURRED;
else else
@ -856,10 +817,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'L': {/* long long */ case 'L': {/* long long */
long long *p = va_arg( *p_va, long long * ); long long *p = va_arg( *p_va, long long * );
long long ival; long long ival = PyLong_AsLongLong(arg);
if (float_argument_error(arg))
RETURN_ERR_OCCURRED;
ival = PyLong_AsLongLong(arg);
if (ival == (long long)-1 && PyErr_Occurred()) if (ival == (long long)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED; RETURN_ERR_OCCURRED;
else else

View File

@ -2736,11 +2736,6 @@ class bool_converter(CConverter):
# XXX PyFloat_Check can be removed after the end of the # XXX PyFloat_Check can be removed after the end of the
# deprecation in _PyLong_FromNbIndexOrNbInt. # deprecation in _PyLong_FromNbIndexOrNbInt.
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{paramname} = _PyLong_AsInt({argname}); {paramname} = _PyLong_AsInt({argname});
if ({paramname} == -1 && PyErr_Occurred()) {{{{ if ({paramname} == -1 && PyErr_Occurred()) {{{{
goto exit; goto exit;
@ -2821,11 +2816,6 @@ class unsigned_char_converter(CConverter):
def parse_arg(self, argname, displayname): def parse_arg(self, argname, displayname):
if self.format_unit == 'b': if self.format_unit == 'b':
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{{{{ {{{{
long ival = PyLong_AsLong({argname}); long ival = PyLong_AsLong({argname});
if (ival == -1 && PyErr_Occurred()) {{{{ if (ival == -1 && PyErr_Occurred()) {{{{
@ -2848,14 +2838,9 @@ class unsigned_char_converter(CConverter):
""".format(argname=argname, paramname=self.name) """.format(argname=argname, paramname=self.name)
elif self.format_unit == 'B': elif self.format_unit == 'B':
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{{{{ {{{{
long ival = PyLong_AsUnsignedLongMask({argname}); unsigned long ival = PyLong_AsUnsignedLongMask({argname});
if (ival == -1 && PyErr_Occurred()) {{{{ if (ival == (unsigned long)-1 && PyErr_Occurred()) {{{{
goto exit; goto exit;
}}}} }}}}
else {{{{ else {{{{
@ -2876,11 +2861,6 @@ class short_converter(CConverter):
def parse_arg(self, argname, displayname): def parse_arg(self, argname, displayname):
if self.format_unit == 'h': if self.format_unit == 'h':
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{{{{ {{{{
long ival = PyLong_AsLong({argname}); long ival = PyLong_AsLong({argname});
if (ival == -1 && PyErr_Occurred()) {{{{ if (ival == -1 && PyErr_Occurred()) {{{{
@ -2917,11 +2897,6 @@ class unsigned_short_converter(CConverter):
def parse_arg(self, argname, displayname): def parse_arg(self, argname, displayname):
if self.format_unit == 'H': if self.format_unit == 'H':
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{paramname} = (unsigned short)PyLong_AsUnsignedLongMask({argname}); {paramname} = (unsigned short)PyLong_AsUnsignedLongMask({argname});
if ({paramname} == (unsigned short)-1 && PyErr_Occurred()) {{{{ if ({paramname} == (unsigned short)-1 && PyErr_Occurred()) {{{{
goto exit; goto exit;
@ -2947,11 +2922,6 @@ class int_converter(CConverter):
def parse_arg(self, argname, displayname): def parse_arg(self, argname, displayname):
if self.format_unit == 'i': if self.format_unit == 'i':
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{paramname} = _PyLong_AsInt({argname}); {paramname} = _PyLong_AsInt({argname});
if ({paramname} == -1 && PyErr_Occurred()) {{{{ if ({paramname} == -1 && PyErr_Occurred()) {{{{
goto exit; goto exit;
@ -2989,11 +2959,6 @@ class unsigned_int_converter(CConverter):
def parse_arg(self, argname, displayname): def parse_arg(self, argname, displayname):
if self.format_unit == 'I': if self.format_unit == 'I':
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{paramname} = (unsigned int)PyLong_AsUnsignedLongMask({argname}); {paramname} = (unsigned int)PyLong_AsUnsignedLongMask({argname});
if ({paramname} == (unsigned int)-1 && PyErr_Occurred()) {{{{ if ({paramname} == (unsigned int)-1 && PyErr_Occurred()) {{{{
goto exit; goto exit;
@ -3010,11 +2975,6 @@ class long_converter(CConverter):
def parse_arg(self, argname, displayname): def parse_arg(self, argname, displayname):
if self.format_unit == 'l': if self.format_unit == 'l':
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{paramname} = PyLong_AsLong({argname}); {paramname} = PyLong_AsLong({argname});
if ({paramname} == -1 && PyErr_Occurred()) {{{{ if ({paramname} == -1 && PyErr_Occurred()) {{{{
goto exit; goto exit;
@ -3054,11 +3014,6 @@ class long_long_converter(CConverter):
def parse_arg(self, argname, displayname): def parse_arg(self, argname, displayname):
if self.format_unit == 'L': if self.format_unit == 'L':
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{paramname} = PyLong_AsLongLong({argname}); {paramname} = PyLong_AsLongLong({argname});
if ({paramname} == -1 && PyErr_Occurred()) {{{{ if ({paramname} == -1 && PyErr_Occurred()) {{{{
goto exit; goto exit;
@ -3105,11 +3060,6 @@ class Py_ssize_t_converter(CConverter):
def parse_arg(self, argname, displayname): def parse_arg(self, argname, displayname):
if self.format_unit == 'n': if self.format_unit == 'n':
return """ return """
if (PyFloat_Check({argname})) {{{{
PyErr_SetString(PyExc_TypeError,
"integer argument expected, got float" );
goto exit;
}}}}
{{{{ {{{{
Py_ssize_t ival = -1; Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index({argname}); PyObject *iobj = PyNumber_Index({argname});