summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-05-26 15:43:38 (GMT)
committerGitHub <noreply@github.com>2020-05-26 15:43:38 (GMT)
commit578c3955e0222ec7b3146197467fbb0fcfae12fe (patch)
tree1314ca1eb6153feaf3fb1cae341784270ce24c32
parent8ad052464a4e0aef9a11663b80f187087b773592 (diff)
downloadcpython-578c3955e0222ec7b3146197467fbb0fcfae12fe.zip
cpython-578c3955e0222ec7b3146197467fbb0fcfae12fe.tar.gz
cpython-578c3955e0222ec7b3146197467fbb0fcfae12fe.tar.bz2
bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)
Only __index__ should be used to make integer conversions lossless.
-rw-r--r--Doc/whatsnew/3.10.rst6
-rw-r--r--Include/longobject.h17
-rw-r--r--Lib/ctypes/test/test_numbers.py3
-rw-r--r--Lib/datetime.py51
-rw-r--r--Lib/test/clinic.test92
-rw-r--r--Lib/test/datetimetester.py46
-rw-r--r--Lib/test/test_getargs2.py48
-rw-r--r--Lib/test/test_grp.py4
-rw-r--r--Lib/test/test_int.py5
-rw-r--r--Lib/test/test_math.py15
-rwxr-xr-xLib/test/test_socket.py6
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2019-09-01-14-26-02.bpo-37999.XPl6dn.rst5
-rw-r--r--Modules/_blake2/clinic/blake2b_impl.c.h27
-rw-r--r--Modules/_blake2/clinic/blake2s_impl.c.h27
-rw-r--r--Modules/_ctypes/cfield.c34
-rw-r--r--Modules/_io/clinic/_iomodule.c.h12
-rw-r--r--Modules/_io/clinic/bufferedio.c.h37
-rw-r--r--Modules/_io/clinic/bytesio.c.h12
-rw-r--r--Modules/_io/clinic/fileio.c.h12
-rw-r--r--Modules/_io/clinic/iobase.c.h7
-rw-r--r--Modules/_io/clinic/stringio.c.h12
-rw-r--r--Modules/_io/clinic/textio.c.h32
-rw-r--r--Modules/_io/clinic/winconsoleio.c.h7
-rw-r--r--Modules/_io/fileio.c10
-rw-r--r--Modules/_io/winconsoleio.c6
-rw-r--r--Modules/_multiprocessing/clinic/posixshmem.c.h12
-rw-r--r--Modules/arraymodule.c17
-rw-r--r--Modules/cjkcodecs/clinic/multibytecodec.c.h12
-rw-r--r--Modules/clinic/_bisectmodule.c.h22
-rw-r--r--Modules/clinic/_bz2module.c.h12
-rw-r--r--Modules/clinic/_codecsmodule.c.h97
-rw-r--r--Modules/clinic/_collectionsmodule.c.h7
-rw-r--r--Modules/clinic/_curses_panel.c.h12
-rw-r--r--Modules/clinic/_cursesmodule.c.h287
-rw-r--r--Modules/clinic/_datetimemodule.c.h17
-rw-r--r--Modules/clinic/_dbmmodule.c.h7
-rw-r--r--Modules/clinic/_elementtree.c.h7
-rw-r--r--Modules/clinic/_gdbmmodule.c.h7
-rw-r--r--Modules/clinic/_hashopenssl.c.h27
-rw-r--r--Modules/clinic/_lzmamodule.c.h17
-rw-r--r--Modules/clinic/_opcode.c.h7
-rw-r--r--Modules/clinic/_operator.c.h7
-rw-r--r--Modules/clinic/_randommodule.c.h7
-rw-r--r--Modules/clinic/_sre.c.h107
-rw-r--r--Modules/clinic/_ssl.c.h37
-rw-r--r--Modules/clinic/_struct.c.h12
-rw-r--r--Modules/clinic/_tkinter.c.h47
-rw-r--r--Modules/clinic/_tracemalloc.c.h7
-rw-r--r--Modules/clinic/arraymodule.c.h22
-rw-r--r--Modules/clinic/audioop.c.h162
-rw-r--r--Modules/clinic/binascii.c.h52
-rw-r--r--Modules/clinic/fcntlmodule.c.h27
-rw-r--r--Modules/clinic/gcmodule.c.h12
-rw-r--r--Modules/clinic/itertoolsmodule.c.h17
-rw-r--r--Modules/clinic/posixmodule.c.h522
-rw-r--r--Modules/clinic/pyexpat.c.h17
-rw-r--r--Modules/clinic/resource.c.h17
-rw-r--r--Modules/clinic/selectmodule.c.h42
-rw-r--r--Modules/clinic/signalmodule.c.h72
-rw-r--r--Modules/clinic/zlibmodule.c.h96
-rw-r--r--Modules/grpmodule.c20
-rw-r--r--Modules/mathmodule.c32
-rw-r--r--Modules/posixmodule.c5
-rw-r--r--Modules/socketmodule.c7
-rw-r--r--Modules/zlibmodule.c43
-rw-r--r--Objects/abstract.c31
-rw-r--r--Objects/clinic/bytearrayobject.c.h42
-rw-r--r--Objects/clinic/bytesobject.c.h27
-rw-r--r--Objects/clinic/codeobject.c.h37
-rw-r--r--Objects/clinic/listobject.c.h17
-rw-r--r--Objects/clinic/longobject.c.h7
-rw-r--r--Objects/clinic/memoryobject.c.h7
-rw-r--r--Objects/clinic/typeobject.c.h7
-rw-r--r--Objects/clinic/unicodeobject.c.h47
-rw-r--r--Objects/longobject.c127
-rw-r--r--Objects/stringlib/clinic/transmogrify.h.h27
-rw-r--r--PC/clinic/msvcrtmodule.c.h52
-rw-r--r--PC/clinic/winreg.c.h12
-rw-r--r--PC/clinic/winsound.c.h22
-rw-r--r--Python/clinic/_warnings.c.h7
-rw-r--r--Python/clinic/bltinmodule.c.h27
-rw-r--r--Python/clinic/import.c.h7
-rw-r--r--Python/clinic/marshal.c.h12
-rw-r--r--Python/clinic/sysmodule.c.h27
-rw-r--r--Python/clinic/traceback.c.h12
-rw-r--r--Python/getargs.c66
-rwxr-xr-xTools/clinic/clinic.py54
87 files changed, 226 insertions, 2937 deletions
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index 98a231f..fabd9a2 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -75,6 +75,12 @@ New Features
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
diff --git a/Include/longobject.h b/Include/longobject.h
index 1b28809..dad08c2 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -173,23 +173,6 @@ PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
unsigned char* bytes, size_t n,
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,
appending a base prefix of 0[box] if base is 2, 8 or 16. */
PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *obj, int base);
diff --git a/Lib/ctypes/test/test_numbers.py b/Lib/ctypes/test/test_numbers.py
index c6d843b..db500e8 100644
--- a/Lib/ctypes/test/test_numbers.py
+++ b/Lib/ctypes/test/test_numbers.py
@@ -134,8 +134,7 @@ class NumberTestCase(unittest.TestCase):
for t in signed_types + unsigned_types:
self.assertRaises(TypeError, t, 3.14)
self.assertRaises(TypeError, t, f)
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(t(d).value, 2)
+ self.assertRaises(TypeError, t, d)
self.assertEqual(t(i).value, 2)
def test_sizes(self):
diff --git a/Lib/datetime.py b/Lib/datetime.py
index 952aebf..3090978 100644
--- a/Lib/datetime.py
+++ b/Lib/datetime.py
@@ -11,6 +11,7 @@ __all__ = ("date", "datetime", "time", "timedelta", "timezone", "tzinfo",
import time as _time
import math as _math
import sys
+from operator import index as _index
def _cmp(x, y):
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)" %
(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):
- year = _check_int_field(year)
- month = _check_int_field(month)
- day = _check_int_field(day)
+ year = _index(year)
+ month = _index(month)
+ day = _index(day)
if not MINYEAR <= year <= MAXYEAR:
raise ValueError('year must be in %d..%d' % (MINYEAR, MAXYEAR), year)
if not 1 <= month <= 12:
@@ -426,10 +395,10 @@ def _check_date_fields(year, month, day):
return year, month, day
def _check_time_fields(hour, minute, second, microsecond, fold):
- hour = _check_int_field(hour)
- minute = _check_int_field(minute)
- second = _check_int_field(second)
- microsecond = _check_int_field(microsecond)
+ hour = _index(hour)
+ minute = _index(minute)
+ second = _index(second)
+ microsecond = _index(microsecond)
if not 0 <= hour <= 23:
raise ValueError('hour must be in 0..23', hour)
if not 0 <= minute <= 59:
@@ -2539,10 +2508,10 @@ else:
# Clean up unused names
del (_DAYNAMES, _DAYS_BEFORE_MONTH, _DAYS_IN_MONTH, _DI100Y, _DI400Y,
_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,
_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,
_divide_and_round, _parse_isoformat_date, _parse_isoformat_time,
_parse_hh_mm_ss_ff, _IsoCalendarDate)
diff --git a/Lib/test/clinic.test b/Lib/test/clinic.test
index cb76c37..5e6f129 100644
--- a/Lib/test/clinic.test
+++ b/Lib/test/clinic.test
@@ -418,11 +418,6 @@ test_bool_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
c = _PyLong_AsInt(args[2]);
if (c == -1 && PyErr_Occurred()) {
goto exit;
@@ -436,7 +431,7 @@ exit:
static PyObject *
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]
@@ -729,11 +724,6 @@ test_unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t
if (nargs < 1) {
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]);
if (ival == -1 && PyErr_Occurred()) {
@@ -756,11 +746,6 @@ test_unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t
if (nargs < 2) {
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]);
if (ival == -1 && PyErr_Occurred()) {
@@ -783,14 +768,9 @@ test_unsigned_char_converter(PyObject *module, PyObject *const *args, Py_ssize_t
if (nargs < 3) {
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]);
- if (ival == -1 && PyErr_Occurred()) {
+ unsigned long ival = PyLong_AsUnsignedLongMask(args[2]);
+ if (ival == (unsigned long)-1 && PyErr_Occurred()) {
goto exit;
}
else {
@@ -807,7 +787,7 @@ exit:
static PyObject *
test_unsigned_char_converter_impl(PyObject *module, unsigned char a,
unsigned char b, unsigned char c)
-/*[clinic end generated code: output=ebf905c5c9414762 input=021414060993e289]*/
+/*[clinic end generated code: output=c0a6ab3144481466 input=021414060993e289]*/
/*[clinic input]
@@ -841,11 +821,6 @@ test_short_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
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]);
if (ival == -1 && PyErr_Occurred()) {
@@ -874,7 +849,7 @@ exit:
static PyObject *
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]
@@ -925,11 +900,6 @@ test_unsigned_short_converter(PyObject *module, PyObject *const *args, Py_ssize_
if (nargs < 3) {
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]);
if (c == (unsigned short)-1 && PyErr_Occurred()) {
goto exit;
@@ -944,7 +914,7 @@ exit:
static PyObject *
test_unsigned_short_converter_impl(PyObject *module, unsigned short a,
unsigned short b, unsigned short c)
-/*[clinic end generated code: output=3779fe104319e3ae input=cdfd8eff3d9176b4]*/
+/*[clinic end generated code: output=576b5ce48424f351 input=cdfd8eff3d9176b4]*/
/*[clinic input]
@@ -984,11 +954,6 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
a = _PyLong_AsInt(args[0]);
if (a == -1 && PyErr_Occurred()) {
goto exit;
@@ -996,11 +961,6 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
b = _PyLong_AsInt(args[1]);
if (b == -1 && PyErr_Occurred()) {
goto exit;
@@ -1023,11 +983,6 @@ test_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 4) {
goto skip_optional;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
d = _PyLong_AsInt(args[3]);
if (d == -1 && PyErr_Occurred()) {
goto exit;
@@ -1041,7 +996,7 @@ exit:
static PyObject *
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]
@@ -1092,11 +1047,6 @@ test_unsigned_int_converter(PyObject *module, PyObject *const *args, Py_ssize_t
if (nargs < 3) {
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]);
if (c == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -1111,7 +1061,7 @@ exit:
static PyObject *
test_unsigned_int_converter_impl(PyObject *module, unsigned int a,
unsigned int b, unsigned int c)
-/*[clinic end generated code: output=189176ce67c7d2e7 input=5533534828b62fc0]*/
+/*[clinic end generated code: output=4f53904bfa1a0250 input=5533534828b62fc0]*/
/*[clinic input]
@@ -1145,11 +1095,6 @@ test_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
a = PyLong_AsLong(args[0]);
if (a == -1 && PyErr_Occurred()) {
goto exit;
@@ -1163,7 +1108,7 @@ exit:
static PyObject *
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]
@@ -1263,11 +1208,6 @@ test_long_long_converter(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
a = PyLong_AsLongLong(args[0]);
if (a == -1 && PyErr_Occurred()) {
goto exit;
@@ -1281,7 +1221,7 @@ exit:
static PyObject *
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]
@@ -1390,11 +1330,6 @@ test_Py_ssize_t_converter(PyObject *module, PyObject *const *args, Py_ssize_t na
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
@@ -1443,7 +1373,7 @@ exit:
static PyObject *
test_Py_ssize_t_converter_impl(PyObject *module, Py_ssize_t a, Py_ssize_t b,
Py_ssize_t c)
-/*[clinic end generated code: output=a46d2aaf40c10398 input=3855f184bb3f299d]*/
+/*[clinic end generated code: output=ea781bb7169b3436 input=3855f184bb3f299d]*/
/*[clinic input]
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index a9741d6..520a51d 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -5107,43 +5107,21 @@ class Oddballs(unittest.TestCase):
def __int__(self):
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):
pass
- s10 = Float(10.9)
- with self.assertRaisesRegex(TypeError, '^integer argument expected, '
- 'got float$'):
- datetime(10, 10, s10)
- with self.assertRaises(TypeError):
- datetime(10., 10, 10)
- with self.assertRaises(TypeError):
- datetime(10, 10., 10)
- with self.assertRaises(TypeError):
- datetime(10, 10, 10.)
- with self.assertRaises(TypeError):
- datetime(10, 10, 10, 10.)
- with self.assertRaises(TypeError):
- datetime(10, 10, 10, 10, 10.)
- with self.assertRaises(TypeError):
- datetime(10, 10, 10, 10, 10, 10.)
- with self.assertRaises(TypeError):
- datetime(10, 10, 10, 10, 10, 10, 10.)
+ for xx in [10.0, Float(10.9),
+ decimal.Decimal(10), decimal.Decimal('10.9'),
+ Number(10), Number(10.9),
+ '10']:
+ self.assertRaises(TypeError, datetime, xx, 10, 10, 10, 10, 10, 10)
+ self.assertRaises(TypeError, datetime, 10, xx, 10, 10, 10, 10, 10)
+ self.assertRaises(TypeError, datetime, 10, 10, xx, 10, 10, 10, 10)
+ self.assertRaises(TypeError, datetime, 10, 10, 10, xx, 10, 10, 10)
+ self.assertRaises(TypeError, datetime, 10, 10, 10, 10, xx, 10, 10)
+ self.assertRaises(TypeError, datetime, 10, 10, 10, 10, 10, xx, 10)
+ self.assertRaises(TypeError, datetime, 10, 10, 10, 10, 10, 10, xx)
+
#############################################################################
# Local Time Disambiguation
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 1a73fa4..0dec5b1 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -161,12 +161,10 @@ class Unsigned_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_b(BadIndex2()))
self.assertEqual(0, getargs_b(BadIndex3()))
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(99, getargs_b(Int()))
+ self.assertRaises(TypeError, getargs_b, Int())
self.assertEqual(0, getargs_b(IntSubclass()))
self.assertRaises(TypeError, getargs_b, BadInt())
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(1, getargs_b(BadInt2()))
+ self.assertRaises(TypeError, getargs_b, BadInt2())
self.assertEqual(0, getargs_b(BadInt3()))
self.assertRaises(OverflowError, getargs_b, -1)
@@ -187,12 +185,10 @@ class Unsigned_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_B(BadIndex2()))
self.assertEqual(0, getargs_B(BadIndex3()))
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(99, getargs_B(Int()))
+ self.assertRaises(TypeError, getargs_B, Int())
self.assertEqual(0, getargs_B(IntSubclass()))
self.assertRaises(TypeError, getargs_B, BadInt())
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(1, getargs_B(BadInt2()))
+ self.assertRaises(TypeError, getargs_B, BadInt2())
self.assertEqual(0, getargs_B(BadInt3()))
self.assertEqual(UCHAR_MAX, getargs_B(-1))
@@ -213,12 +209,10 @@ class Unsigned_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_H(BadIndex2()))
self.assertEqual(0, getargs_H(BadIndex3()))
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(99, getargs_H(Int()))
+ self.assertRaises(TypeError, getargs_H, Int())
self.assertEqual(0, getargs_H(IntSubclass()))
self.assertRaises(TypeError, getargs_H, BadInt())
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(1, getargs_H(BadInt2()))
+ self.assertRaises(TypeError, getargs_H, BadInt2())
self.assertEqual(0, getargs_H(BadInt3()))
self.assertEqual(USHRT_MAX, getargs_H(-1))
@@ -240,12 +234,10 @@ class Unsigned_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_I(BadIndex2()))
self.assertEqual(0, getargs_I(BadIndex3()))
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(99, getargs_I(Int()))
+ self.assertRaises(TypeError, getargs_I, Int())
self.assertEqual(0, getargs_I(IntSubclass()))
self.assertRaises(TypeError, getargs_I, BadInt())
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(1, getargs_I(BadInt2()))
+ self.assertRaises(TypeError, getargs_I, BadInt2())
self.assertEqual(0, getargs_I(BadInt3()))
self.assertEqual(UINT_MAX, getargs_I(-1))
@@ -293,12 +285,10 @@ class Signed_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_h(BadIndex2()))
self.assertEqual(0, getargs_h(BadIndex3()))
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(99, getargs_h(Int()))
+ self.assertRaises(TypeError, getargs_h, Int())
self.assertEqual(0, getargs_h(IntSubclass()))
self.assertRaises(TypeError, getargs_h, BadInt())
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(1, getargs_h(BadInt2()))
+ self.assertRaises(TypeError, getargs_h, BadInt2())
self.assertEqual(0, getargs_h(BadInt3()))
self.assertRaises(OverflowError, getargs_h, SHRT_MIN-1)
@@ -319,12 +309,10 @@ class Signed_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_i(BadIndex2()))
self.assertEqual(0, getargs_i(BadIndex3()))
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(99, getargs_i(Int()))
+ self.assertRaises(TypeError, getargs_i, Int())
self.assertEqual(0, getargs_i(IntSubclass()))
self.assertRaises(TypeError, getargs_i, BadInt())
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(1, getargs_i(BadInt2()))
+ self.assertRaises(TypeError, getargs_i, BadInt2())
self.assertEqual(0, getargs_i(BadInt3()))
self.assertRaises(OverflowError, getargs_i, INT_MIN-1)
@@ -345,12 +333,10 @@ class Signed_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_l(BadIndex2()))
self.assertEqual(0, getargs_l(BadIndex3()))
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(99, getargs_l(Int()))
+ self.assertRaises(TypeError, getargs_l, Int())
self.assertEqual(0, getargs_l(IntSubclass()))
self.assertRaises(TypeError, getargs_l, BadInt())
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(1, getargs_l(BadInt2()))
+ self.assertRaises(TypeError, getargs_l, BadInt2())
self.assertEqual(0, getargs_l(BadInt3()))
self.assertRaises(OverflowError, getargs_l, LONG_MIN-1)
@@ -400,12 +386,10 @@ class LongLong_TestCase(unittest.TestCase):
with self.assertWarns(DeprecationWarning):
self.assertEqual(1, getargs_L(BadIndex2()))
self.assertEqual(0, getargs_L(BadIndex3()))
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(99, getargs_L(Int()))
+ self.assertRaises(TypeError, getargs_L, Int())
self.assertEqual(0, getargs_L(IntSubclass()))
self.assertRaises(TypeError, getargs_L, BadInt())
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(1, getargs_L(BadInt2()))
+ self.assertRaises(TypeError, getargs_L, BadInt2())
self.assertEqual(0, getargs_L(BadInt3()))
self.assertRaises(OverflowError, getargs_L, LLONG_MIN-1)
diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py
index e511947..0993f09 100644
--- a/Lib/test/test_grp.py
+++ b/Lib/test/test_grp.py
@@ -100,8 +100,8 @@ class GroupDatabaseTestCase(unittest.TestCase):
self.skipTest('no groups')
# Choose an existent gid.
gid = entries[0][2]
- self.assertWarns(DeprecationWarning, grp.getgrgid, float(gid))
- self.assertWarns(DeprecationWarning, grp.getgrgid, str(gid))
+ self.assertRaises(TypeError, grp.getgrgid, float(gid))
+ self.assertRaises(TypeError, grp.getgrgid, str(gid))
if __name__ == "__main__":
diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py
index 6fdf52e..d6be64e 100644
--- a/Lib/test/test_int.py
+++ b/Lib/test/test_int.py
@@ -517,10 +517,7 @@ class IntTestCases(unittest.TestCase):
self.assertIs(type(n), int)
bad_int = TruncReturnsBadInt()
- with self.assertWarns(DeprecationWarning):
- n = int(bad_int)
- self.assertEqual(n, 1)
- self.assertIs(type(n), int)
+ self.assertRaises(TypeError, int, bad_int)
good_int = TruncReturnsIntSubclass()
n = int(good_int)
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 4b848a5..e06b1e6 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -502,14 +502,10 @@ class MathTests(unittest.TestCase):
self.assertRaises(ValueError, math.factorial, -10**100)
def testFactorialNonIntegers(self):
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(math.factorial(5.0), 120)
- with self.assertWarns(DeprecationWarning):
- self.assertRaises(ValueError, math.factorial, 5.2)
- 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, 5.0)
+ self.assertRaises(TypeError, math.factorial, 5.2)
+ self.assertRaises(TypeError, math.factorial, -1.0)
+ self.assertRaises(TypeError, math.factorial, -1e100)
self.assertRaises(TypeError, math.factorial, decimal.Decimal('5'))
self.assertRaises(TypeError, math.factorial, decimal.Decimal('5.2'))
self.assertRaises(TypeError, math.factorial, "5")
@@ -520,8 +516,7 @@ class MathTests(unittest.TestCase):
# Currently raises OverflowError for inputs that are too large
# to fit into a C long.
self.assertRaises(OverflowError, math.factorial, 10**100)
- with self.assertWarns(DeprecationWarning):
- self.assertRaises(OverflowError, math.factorial, 1e100)
+ self.assertRaises(TypeError, math.factorial, 1e100)
def testFloor(self):
self.assertRaises(TypeError, math.floor)
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index aefba4f..dc13307 100755
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -917,10 +917,8 @@ class GeneralModuleTests(unittest.TestCase):
self.assertIn('not NoneType', str(cm.exception))
with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', 'bar', sockname)
- self.assertIn('an integer is required', str(cm.exception))
with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', None, None)
- self.assertIn('an integer is required', str(cm.exception))
# wrong number of args
with self.assertRaises(TypeError) as cm:
s.sendto(b'foo')
@@ -1899,11 +1897,11 @@ class GeneralModuleTests(unittest.TestCase):
socket.SOCK_STREAM)
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)
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")
def test_socket_fileno_rejects_invalid_socket(self):
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-09-01-14-26-02.bpo-37999.XPl6dn.rst b/Misc/NEWS.d/next/Core and Builtins/2019-09-01-14-26-02.bpo-37999.XPl6dn.rst
new file mode 100644
index 0000000..8d7e936
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-09-01-14-26-02.bpo-37999.XPl6dn.rst
@@ -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).
diff --git a/Modules/_blake2/clinic/blake2b_impl.c.h b/Modules/_blake2/clinic/blake2b_impl.c.h
index 07258c3..4e74e08 100644
--- a/Modules/_blake2/clinic/blake2b_impl.c.h
+++ b/Modules/_blake2/clinic/blake2b_impl.c.h
@@ -56,11 +56,6 @@ skip_optional_posonly:
goto skip_optional_kwonly;
}
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]);
if (digest_size == -1 && PyErr_Occurred()) {
goto exit;
@@ -106,11 +101,6 @@ skip_optional_posonly:
}
}
if (fastargs[5]) {
- if (PyFloat_Check(fastargs[5])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fanout = _PyLong_AsInt(fastargs[5]);
if (fanout == -1 && PyErr_Occurred()) {
goto exit;
@@ -120,11 +110,6 @@ skip_optional_posonly:
}
}
if (fastargs[6]) {
- if (PyFloat_Check(fastargs[6])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
depth = _PyLong_AsInt(fastargs[6]);
if (depth == -1 && PyErr_Occurred()) {
goto exit;
@@ -150,11 +135,6 @@ skip_optional_posonly:
}
}
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]);
if (node_depth == -1 && PyErr_Occurred()) {
goto exit;
@@ -164,11 +144,6 @@ skip_optional_posonly:
}
}
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]);
if (inner_size == -1 && PyErr_Occurred()) {
goto exit;
@@ -272,4 +247,4 @@ _blake2_blake2b_hexdigest(BLAKE2bObject *self, PyObject *Py_UNUSED(ignored))
{
return _blake2_blake2b_hexdigest_impl(self);
}
-/*[clinic end generated code: output=2d6d0fe9aa42a42a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=10eb47aba77f192d input=a9049054013a1b77]*/
diff --git a/Modules/_blake2/clinic/blake2s_impl.c.h b/Modules/_blake2/clinic/blake2s_impl.c.h
index 71c5706..0f0d983 100644
--- a/Modules/_blake2/clinic/blake2s_impl.c.h
+++ b/Modules/_blake2/clinic/blake2s_impl.c.h
@@ -56,11 +56,6 @@ skip_optional_posonly:
goto skip_optional_kwonly;
}
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]);
if (digest_size == -1 && PyErr_Occurred()) {
goto exit;
@@ -106,11 +101,6 @@ skip_optional_posonly:
}
}
if (fastargs[5]) {
- if (PyFloat_Check(fastargs[5])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fanout = _PyLong_AsInt(fastargs[5]);
if (fanout == -1 && PyErr_Occurred()) {
goto exit;
@@ -120,11 +110,6 @@ skip_optional_posonly:
}
}
if (fastargs[6]) {
- if (PyFloat_Check(fastargs[6])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
depth = _PyLong_AsInt(fastargs[6]);
if (depth == -1 && PyErr_Occurred()) {
goto exit;
@@ -150,11 +135,6 @@ skip_optional_posonly:
}
}
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]);
if (node_depth == -1 && PyErr_Occurred()) {
goto exit;
@@ -164,11 +144,6 @@ skip_optional_posonly:
}
}
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]);
if (inner_size == -1 && PyErr_Occurred()) {
goto exit;
@@ -272,4 +247,4 @@ _blake2_blake2s_hexdigest(BLAKE2sObject *self, PyObject *Py_UNUSED(ignored))
{
return _blake2_blake2s_hexdigest_impl(self);
}
-/*[clinic end generated code: output=c80d8d06ce40a192 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f7ee8092ed67e9c7 input=a9049054013a1b77]*/
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index a72682d..7f85319 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -354,14 +354,7 @@ PyTypeObject PyCField_Type = {
static int
get_long(PyObject *v, long *p)
{
- long x;
-
- if (PyFloat_Check(v)) {
- PyErr_SetString(PyExc_TypeError,
- "int expected instead of float");
- return -1;
- }
- x = PyLong_AsUnsignedLongMask(v);
+ long x = PyLong_AsUnsignedLongMask(v);
if (x == -1 && PyErr_Occurred())
return -1;
*p = x;
@@ -373,14 +366,7 @@ get_long(PyObject *v, long *p)
static int
get_ulong(PyObject *v, unsigned long *p)
{
- unsigned long x;
-
- if (PyFloat_Check(v)) {
- PyErr_SetString(PyExc_TypeError,
- "int expected instead of float");
- return -1;
- }
- x = PyLong_AsUnsignedLongMask(v);
+ unsigned long x = PyLong_AsUnsignedLongMask(v);
if (x == (unsigned long)-1 && PyErr_Occurred())
return -1;
*p = x;
@@ -392,13 +378,7 @@ get_ulong(PyObject *v, unsigned long *p)
static int
get_longlong(PyObject *v, long long *p)
{
- long long x;
- if (PyFloat_Check(v)) {
- PyErr_SetString(PyExc_TypeError,
- "int expected instead of float");
- return -1;
- }
- x = PyLong_AsUnsignedLongLongMask(v);
+ long long x = PyLong_AsUnsignedLongLongMask(v);
if (x == -1 && PyErr_Occurred())
return -1;
*p = x;
@@ -410,13 +390,7 @@ get_longlong(PyObject *v, long long *p)
static int
get_ulonglong(PyObject *v, unsigned long long *p)
{
- unsigned long long x;
- if (PyFloat_Check(v)) {
- PyErr_SetString(PyExc_TypeError,
- "int expected instead of float");
- return -1;
- }
- x = PyLong_AsUnsignedLongLongMask(v);
+ unsigned long long x = PyLong_AsUnsignedLongLongMask(v);
if (x == (unsigned long long)-1 && PyErr_Occurred())
return -1;
*p = x;
diff --git a/Modules/_io/clinic/_iomodule.c.h b/Modules/_io/clinic/_iomodule.c.h
index 1a9651d..dc7b5ff 100644
--- a/Modules/_io/clinic/_iomodule.c.h
+++ b/Modules/_io/clinic/_iomodule.c.h
@@ -178,11 +178,6 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
}
}
if (args[2]) {
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
buffering = _PyLong_AsInt(args[2]);
if (buffering == -1 && PyErr_Occurred()) {
goto exit;
@@ -261,11 +256,6 @@ _io_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
}
}
if (args[6]) {
- if (PyFloat_Check(args[6])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
closefd = _PyLong_AsInt(args[6]);
if (closefd == -1 && PyErr_Occurred()) {
goto exit;
@@ -323,4 +313,4 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
exit:
return return_value;
}
-/*[clinic end generated code: output=3df6bc6d91697545 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5c0dd7a262c30ebc input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/bufferedio.c.h b/Modules/_io/clinic/bufferedio.c.h
index 56d6332..1961ed9 100644
--- a/Modules/_io/clinic/bufferedio.c.h
+++ b/Modules/_io/clinic/bufferedio.c.h
@@ -120,11 +120,6 @@ _io__Buffered_peek(buffered *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) {
goto exit;
@@ -434,11 +419,6 @@ _io_BufferedReader___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if (!noptargs) {
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;
PyObject *iobj = PyNumber_Index(fastargs[1]);
@@ -493,11 +473,6 @@ _io_BufferedWriter___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if (!noptargs) {
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;
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) {
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;
PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 2));
@@ -649,11 +619,6 @@ _io_BufferedRandom___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if (!noptargs) {
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;
PyObject *iobj = PyNumber_Index(fastargs[1]);
@@ -672,4 +637,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=7d9ad40c95bdd808 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1882bb497ddc9375 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h
index 83cd490..4720bdd 100644
--- a/Modules/_io/clinic/bytesio.c.h
+++ b/Modules/_io/clinic/bytesio.c.h
@@ -402,11 +402,6 @@ _io_BytesIO_seek(bytesio *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) {
goto exit;
@@ -515,4 +505,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=4ec2506def9c8eb9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ba0f302f16397741 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/fileio.c.h b/Modules/_io/clinic/fileio.c.h
index 53e7067..9b237c1 100644
--- a/Modules/_io/clinic/fileio.c.h
+++ b/Modules/_io/clinic/fileio.c.h
@@ -87,11 +87,6 @@ _io_FileIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
}
}
if (fastargs[2]) {
- if (PyFloat_Check(fastargs[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
closefd = _PyLong_AsInt(fastargs[2]);
if (closefd == -1 && PyErr_Occurred()) {
goto exit;
@@ -351,11 +346,6 @@ _io_FileIO_seek(fileio *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) {
goto exit;
@@ -447,4 +437,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
#define _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]*/
diff --git a/Modules/_io/clinic/iobase.c.h b/Modules/_io/clinic/iobase.c.h
index ddaff7b..02a2ab8 100644
--- a/Modules/_io/clinic/iobase.c.h
+++ b/Modules/_io/clinic/iobase.c.h
@@ -274,11 +274,6 @@ _io__RawIOBase_read(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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);
}
-/*[clinic end generated code: output=61b6ea7153ef9940 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1f9ce590549593be input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/stringio.c.h b/Modules/_io/clinic/stringio.c.h
index 77a720c..2b32319 100644
--- a/Modules/_io/clinic/stringio.c.h
+++ b/Modules/_io/clinic/stringio.c.h
@@ -177,11 +177,6 @@ _io_StringIO_seek(stringio *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("seek", nargs, 1, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) {
goto exit;
@@ -348,4 +338,4 @@ _io_StringIO_seekable(stringio *self, PyObject *Py_UNUSED(ignored))
{
return _io_StringIO_seekable_impl(self);
}
-/*[clinic end generated code: output=7aad5ab2e64a25b8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9c428b2942d54991 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/textio.c.h b/Modules/_io/clinic/textio.c.h
index b8b5075..f0ad69c 100644
--- a/Modules/_io/clinic/textio.c.h
+++ b/Modules/_io/clinic/textio.c.h
@@ -39,11 +39,6 @@ _io_IncrementalNewlineDecoder___init__(PyObject *self, PyObject *args, PyObject
goto exit;
}
decoder = fastargs[0];
- if (PyFloat_Check(fastargs[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
translate = _PyLong_AsInt(fastargs[1]);
if (translate == -1 && PyErr_Occurred()) {
goto exit;
@@ -90,11 +85,6 @@ _io_IncrementalNewlineDecoder_decode(nldecoder_object *self, PyObject *const *ar
if (!noptargs) {
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]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -266,11 +256,6 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
}
}
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]);
if (line_buffering == -1 && PyErr_Occurred()) {
goto exit;
@@ -279,11 +264,6 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
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]);
if (write_through == -1 && PyErr_Occurred()) {
goto exit;
@@ -470,11 +450,6 @@ _io_TextIOWrapper_readline(textio *self, PyObject *const *args, Py_ssize_t nargs
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
whence = _PyLong_AsInt(args[1]);
if (whence == -1 && PyErr_Occurred()) {
goto exit;
@@ -701,4 +671,4 @@ _io_TextIOWrapper_close(textio *self, PyObject *Py_UNUSED(ignored))
{
return _io_TextIOWrapper_close_impl(self);
}
-/*[clinic end generated code: output=b1bae4f4cdf6019e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ea96ee1eb3a71f77 input=a9049054013a1b77]*/
diff --git a/Modules/_io/clinic/winconsoleio.c.h b/Modules/_io/clinic/winconsoleio.c.h
index 3e501a5..cf6ce60 100644
--- a/Modules/_io/clinic/winconsoleio.c.h
+++ b/Modules/_io/clinic/winconsoleio.c.h
@@ -86,11 +86,6 @@ _io__WindowsConsoleIO___init__(PyObject *self, PyObject *args, PyObject *kwargs)
}
}
if (fastargs[2]) {
- if (PyFloat_Check(fastargs[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
closefd = _PyLong_AsInt(fastargs[2]);
if (closefd == -1 && PyErr_Occurred()) {
goto exit;
@@ -386,4 +381,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#define _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]*/
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index caf91df..7c8ba37 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -255,12 +255,6 @@ _io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
self->fd = -1;
}
- if (PyFloat_Check(nameobj)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float");
- return -1;
- }
-
fd = _PyLong_AsInt(nameobj);
if (fd < 0) {
if (!PyErr_Occurred()) {
@@ -895,10 +889,6 @@ portable_lseek(fileio *self, PyObject *posobj, int whence, bool suppress_pipe_er
pos = 0;
}
else {
- if(PyFloat_Check(posobj)) {
- PyErr_SetString(PyExc_TypeError, "an integer is required");
- return NULL;
- }
#if defined(HAVE_LARGEFILE_SUPPORT)
pos = PyLong_AsLongLong(posobj);
#else
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index a83ef37..4ccf027 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -281,12 +281,6 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
self->handle = INVALID_HANDLE_VALUE;
}
- if (PyFloat_Check(nameobj)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float");
- return -1;
- }
-
fd = _PyLong_AsInt(nameobj);
if (fd < 0) {
if (!PyErr_Occurred()) {
diff --git a/Modules/_multiprocessing/clinic/posixshmem.c.h b/Modules/_multiprocessing/clinic/posixshmem.c.h
index a99f0d2..3424b10 100644
--- a/Modules/_multiprocessing/clinic/posixshmem.c.h
+++ b/Modules/_multiprocessing/clinic/posixshmem.c.h
@@ -42,11 +42,6 @@ _posixshmem_shm_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
goto exit;
}
path = args[0];
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -54,11 +49,6 @@ _posixshmem_shm_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
if (!noptargs) {
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]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -130,4 +120,4 @@ exit:
#ifndef _POSIXSHMEM_SHM_UNLINK_METHODDEF
#define _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]*/
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 732703e..fb1b82c 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -337,17 +337,6 @@ II_getitem(arrayobject *ap, Py_ssize_t 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
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 */
if (!PyLong_Check(v)) {
- v = get_int_unless_float(v);
+ v = PyNumber_Index(v);
if (NULL == v) {
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 */
if (!PyLong_Check(v)) {
- v = get_int_unless_float(v);
+ v = PyNumber_Index(v);
if (NULL == v) {
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 */
if (!PyLong_Check(v)) {
- v = get_int_unless_float(v);
+ v = PyNumber_Index(v);
if (NULL == v) {
return -1;
}
diff --git a/Modules/cjkcodecs/clinic/multibytecodec.c.h b/Modules/cjkcodecs/clinic/multibytecodec.c.h
index 5ddbbe2..5638883 100644
--- a/Modules/cjkcodecs/clinic/multibytecodec.c.h
+++ b/Modules/cjkcodecs/clinic/multibytecodec.c.h
@@ -171,11 +171,6 @@ _multibytecodec_MultibyteIncrementalEncoder_encode(MultibyteIncrementalEncoderOb
if (!noptargs) {
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]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -288,11 +283,6 @@ _multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderOb
if (!noptargs) {
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]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -525,4 +515,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__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]*/
diff --git a/Modules/clinic/_bisectmodule.c.h b/Modules/clinic/_bisectmodule.c.h
index 80ab704..8a0170a 100644
--- a/Modules/clinic/_bisectmodule.c.h
+++ b/Modules/clinic/_bisectmodule.c.h
@@ -46,11 +46,6 @@ _bisect_bisect_right(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
goto skip_optional_pos;
}
if (args[2]) {
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
if (args[2]) {
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
if (args[2]) {
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
if (args[2]) {
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
@@ -303,4 +283,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=bcbd6c77331a08f0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e9097a9acd10b13f input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h
index 0eb6280..ab610a1 100644
--- a/Modules/clinic/_bz2module.c.h
+++ b/Modules/clinic/_bz2module.c.h
@@ -95,11 +95,6 @@ _bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
if (PyTuple_GET_SIZE(args) < 1) {
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));
if (compresslevel == -1 && PyErr_Occurred()) {
goto exit;
@@ -162,11 +157,6 @@ _bz2_BZ2Decompressor_decompress(BZ2Decompressor *self, PyObject *const *args, Py
if (!noptargs) {
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;
PyObject *iobj = PyNumber_Index(args[1]);
@@ -220,4 +210,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=3f3f1e788fe28ee1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c69a7de8e26c2ad1 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h
index 772c8ca..249065c 100644
--- a/Modules/clinic/_codecsmodule.c.h
+++ b/Modules/clinic/_codecsmodule.c.h
@@ -424,11 +424,6 @@ _codecs_utf_7_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -499,11 +494,6 @@ _codecs_utf_8_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -574,11 +564,6 @@ _codecs_utf_16_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -649,11 +634,6 @@ _codecs_utf_16_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -724,11 +704,6 @@ _codecs_utf_16_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -801,11 +776,6 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
byteorder = _PyLong_AsInt(args[2]);
if (byteorder == -1 && PyErr_Occurred()) {
goto exit;
@@ -813,11 +783,6 @@ _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) {
goto skip_optional;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[3]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -888,11 +853,6 @@ _codecs_utf_32_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -963,11 +923,6 @@ _codecs_utf_32_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -1038,11 +993,6 @@ _codecs_utf_32_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -1115,11 +1065,6 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
byteorder = _PyLong_AsInt(args[2]);
if (byteorder == -1 && PyErr_Occurred()) {
goto exit;
@@ -1127,11 +1072,6 @@ _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) {
goto skip_optional;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[3]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -1539,11 +1479,6 @@ _codecs_mbcs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -1618,11 +1553,6 @@ _codecs_oem_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[2]);
if (final == -1 && PyErr_Occurred()) {
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
codepage = _PyLong_AsInt(args[0]);
if (codepage == -1 && PyErr_Occurred()) {
goto exit;
@@ -1707,11 +1632,6 @@ _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) {
goto skip_optional;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
final = _PyLong_AsInt(args[3]);
if (final == -1 && PyErr_Occurred()) {
goto exit;
@@ -1973,11 +1893,6 @@ _codecs_utf_16_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
byteorder = _PyLong_AsInt(args[2]);
if (byteorder == -1 && PyErr_Occurred()) {
goto exit;
@@ -2160,11 +2075,6 @@ _codecs_utf_32_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
byteorder = _PyLong_AsInt(args[2]);
if (byteorder == -1 && PyErr_Occurred()) {
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
code_page = _PyLong_AsInt(args[0]);
if (code_page == -1 && PyErr_Occurred()) {
goto exit;
@@ -2922,4 +2827,4 @@ exit:
#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
#define _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]*/
diff --git a/Modules/clinic/_collectionsmodule.c.h b/Modules/clinic/_collectionsmodule.c.h
index c3ba1a6..0cc1466 100644
--- a/Modules/clinic/_collectionsmodule.c.h
+++ b/Modules/clinic/_collectionsmodule.c.h
@@ -50,11 +50,6 @@ tuplegetter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
if (!_PyArg_CheckPositional("_tuplegetter", PyTuple_GET_SIZE(args), 2, 2)) {
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;
PyObject *iobj = PyNumber_Index(PyTuple_GET_ITEM(args, 0));
@@ -73,4 +68,4 @@ tuplegetter_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=9d2bfcc9df5faf35 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=439d77631a056b4d input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_curses_panel.c.h b/Modules/clinic/_curses_panel.c.h
index 9840ed8..cff2746 100644
--- a/Modules/clinic/_curses_panel.c.h
+++ b/Modules/clinic/_curses_panel.c.h
@@ -152,20 +152,10 @@ _curses_panel_panel_move(PyCursesPanelObject *self, PyObject *const *args, Py_ss
if (!_PyArg_CheckPositional("move", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
y = _PyLong_AsInt(args[0]);
if (y == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
x = _PyLong_AsInt(args[1]);
if (x == -1 && PyErr_Occurred()) {
goto exit;
@@ -335,4 +325,4 @@ _curses_panel_update_panels(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return _curses_panel_update_panels_impl(module);
}
-/*[clinic end generated code: output=d96dc1fd68e898d9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1226d5f94361ebfb input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h
index 50d7f21..f686ded 100644
--- a/Modules/clinic/_cursesmodule.c.h
+++ b/Modules/clinic/_cursesmodule.c.h
@@ -252,11 +252,6 @@ _curses_window_bkgd(PyCursesWindowObject *self, PyObject *const *args, Py_ssize_
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
attr = PyLong_AsLong(args[1]);
if (attr == -1 && PyErr_Occurred()) {
goto exit;
@@ -286,11 +281,6 @@ _curses_window_attroff(PyCursesWindowObject *self, PyObject *arg)
PyObject *return_value = NULL;
long attr;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
attr = PyLong_AsLong(arg);
if (attr == -1 && PyErr_Occurred()) {
goto exit;
@@ -319,11 +309,6 @@ _curses_window_attron(PyCursesWindowObject *self, PyObject *arg)
PyObject *return_value = NULL;
long attr;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
attr = PyLong_AsLong(arg);
if (attr == -1 && PyErr_Occurred()) {
goto exit;
@@ -352,11 +337,6 @@ _curses_window_attrset(PyCursesWindowObject *self, PyObject *arg)
PyObject *return_value = NULL;
long attr;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
attr = PyLong_AsLong(arg);
if (attr == -1 && PyErr_Occurred()) {
goto exit;
@@ -399,11 +379,6 @@ _curses_window_bkgdset(PyCursesWindowObject *self, PyObject *const *args, Py_ssi
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
attr = PyLong_AsLong(args[1]);
if (attr == -1 && PyErr_Occurred()) {
goto exit;
@@ -687,11 +662,6 @@ _curses_window_echochar(PyCursesWindowObject *self, PyObject *const *args, Py_ss
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
attr = PyLong_AsLong(args[1]);
if (attr == -1 && PyErr_Occurred()) {
goto exit;
@@ -733,20 +703,10 @@ _curses_window_enclose(PyCursesWindowObject *self, PyObject *const *args, Py_ssi
if (!_PyArg_CheckPositional("enclose", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
y = _PyLong_AsInt(args[0]);
if (y == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
x = _PyLong_AsInt(args[1]);
if (x == -1 && PyErr_Occurred()) {
goto exit;
@@ -1303,11 +1263,6 @@ _curses_window_is_linetouched(PyCursesWindowObject *self, PyObject *arg)
PyObject *return_value = NULL;
int line;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
line = _PyLong_AsInt(arg);
if (line == -1 && PyErr_Occurred()) {
goto exit;
@@ -1552,20 +1507,10 @@ _curses_window_redrawln(PyCursesWindowObject *self, PyObject *const *args, Py_ss
if (!_PyArg_CheckPositional("redrawln", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
beg = _PyLong_AsInt(args[0]);
if (beg == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
num = _PyLong_AsInt(args[1]);
if (num == -1 && PyErr_Occurred()) {
goto exit;
@@ -1661,20 +1606,10 @@ _curses_window_setscrreg(PyCursesWindowObject *self, PyObject *const *args, Py_s
if (!_PyArg_CheckPositional("setscrreg", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
top = _PyLong_AsInt(args[0]);
if (top == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
bottom = _PyLong_AsInt(args[1]);
if (bottom == -1 && PyErr_Occurred()) {
goto exit;
@@ -2005,11 +1940,6 @@ _curses_cbreak(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
@@ -2045,11 +1975,6 @@ _curses_color_content(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
short color_number;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) {
@@ -2099,11 +2024,6 @@ _curses_color_pair(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
short color_number;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) {
@@ -2155,11 +2075,6 @@ _curses_curs_set(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int visibility;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
visibility = _PyLong_AsInt(arg);
if (visibility == -1 && PyErr_Occurred()) {
goto exit;
@@ -2235,11 +2150,6 @@ _curses_delay_output(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int ms;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
ms = _PyLong_AsInt(arg);
if (ms == -1 && PyErr_Occurred()) {
goto exit;
@@ -2297,11 +2207,6 @@ _curses_echo(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
@@ -2469,11 +2374,6 @@ _curses_ungetmouse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("ungetmouse", nargs, 5, 5)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
long ival = PyLong_AsLong(args[0]);
if (ival == -1 && PyErr_Occurred()) {
@@ -2493,29 +2393,14 @@ _curses_ungetmouse(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
id = (short) ival;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
x = _PyLong_AsInt(args[1]);
if (x == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
y = _PyLong_AsInt(args[2]);
if (y == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
z = _PyLong_AsInt(args[3]);
if (z == -1 && PyErr_Occurred()) {
goto exit;
@@ -2568,11 +2453,6 @@ _curses_halfdelay(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
unsigned char tenths;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) {
@@ -2675,11 +2555,6 @@ _curses_has_key(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int key;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
key = _PyLong_AsInt(arg);
if (key == -1 && PyErr_Occurred()) {
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
long ival = PyLong_AsLong(args[0]);
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;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
long ival = PyLong_AsLong(args[1]);
if (ival == -1 && PyErr_Occurred()) {
@@ -2778,11 +2643,6 @@ _curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
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]);
if (ival == -1 && PyErr_Occurred()) {
@@ -2802,11 +2662,6 @@ _curses_init_color(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
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]);
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
long ival = PyLong_AsLong(args[0]);
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;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
long ival = PyLong_AsLong(args[1]);
if (ival == -1 && PyErr_Occurred()) {
@@ -2914,11 +2759,6 @@ _curses_init_pair(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
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]);
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;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[1]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -3093,11 +2928,6 @@ _curses_set_escdelay(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int ms;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
ms = _PyLong_AsInt(arg);
if (ms == -1 && PyErr_Occurred()) {
goto exit;
@@ -3161,11 +2991,6 @@ _curses_set_tabsize(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int size;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
size = _PyLong_AsInt(arg);
if (size == -1 && PyErr_Occurred()) {
goto exit;
@@ -3195,11 +3020,6 @@ _curses_intrflush(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int flag;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(arg);
if (flag == -1 && PyErr_Occurred()) {
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
nlines = _PyLong_AsInt(args[0]);
if (nlines == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
ncols = _PyLong_AsInt(args[1]);
if (ncols == -1 && PyErr_Occurred()) {
goto exit;
@@ -3304,11 +3114,6 @@ _curses_keyname(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int key;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
key = _PyLong_AsInt(arg);
if (key == -1 && PyErr_Occurred()) {
goto exit;
@@ -3379,11 +3184,6 @@ _curses_meta(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int yes;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
yes = _PyLong_AsInt(arg);
if (yes == -1 && PyErr_Occurred()) {
goto exit;
@@ -3421,11 +3221,6 @@ _curses_mouseinterval(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int interval;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
interval = _PyLong_AsInt(arg);
if (interval == -1 && PyErr_Occurred()) {
goto exit;
@@ -3497,11 +3292,6 @@ _curses_napms(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int ms;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
ms = _PyLong_AsInt(arg);
if (ms == -1 && PyErr_Occurred()) {
goto exit;
@@ -3539,20 +3329,10 @@ _curses_newpad(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("newpad", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
nlines = _PyLong_AsInt(args[0]);
if (nlines == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
ncols = _PyLong_AsInt(args[1]);
if (ncols == -1 && PyErr_Occurred()) {
goto exit;
@@ -3648,11 +3428,6 @@ _curses_nl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
@@ -3787,11 +3562,6 @@ _curses_pair_content(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
short pair_number;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred()) {
@@ -3837,11 +3607,6 @@ _curses_pair_number(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int attr;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
attr = _PyLong_AsInt(arg);
if (attr == -1 && PyErr_Occurred()) {
goto exit;
@@ -3911,11 +3676,6 @@ _curses_qiflush(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
@@ -3979,11 +3739,6 @@ _curses_raw(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(args[0]);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
@@ -4081,20 +3836,10 @@ _curses_resizeterm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("resizeterm", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
nlines = _PyLong_AsInt(args[0]);
if (nlines == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
ncols = _PyLong_AsInt(args[1]);
if (ncols == -1 && PyErr_Occurred()) {
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
nlines = _PyLong_AsInt(args[0]);
if (nlines == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
ncols = _PyLong_AsInt(args[1]);
if (ncols == -1 && PyErr_Occurred()) {
goto exit;
@@ -4217,20 +3952,10 @@ _curses_setsyx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("setsyx", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
y = _PyLong_AsInt(args[0]);
if (y == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
x = _PyLong_AsInt(args[1]);
if (x == -1 && PyErr_Occurred()) {
goto exit;
@@ -4500,11 +4225,6 @@ _curses_typeahead(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -4580,11 +4300,6 @@ _curses_use_env(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int flag;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(arg);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
@@ -4713,4 +4428,4 @@ _curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
#define _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]*/
diff --git a/Modules/clinic/_datetimemodule.c.h b/Modules/clinic/_datetimemodule.c.h
index 973a4ea..7bd7c19 100644
--- a/Modules/clinic/_datetimemodule.c.h
+++ b/Modules/clinic/_datetimemodule.c.h
@@ -35,29 +35,14 @@ iso_calendar_date_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
if (!fastargs) {
goto exit;
}
- if (PyFloat_Check(fastargs[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
year = _PyLong_AsInt(fastargs[0]);
if (year == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(fastargs[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
week = _PyLong_AsInt(fastargs[1]);
if (week == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(fastargs[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
weekday = _PyLong_AsInt(fastargs[2]);
if (weekday == -1 && PyErr_Occurred()) {
goto exit;
@@ -109,4 +94,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=5e17549f29a439a5 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f61310936e3d8091 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h
index a7d7350..edf29be 100644
--- a/Modules/clinic/_dbmmodule.c.h
+++ b/Modules/clinic/_dbmmodule.c.h
@@ -162,11 +162,6 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[2]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -177,4 +172,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=7ced103488cbca7a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ba4ff07b8c8bbfe4 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h
index 825416f..5934218 100644
--- a/Modules/clinic/_elementtree.c.h
+++ b/Modules/clinic/_elementtree.c.h
@@ -430,11 +430,6 @@ _elementtree_Element_insert(ElementObject *self, PyObject *const *args, Py_ssize
if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -920,4 +915,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=b7f6a32462fc42a9 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c98b210c525a9338 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h
index aa37a24..1951591 100644
--- a/Modules/clinic/_gdbmmodule.c.h
+++ b/Modules/clinic/_gdbmmodule.c.h
@@ -283,11 +283,6 @@ dbmopen(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[2]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -298,4 +293,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=2766471b2fa1a816 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=c9d43f42677f4efb input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_hashopenssl.c.h b/Modules/clinic/_hashopenssl.c.h
index 5ab4e99..619cb1c 100644
--- a/Modules/clinic/_hashopenssl.c.h
+++ b/Modules/clinic/_hashopenssl.c.h
@@ -92,11 +92,6 @@ EVPXOF_digest(EVPobject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -144,11 +139,6 @@ EVPXOF_hexdigest(EVPobject *self, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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]);
goto exit;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
iterations = PyLong_AsLong(args[3]);
if (iterations == -1 && PyErr_Occurred()) {
goto exit;
@@ -1055,11 +1040,6 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
}
}
if (args[5]) {
- if (PyFloat_Check(args[5])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
maxmem = PyLong_AsLong(args[5]);
if (maxmem == -1 && PyErr_Occurred()) {
goto exit;
@@ -1068,11 +1048,6 @@ _hashlib_scrypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
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]);
if (dklen == -1 && PyErr_Occurred()) {
goto exit;
@@ -1402,4 +1377,4 @@ exit:
#ifndef _HASHLIB_GET_FIPS_MODE_METHODDEF
#define _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]*/
diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h
index 82ef4d5..40913ef 100644
--- a/Modules/clinic/_lzmamodule.c.h
+++ b/Modules/clinic/_lzmamodule.c.h
@@ -116,11 +116,6 @@ _lzma_LZMADecompressor_decompress(Decompressor *self, PyObject *const *args, Py_
if (!noptargs) {
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;
PyObject *iobj = PyNumber_Index(args[1]);
@@ -194,11 +189,6 @@ _lzma_LZMADecompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs
goto skip_optional_pos;
}
if (fastargs[0]) {
- if (PyFloat_Check(fastargs[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
format = _PyLong_AsInt(fastargs[0]);
if (format == -1 && PyErr_Occurred()) {
goto exit;
@@ -241,11 +231,6 @@ _lzma_is_check_supported(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int check_id;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
check_id = _PyLong_AsInt(arg);
if (check_id == -1 && PyErr_Occurred()) {
goto exit;
@@ -334,4 +319,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=f7477a10e86a717d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a87074ca902bd432 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_opcode.c.h b/Modules/clinic/_opcode.c.h
index 777701f..6915f21 100644
--- a/Modules/clinic/_opcode.c.h
+++ b/Modules/clinic/_opcode.c.h
@@ -32,11 +32,6 @@ _opcode_stack_effect(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
opcode = _PyLong_AsInt(args[0]);
if (opcode == -1 && PyErr_Occurred()) {
goto exit;
@@ -61,4 +56,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=7bc08f2835b2cf89 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=bcf66d25c2624197 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_operator.c.h b/Modules/clinic/_operator.c.h
index f9e353d..2a66f8f 100644
--- a/Modules/clinic/_operator.c.h
+++ b/Modules/clinic/_operator.c.h
@@ -1424,11 +1424,6 @@ _operator_length_hint(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
@@ -1491,4 +1486,4 @@ _operator__compare_digest(PyObject *module, PyObject *const *args, Py_ssize_t na
exit:
return return_value;
}
-/*[clinic end generated code: output=e7ed71a8c475a901 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1fe4adf4f5761420 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_randommodule.c.h b/Modules/clinic/_randommodule.c.h
index a467811..b3cd435 100644
--- a/Modules/clinic/_randommodule.c.h
+++ b/Modules/clinic/_randommodule.c.h
@@ -100,11 +100,6 @@ _random_Random_getrandbits(RandomObject *self, PyObject *arg)
PyObject *return_value = NULL;
int k;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
k = _PyLong_AsInt(arg);
if (k == -1 && PyErr_Occurred()) {
goto exit;
@@ -114,4 +109,4 @@ _random_Random_getrandbits(RandomObject *self, PyObject *arg)
exit:
return return_value;
}
-/*[clinic end generated code: output=a7feb0c9c8d1b627 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=cc8a23b2757dc6ba input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h
index d398a85..fc3ae04 100644
--- a/Modules/clinic/_sre.c.h
+++ b/Modules/clinic/_sre.c.h
@@ -47,11 +47,6 @@ _sre_ascii_iscased(PyObject *module, PyObject *arg)
int character;
int _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
@@ -84,11 +79,6 @@ _sre_unicode_iscased(PyObject *module, PyObject *arg)
int character;
int _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
@@ -121,11 +111,6 @@ _sre_ascii_tolower(PyObject *module, PyObject *arg)
int character;
int _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
@@ -158,11 +143,6 @@ _sre_unicode_tolower(PyObject *module, PyObject *arg)
int character;
int _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
character = _PyLong_AsInt(arg);
if (character == -1 && PyErr_Occurred()) {
goto exit;
@@ -211,11 +191,6 @@ _sre_SRE_Pattern_match(PatternObject *self, PyObject *const *args, Py_ssize_t na
goto skip_optional_pos;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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;
}
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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;
}
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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;
}
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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;
}
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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;
}
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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;
}
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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) {
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;
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) {
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;
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) {
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;
PyObject *iobj = PyNumber_Index(args[2]);
@@ -884,11 +789,6 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
goto exit;
}
pattern = args[0];
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -898,11 +798,6 @@ _sre_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
goto exit;
}
code = args[2];
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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);
}
-/*[clinic end generated code: output=1adeddce58ae284c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=7a3360917b40a808 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h
index ce8669a..2375f83 100644
--- a/Modules/clinic/_ssl.c.h
+++ b/Modules/clinic/_ssl.c.h
@@ -406,11 +406,6 @@ _ssl__SSLContext(PyTypeObject *type, PyObject *args, PyObject *kwargs)
if (!_PyArg_CheckPositional("_SSLContext", PyTuple_GET_SIZE(args), 1, 1)) {
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));
if (proto_version == -1 && PyErr_Occurred()) {
goto exit;
@@ -694,11 +689,6 @@ _ssl__SSLContext__wrap_socket(PySSLContext *self, PyObject *const *args, Py_ssiz
goto exit;
}
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]);
if (server_side == -1 && PyErr_Occurred()) {
goto exit;
@@ -774,11 +764,6 @@ _ssl__SSLContext__wrap_bio(PySSLContext *self, PyObject *const *args, Py_ssize_t
goto exit;
}
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]);
if (server_side == -1 && PyErr_Occurred()) {
goto exit;
@@ -977,11 +962,6 @@ _ssl_MemoryBIO_read(PySSLMemoryBIO *self, PyObject *const *args, Py_ssize_t narg
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
len = _PyLong_AsInt(args[0]);
if (len == -1 && PyErr_Occurred()) {
goto exit;
@@ -1132,11 +1112,6 @@ _ssl_RAND_bytes(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int n;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
n = _PyLong_AsInt(arg);
if (n == -1 && PyErr_Occurred()) {
goto exit;
@@ -1168,11 +1143,6 @@ _ssl_RAND_pseudo_bytes(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int n;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
n = _PyLong_AsInt(arg);
if (n == -1 && PyErr_Occurred()) {
goto exit;
@@ -1333,11 +1303,6 @@ _ssl_nid2obj(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int nid;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
nid = _PyLong_AsInt(arg);
if (nid == -1 && PyErr_Occurred()) {
goto exit;
@@ -1482,4 +1447,4 @@ exit:
#ifndef _SSL_ENUM_CRLS_METHODDEF
#define _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]*/
diff --git a/Modules/clinic/_struct.c.h b/Modules/clinic/_struct.c.h
index 36c4b40..874f30a 100644
--- a/Modules/clinic/_struct.c.h
+++ b/Modules/clinic/_struct.c.h
@@ -124,11 +124,6 @@ Struct_unpack_from(PyStructObject *self, PyObject *const *args, Py_ssize_t nargs
if (!noptargs) {
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;
PyObject *iobj = PyNumber_Index(args[1]);
@@ -315,11 +310,6 @@ unpack_from(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!noptargs) {
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;
PyObject *iobj = PyNumber_Index(args[2]);
@@ -386,4 +376,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=6a6228cfc4b7099c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1205daf7f616f0cf input=a9049054013a1b77]*/
diff --git a/Modules/clinic/_tkinter.c.h b/Modules/clinic/_tkinter.c.h
index 73c3fae..9718986 100644
--- a/Modules/clinic/_tkinter.c.h
+++ b/Modules/clinic/_tkinter.c.h
@@ -434,11 +434,6 @@ _tkinter_tkapp_createfilehandler(TkappObject *self, PyObject *const *args, Py_ss
goto exit;
}
file = args[0];
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mask = _PyLong_AsInt(args[1]);
if (mask == -1 && PyErr_Occurred()) {
goto exit;
@@ -503,11 +498,6 @@ _tkinter_tkapp_createtimerhandler(TkappObject *self, PyObject *const *args, Py_s
if (!_PyArg_CheckPositional("createtimerhandler", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
milliseconds = _PyLong_AsInt(args[0]);
if (milliseconds == -1 && PyErr_Occurred()) {
goto exit;
@@ -542,11 +532,6 @@ _tkinter_tkapp_mainloop(TkappObject *self, PyObject *const *args, Py_ssize_t nar
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
threshold = _PyLong_AsInt(args[0]);
if (threshold == -1 && PyErr_Occurred()) {
goto exit;
@@ -581,11 +566,6 @@ _tkinter_tkapp_dooneevent(TkappObject *self, PyObject *const *args, Py_ssize_t n
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[0]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -769,11 +749,6 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 4) {
goto skip_optional;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
interactive = _PyLong_AsInt(args[3]);
if (interactive == -1 && PyErr_Occurred()) {
goto exit;
@@ -781,11 +756,6 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 5) {
goto skip_optional;
}
- if (PyFloat_Check(args[4])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
wantobjects = _PyLong_AsInt(args[4]);
if (wantobjects == -1 && PyErr_Occurred()) {
goto exit;
@@ -793,11 +763,6 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 6) {
goto skip_optional;
}
- if (PyFloat_Check(args[5])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
wantTk = _PyLong_AsInt(args[5]);
if (wantTk == -1 && PyErr_Occurred()) {
goto exit;
@@ -805,11 +770,6 @@ _tkinter_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 7) {
goto skip_optional;
}
- if (PyFloat_Check(args[6])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
sync = _PyLong_AsInt(args[6]);
if (sync == -1 && PyErr_Occurred()) {
goto exit;
@@ -862,11 +822,6 @@ _tkinter_setbusywaitinterval(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int new_val;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
new_val = _PyLong_AsInt(arg);
if (new_val == -1 && PyErr_Occurred()) {
goto exit;
@@ -912,4 +867,4 @@ exit:
#ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#define _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]*/
diff --git a/Modules/clinic/_tracemalloc.c.h b/Modules/clinic/_tracemalloc.c.h
index 049cacd..20afd76 100644
--- a/Modules/clinic/_tracemalloc.c.h
+++ b/Modules/clinic/_tracemalloc.c.h
@@ -101,11 +101,6 @@ _tracemalloc_start(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
nframe = _PyLong_AsInt(args[0]);
if (nframe == -1 && PyErr_Occurred()) {
goto exit;
@@ -217,4 +212,4 @@ _tracemalloc_reset_peak(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return _tracemalloc_reset_peak_impl(module);
}
-/*[clinic end generated code: output=a130117b1af821da input=a9049054013a1b77]*/
+/*[clinic end generated code: output=bafca0a19b0b0823 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h
index b9245ca..334db39 100644
--- a/Modules/clinic/arraymodule.c.h
+++ b/Modules/clinic/arraymodule.c.h
@@ -82,11 +82,6 @@ array_array_pop(arrayobject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -253,11 +243,6 @@ array_array_fromfile(arrayobject *self, PyObject *const *args, Py_ssize_t nargs)
goto exit;
}
f = args[0];
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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;
}
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]);
if (mformat_code == -1 && PyErr_Occurred()) {
goto exit;
@@ -534,4 +514,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
{"__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]*/
diff --git a/Modules/clinic/audioop.c.h b/Modules/clinic/audioop.c.h
index 8745533..56d31d3 100644
--- a/Modules/clinic/audioop.c.h
+++ b/Modules/clinic/audioop.c.h
@@ -33,20 +33,10 @@ audioop_getsample(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
_PyArg_BadArgument("getsample", "argument 1", "contiguous buffer", args[0]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[2]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
bias = _PyLong_AsInt(args[2]);
if (bias == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
newwidth = _PyLong_AsInt(args[2]);
if (newwidth == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
nchannels = _PyLong_AsInt(args[2]);
if (nchannels == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
inrate = _PyLong_AsInt(args[3]);
if (inrate == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[4])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
outrate = _PyLong_AsInt(args[4]);
if (outrate == -1 && PyErr_Occurred()) {
goto exit;
@@ -1137,11 +1017,6 @@ audioop_ratecv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 7) {
goto skip_optional;
}
- if (PyFloat_Check(args[6])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
weightA = _PyLong_AsInt(args[6]);
if (weightA == -1 && PyErr_Occurred()) {
goto exit;
@@ -1149,11 +1024,6 @@ audioop_ratecv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 8) {
goto skip_optional;
}
- if (PyFloat_Check(args[7])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
weightB = _PyLong_AsInt(args[7]);
if (weightB == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
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]);
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
width = _PyLong_AsInt(args[1]);
if (width == -1 && PyErr_Occurred()) {
goto exit;
@@ -1469,4 +1309,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=6b4f2c597f295abc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=343e5ae478fc0359 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index 4d02c72..ae1c457 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -70,11 +70,6 @@ binascii_b2a_uu(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!noptargs) {
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]);
if (backtick == -1 && PyErr_Occurred()) {
goto exit;
@@ -159,11 +154,6 @@ binascii_b2a_base64(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
if (!noptargs) {
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]);
if (newline == -1 && PyErr_Occurred()) {
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]);
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]);
if (crc == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -401,11 +386,6 @@ binascii_crc32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) {
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]);
if (crc == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -488,11 +468,6 @@ binascii_b2a_hex(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
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]);
if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit;
@@ -563,11 +538,6 @@ binascii_hexlify(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
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]);
if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit;
@@ -684,11 +654,6 @@ binascii_a2b_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!noptargs) {
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]);
if (header == -1 && PyErr_Occurred()) {
goto exit;
@@ -749,11 +714,6 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
quotetabs = _PyLong_AsInt(args[1]);
if (quotetabs == -1 && PyErr_Occurred()) {
goto exit;
@@ -763,11 +723,6 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
}
}
if (args[2]) {
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
istext = _PyLong_AsInt(args[2]);
if (istext == -1 && PyErr_Occurred()) {
goto exit;
@@ -776,11 +731,6 @@ binascii_b2a_qp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
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]);
if (header == -1 && PyErr_Occurred()) {
goto exit;
@@ -796,4 +746,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=a1e878d3963b615e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=95a0178f30801b89 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/fcntlmodule.c.h b/Modules/clinic/fcntlmodule.c.h
index 024a44c..c6bf45f 100644
--- a/Modules/clinic/fcntlmodule.c.h
+++ b/Modules/clinic/fcntlmodule.c.h
@@ -38,11 +38,6 @@ fcntl_fcntl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!conv_descriptor(args[0], &fd)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
code = _PyLong_AsInt(args[1]);
if (code == -1 && PyErr_Occurred()) {
goto exit;
@@ -113,11 +108,6 @@ fcntl_ioctl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!conv_descriptor(args[0], &fd)) {
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]);
if (code == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -168,11 +158,6 @@ fcntl_flock(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!conv_descriptor(args[0], &fd)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
code = _PyLong_AsInt(args[1]);
if (code == -1 && PyErr_Occurred()) {
goto exit;
@@ -233,11 +218,6 @@ fcntl_lockf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!conv_descriptor(args[0], &fd)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
code = _PyLong_AsInt(args[1]);
if (code == -1 && PyErr_Occurred()) {
goto exit;
@@ -253,11 +233,6 @@ fcntl_lockf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 5) {
goto skip_optional;
}
- if (PyFloat_Check(args[4])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
whence = _PyLong_AsInt(args[4]);
if (whence == -1 && PyErr_Occurred()) {
goto exit;
@@ -268,4 +243,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=e912d25e28362c52 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=91c2295402509595 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/gcmodule.c.h b/Modules/clinic/gcmodule.c.h
index 72795c6..30efc7e 100644
--- a/Modules/clinic/gcmodule.c.h
+++ b/Modules/clinic/gcmodule.c.h
@@ -102,11 +102,6 @@ gc_collect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *
if (!noptargs) {
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]);
if (generation == -1 && PyErr_Occurred()) {
goto exit;
@@ -151,11 +146,6 @@ gc_set_debug(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int flags;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(arg);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -382,4 +372,4 @@ gc_get_freeze_count(PyObject *module, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
-/*[clinic end generated code: output=bd6a8056989e2e69 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=61e15f3a549f3ab5 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/itertoolsmodule.c.h b/Modules/clinic/itertoolsmodule.c.h
index 20594b0..c6d6717 100644
--- a/Modules/clinic/itertoolsmodule.c.h
+++ b/Modules/clinic/itertoolsmodule.c.h
@@ -170,11 +170,6 @@ itertools_tee(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
@@ -356,11 +351,6 @@ itertools_combinations(PyTypeObject *type, PyObject *args, PyObject *kwargs)
goto exit;
}
iterable = fastargs[0];
- if (PyFloat_Check(fastargs[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]);
@@ -409,11 +399,6 @@ itertools_combinations_with_replacement(PyTypeObject *type, PyObject *args, PyOb
goto exit;
}
iterable = fastargs[0];
- if (PyFloat_Check(fastargs[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(fastargs[1]);
@@ -642,4 +627,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=392c9706e79f6710 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=07211f86c4153050 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index 41baa45..6f180ab 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -187,11 +187,6 @@ os_access(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
if (!path_converter(args[0], &path)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -257,11 +252,6 @@ os_ttyname(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -431,11 +421,6 @@ os_chmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
if (!path_converter(args[0], &path)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -495,20 +480,10 @@ os_fchmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -555,11 +530,6 @@ os_lchmod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
if (!path_converter(args[0], &path)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -952,11 +922,6 @@ os_fchown(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -1353,11 +1318,6 @@ os_mkdir(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
goto skip_optional_pos;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -1403,11 +1363,6 @@ os_nice(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int increment;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
increment = _PyLong_AsInt(arg);
if (increment == -1 && PyErr_Occurred()) {
goto exit;
@@ -1448,20 +1403,10 @@ os_getpriority(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
which = _PyLong_AsInt(args[0]);
if (which == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
who = _PyLong_AsInt(args[1]);
if (who == -1 && PyErr_Occurred()) {
goto exit;
@@ -1503,29 +1448,14 @@ os_setpriority(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
which = _PyLong_AsInt(args[0]);
if (which == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
who = _PyLong_AsInt(args[1]);
if (who == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
priority = _PyLong_AsInt(args[2]);
if (priority == -1 && PyErr_Occurred()) {
goto exit;
@@ -1828,11 +1758,6 @@ os_umask(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int mask;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mask = _PyLong_AsInt(arg);
if (mask == -1 && PyErr_Occurred()) {
goto exit;
@@ -2093,11 +2018,6 @@ os__exit(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
status = _PyLong_AsInt(args[0]);
if (status == -1 && PyErr_Occurred()) {
goto exit;
@@ -2289,11 +2209,6 @@ os_posix_spawn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
}
}
if (args[5]) {
- if (PyFloat_Check(args[5])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
resetids = _PyLong_AsInt(args[5]);
if (resetids == -1 && PyErr_Occurred()) {
goto exit;
@@ -2303,11 +2218,6 @@ os_posix_spawn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
}
}
if (args[6]) {
- if (PyFloat_Check(args[6])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
setsid = _PyLong_AsInt(args[6]);
if (setsid == -1 && PyErr_Occurred()) {
goto exit;
@@ -2426,11 +2336,6 @@ os_posix_spawnp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
}
}
if (args[5]) {
- if (PyFloat_Check(args[5])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
resetids = _PyLong_AsInt(args[5]);
if (resetids == -1 && PyErr_Occurred()) {
goto exit;
@@ -2440,11 +2345,6 @@ os_posix_spawnp(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
}
}
if (args[6]) {
- if (PyFloat_Check(args[6])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
setsid = _PyLong_AsInt(args[6]);
if (setsid == -1 && PyErr_Occurred()) {
goto exit;
@@ -2510,11 +2410,6 @@ os_spawnv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("spawnv", nargs, 3, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[0]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -2570,11 +2465,6 @@ os_spawnve(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("spawnve", nargs, 4, 4)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[0]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -2738,11 +2628,6 @@ os_sched_get_priority_max(PyObject *module, PyObject *const *args, Py_ssize_t na
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
policy = _PyLong_AsInt(args[0]);
if (policy == -1 && PyErr_Occurred()) {
goto exit;
@@ -2782,11 +2667,6 @@ os_sched_get_priority_min(PyObject *module, PyObject *const *args, Py_ssize_t na
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
policy = _PyLong_AsInt(args[0]);
if (policy == -1 && PyErr_Occurred()) {
goto exit;
@@ -3288,11 +3168,6 @@ os_getgrouplist(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
basegid = _PyLong_AsInt(args[1]);
if (basegid == -1 && PyErr_Occurred()) {
goto exit;
@@ -3411,11 +3286,6 @@ os_initgroups(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!PyUnicode_FSConverter(args[0], &oname)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
gid = _PyLong_AsInt(args[1]);
if (gid == -1 && PyErr_Occurred()) {
goto exit;
@@ -3709,11 +3579,6 @@ os_plock(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int op;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
op = _PyLong_AsInt(arg);
if (op == -1 && PyErr_Occurred()) {
goto exit;
@@ -3969,11 +3834,6 @@ os_wait3(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
options = _PyLong_AsInt(args[0]);
if (options == -1 && PyErr_Occurred()) {
goto exit;
@@ -4477,11 +4337,6 @@ os_tcgetpgrp(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -4565,11 +4420,6 @@ os_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
if (!path_converter(args[0], &path)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -4578,11 +4428,6 @@ os_open(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
goto skip_optional_pos;
}
if (args[2]) {
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[2]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -4637,11 +4482,6 @@ os_close(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -4674,20 +4514,10 @@ os_closerange(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("closerange", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd_low = _PyLong_AsInt(args[0]);
if (fd_low == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd_high = _PyLong_AsInt(args[1]);
if (fd_high == -1 && PyErr_Occurred()) {
goto exit;
@@ -4717,11 +4547,6 @@ os_dup(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -4765,20 +4590,10 @@ os_dup2(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwn
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd2 = _PyLong_AsInt(args[1]);
if (fd2 == -1 && PyErr_Occurred()) {
goto exit;
@@ -4833,20 +4648,10 @@ os_lockf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("lockf", nargs, 3, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
command = _PyLong_AsInt(args[1]);
if (command == -1 && PyErr_Occurred()) {
goto exit;
@@ -4889,11 +4694,6 @@ os_lseek(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("lseek", nargs, 3, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -4901,11 +4701,6 @@ os_lseek(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!Py_off_t_converter(args[1], &position)) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
how = _PyLong_AsInt(args[2]);
if (how == -1 && PyErr_Occurred()) {
goto exit;
@@ -4942,20 +4737,10 @@ os_read(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("read", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
@@ -5007,11 +4792,6 @@ os_readv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("readv", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5057,20 +4837,10 @@ os_pread(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("pread", nargs, 3, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[1]);
@@ -5136,11 +4906,6 @@ os_preadv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("preadv", nargs, 3, 4)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5152,11 +4917,6 @@ os_preadv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 4) {
goto skip_optional;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[3]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -5197,11 +4957,6 @@ os_write(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("write", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5265,20 +5020,10 @@ os_sendfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
out_fd = _PyLong_AsInt(args[0]);
if (out_fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
in_fd = _PyLong_AsInt(args[1]);
if (in_fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5304,11 +5049,6 @@ os_sendfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
goto skip_optional_pos;
}
}
- if (PyFloat_Check(args[6])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[6]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -5359,20 +5099,10 @@ os_sendfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
out_fd = _PyLong_AsInt(args[0]);
if (out_fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
in_fd = _PyLong_AsInt(args[1]);
if (in_fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5380,11 +5110,6 @@ os_sendfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!Py_off_t_converter(args[2], &offset)) {
goto exit;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[3]);
@@ -5412,11 +5137,6 @@ os_sendfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
goto skip_optional_pos;
}
}
- if (PyFloat_Check(args[6])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[6]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -5461,30 +5181,15 @@ os_sendfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
out_fd = _PyLong_AsInt(args[0]);
if (out_fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
in_fd = _PyLong_AsInt(args[1]);
if (in_fd == -1 && PyErr_Occurred()) {
goto exit;
}
offobj = args[2];
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[3]);
@@ -5530,29 +5235,14 @@ os__fcopyfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("_fcopyfile", nargs, 3, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
in_fd = _PyLong_AsInt(args[0]);
if (in_fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
out_fd = _PyLong_AsInt(args[1]);
if (out_fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[2]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -5593,11 +5283,6 @@ os_fstat(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5630,11 +5315,6 @@ os_isatty(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5700,11 +5380,6 @@ os_pipe2(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int flags;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(arg);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -5745,11 +5420,6 @@ os_writev(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("writev", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5797,11 +5467,6 @@ os_pwrite(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("pwrite", nargs, 3, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5875,11 +5540,6 @@ os_pwritev(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("pwritev", nargs, 3, 4)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -5891,11 +5551,6 @@ os_pwritev(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 4) {
goto skip_optional;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[3]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -5961,29 +5616,14 @@ os_copy_file_range(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
src = _PyLong_AsInt(args[0]);
if (src == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
dst = _PyLong_AsInt(args[1]);
if (dst == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
@@ -6057,11 +5697,6 @@ os_mkfifo(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
goto skip_optional_pos;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -6140,11 +5775,6 @@ os_mknod(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kw
goto skip_optional_pos;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -6277,20 +5907,10 @@ os_makedev(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("makedev", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
major = _PyLong_AsInt(args[0]);
if (major == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
minor = _PyLong_AsInt(args[1]);
if (minor == -1 && PyErr_Occurred()) {
goto exit;
@@ -6331,11 +5951,6 @@ os_ftruncate(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("ftruncate", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -6428,11 +6043,6 @@ os_posix_fallocate(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("posix_fallocate", nargs, 3, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -6486,11 +6096,6 @@ os_posix_fadvise(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("posix_fadvise", nargs, 4, 4)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -6501,11 +6106,6 @@ os_posix_fadvise(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!Py_off_t_converter(args[2], &length)) {
goto exit;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
advice = _PyLong_AsInt(args[3]);
if (advice == -1 && PyErr_Occurred()) {
goto exit;
@@ -6697,11 +6297,6 @@ os_strerror(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int code;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
code = _PyLong_AsInt(arg);
if (code == -1 && PyErr_Occurred()) {
goto exit;
@@ -6733,11 +6328,6 @@ os_WCOREDUMP(PyObject *module, PyObject *arg)
int status;
int _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
status = _PyLong_AsInt(arg);
if (status == -1 && PyErr_Occurred()) {
goto exit;
@@ -6785,11 +6375,6 @@ os_WIFCONTINUED(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
status = _PyLong_AsInt(args[0]);
if (status == -1 && PyErr_Occurred()) {
goto exit;
@@ -6834,11 +6419,6 @@ os_WIFSTOPPED(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
status = _PyLong_AsInt(args[0]);
if (status == -1 && PyErr_Occurred()) {
goto exit;
@@ -6883,11 +6463,6 @@ os_WIFSIGNALED(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
status = _PyLong_AsInt(args[0]);
if (status == -1 && PyErr_Occurred()) {
goto exit;
@@ -6932,11 +6507,6 @@ os_WIFEXITED(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
status = _PyLong_AsInt(args[0]);
if (status == -1 && PyErr_Occurred()) {
goto exit;
@@ -6981,11 +6551,6 @@ os_WEXITSTATUS(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
status = _PyLong_AsInt(args[0]);
if (status == -1 && PyErr_Occurred()) {
goto exit;
@@ -7030,11 +6595,6 @@ os_WTERMSIG(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
status = _PyLong_AsInt(args[0]);
if (status == -1 && PyErr_Occurred()) {
goto exit;
@@ -7079,11 +6639,6 @@ os_WSTOPSIG(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
status = _PyLong_AsInt(args[0]);
if (status == -1 && PyErr_Occurred()) {
goto exit;
@@ -7122,11 +6677,6 @@ os_fstatvfs(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -7252,11 +6802,6 @@ os_fpathconf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("fpathconf", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -7526,11 +7071,6 @@ os_device_encoding(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -7788,11 +7328,6 @@ os_setxattr(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
goto skip_optional_pos;
}
if (args[3]) {
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[3]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -7974,11 +7509,6 @@ os_urandom(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
Py_ssize_t size;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(arg);
@@ -8031,11 +7561,6 @@ os_memfd_create(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
if (!noptargs) {
goto skip_optional_pos;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
if (flags == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -8090,11 +7615,6 @@ os_get_terminal_size(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -8149,11 +7669,6 @@ os_get_inheritable(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -8190,20 +7705,10 @@ os_set_inheritable(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("set_inheritable", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
inheritable = _PyLong_AsInt(args[1]);
if (inheritable == -1 && PyErr_Occurred()) {
goto exit;
@@ -8307,11 +7812,6 @@ os_get_blocking(PyObject *module, PyObject *arg)
int fd;
int _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -8355,20 +7855,10 @@ os_set_blocking(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("set_blocking", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
blocking = _PyLong_AsInt(args[1]);
if (blocking == -1 && PyErr_Occurred()) {
goto exit;
@@ -8667,11 +8157,6 @@ os_getrandom(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -8687,11 +8172,6 @@ os_getrandom(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
if (!noptargs) {
goto skip_optional_pos;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -9396,4 +8876,4 @@ exit:
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
-/*[clinic end generated code: output=005919eaaef3f8e6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b97bbc8cb5078540 input=a9049054013a1b77]*/
diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h
index ee5907c..923ca6b 100644
--- a/Modules/clinic/pyexpat.c.h
+++ b/Modules/clinic/pyexpat.c.h
@@ -31,11 +31,6 @@ pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *const *args, Py_ssize_t
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
isfinal = _PyLong_AsInt(args[1]);
if (isfinal == -1 && PyErr_Occurred()) {
goto exit;
@@ -221,11 +216,6 @@ pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *arg)
PyObject *return_value = NULL;
int flag;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(arg);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
@@ -384,11 +374,6 @@ pyexpat_ErrorString(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
long code;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
code = PyLong_AsLong(arg);
if (code == -1 && PyErr_Occurred()) {
goto exit;
@@ -402,4 +387,4 @@ exit:
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define 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]*/
diff --git a/Modules/clinic/resource.c.h b/Modules/clinic/resource.c.h
index 80efb71..32c092a 100644
--- a/Modules/clinic/resource.c.h
+++ b/Modules/clinic/resource.c.h
@@ -19,11 +19,6 @@ resource_getrusage(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int who;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
who = _PyLong_AsInt(arg);
if (who == -1 && PyErr_Occurred()) {
goto exit;
@@ -51,11 +46,6 @@ resource_getrlimit(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int resource;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
resource = _PyLong_AsInt(arg);
if (resource == -1 && PyErr_Occurred()) {
goto exit;
@@ -87,11 +77,6 @@ resource_setrlimit(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("setrlimit", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
resource = _PyLong_AsInt(args[0]);
if (resource == -1 && PyErr_Occurred()) {
goto exit;
@@ -178,4 +163,4 @@ exit:
#ifndef RESOURCE_PRLIMIT_METHODDEF
#define RESOURCE_PRLIMIT_METHODDEF
#endif /* !defined(RESOURCE_PRLIMIT_METHODDEF) */
-/*[clinic end generated code: output=ef3034f291156a34 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ad190fb33d647d1e input=a9049054013a1b77]*/
diff --git a/Modules/clinic/selectmodule.c.h b/Modules/clinic/selectmodule.c.h
index 888054b..cd7f384 100644
--- a/Modules/clinic/selectmodule.c.h
+++ b/Modules/clinic/selectmodule.c.h
@@ -528,11 +528,6 @@ select_epoll(PyTypeObject *type, PyObject *args, PyObject *kwargs)
goto skip_optional_pos;
}
if (fastargs[0]) {
- if (PyFloat_Check(fastargs[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
sizehint = _PyLong_AsInt(fastargs[0]);
if (sizehint == -1 && PyErr_Occurred()) {
goto exit;
@@ -541,11 +536,6 @@ select_epoll(PyTypeObject *type, PyObject *args, PyObject *kwargs)
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]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -625,11 +615,6 @@ select_epoll_fromfd(PyTypeObject *type, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -685,11 +670,6 @@ select_epoll_register(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t na
if (!noptargs) {
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]);
if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
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)) {
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]);
if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -846,11 +821,6 @@ select_epoll_poll(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs,
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]);
if (maxevents == -1 && PyErr_Occurred()) {
goto exit;
@@ -1041,11 +1011,6 @@ select_kqueue_fromfd(PyTypeObject *type, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -1094,11 +1059,6 @@ select_kqueue_control(kqueue_queue_Object *self, PyObject *const *args, Py_ssize
goto exit;
}
changelist = args[0];
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
maxevents = _PyLong_AsInt(args[1]);
if (maxevents == -1 && PyErr_Occurred()) {
goto exit;
@@ -1215,4 +1175,4 @@ exit:
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define 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]*/
diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h
index 7f60e28..33a278e 100644
--- a/Modules/clinic/signalmodule.c.h
+++ b/Modules/clinic/signalmodule.c.h
@@ -23,11 +23,6 @@ signal_alarm(PyObject *module, PyObject *arg)
int seconds;
long _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
seconds = _PyLong_AsInt(arg);
if (seconds == -1 && PyErr_Occurred()) {
goto exit;
@@ -84,11 +79,6 @@ signal_raise_signal(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int signalnum;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
signalnum = _PyLong_AsInt(arg);
if (signalnum == -1 && PyErr_Occurred()) {
goto exit;
@@ -128,11 +118,6 @@ signal_signal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("signal", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
signalnum = _PyLong_AsInt(args[0]);
if (signalnum == -1 && PyErr_Occurred()) {
goto exit;
@@ -168,11 +153,6 @@ signal_getsignal(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int signalnum;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
signalnum = _PyLong_AsInt(arg);
if (signalnum == -1 && PyErr_Occurred()) {
goto exit;
@@ -204,11 +184,6 @@ signal_strsignal(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int signalnum;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
signalnum = _PyLong_AsInt(arg);
if (signalnum == -1 && PyErr_Occurred()) {
goto exit;
@@ -246,20 +221,10 @@ signal_siginterrupt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("siginterrupt", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
signalnum = _PyLong_AsInt(args[0]);
if (signalnum == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(args[1]);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
@@ -303,11 +268,6 @@ signal_setitimer(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("setitimer", nargs, 2, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
which = _PyLong_AsInt(args[0]);
if (which == -1 && PyErr_Occurred()) {
goto exit;
@@ -346,11 +306,6 @@ signal_getitimer(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int which;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
which = _PyLong_AsInt(arg);
if (which == -1 && PyErr_Occurred()) {
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
how = _PyLong_AsInt(args[0]);
if (how == -1 && PyErr_Occurred()) {
goto exit;
@@ -594,11 +544,6 @@ signal_pthread_kill(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
goto exit;
}
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]);
if (signalnum == -1 && PyErr_Occurred()) {
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
pidfd = _PyLong_AsInt(args[0]);
if (pidfd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
signalnum = _PyLong_AsInt(args[1]);
if (signalnum == -1 && PyErr_Occurred()) {
goto exit;
@@ -663,11 +598,6 @@ signal_pidfd_send_signal(PyObject *module, PyObject *const *args, Py_ssize_t nar
if (nargs < 4) {
goto skip_optional;
}
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[3]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -732,4 +662,4 @@ exit:
#ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
#define 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]*/
diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h
index 77ea04a..2b72aeb 100644
--- a/Modules/clinic/zlibmodule.c.h
+++ b/Modules/clinic/zlibmodule.c.h
@@ -44,11 +44,6 @@ zlib_compress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
if (!noptargs) {
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]);
if (level == -1 && PyErr_Occurred()) {
goto exit;
@@ -112,11 +107,6 @@ zlib_decompress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos;
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
wbits = _PyLong_AsInt(args[1]);
if (wbits == -1 && PyErr_Occurred()) {
goto exit;
@@ -125,8 +115,17 @@ zlib_decompress(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
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:
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;
}
if (args[0]) {
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
level = _PyLong_AsInt(args[0]);
if (level == -1 && PyErr_Occurred()) {
goto exit;
@@ -214,11 +208,6 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
}
}
if (args[1]) {
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
method = _PyLong_AsInt(args[1]);
if (method == -1 && PyErr_Occurred()) {
goto exit;
@@ -228,11 +217,6 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
}
}
if (args[2]) {
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
wbits = _PyLong_AsInt(args[2]);
if (wbits == -1 && PyErr_Occurred()) {
goto exit;
@@ -242,11 +226,6 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
}
}
if (args[3]) {
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
memLevel = _PyLong_AsInt(args[3]);
if (memLevel == -1 && PyErr_Occurred()) {
goto exit;
@@ -256,11 +235,6 @@ zlib_compressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
}
}
if (args[4]) {
- if (PyFloat_Check(args[4])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
strategy = _PyLong_AsInt(args[4]);
if (strategy == -1 && PyErr_Occurred()) {
goto exit;
@@ -325,11 +299,6 @@ zlib_decompressobj(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
goto skip_optional_pos;
}
if (args[0]) {
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
wbits = _PyLong_AsInt(args[0]);
if (wbits == -1 && PyErr_Occurred()) {
goto exit;
@@ -438,8 +407,17 @@ zlib_Decompress_decompress(compobject *self, PyObject *const *args, Py_ssize_t n
if (!noptargs) {
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:
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) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[0]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -636,8 +609,17 @@ zlib_Decompress_flush(compobject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
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:
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) {
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]);
if (value == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -741,11 +718,6 @@ zlib_crc32(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) {
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]);
if (value == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -785,4 +757,4 @@ exit:
#ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#define 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]*/
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c
index cdb3ae8..c4d1681 100644
--- a/Modules/grpmodule.c
+++ b/Modules/grpmodule.c
@@ -111,30 +111,14 @@ static PyObject *
grp_getgrgid_impl(PyObject *module, PyObject *id)
/*[clinic end generated code: output=30797c289504a1ba input=15fa0e2ccf5cda25]*/
{
- PyObject *py_int_id, *retval = NULL;
+ PyObject *retval = NULL;
int nomem = 0;
char *buf = NULL, *buf2 = NULL;
gid_t gid;
struct group *p;
if (!_Py_Gid_Converter(id, &gid)) {
- if (!PyErr_ExceptionMatches(PyExc_TypeError)) {
- 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);
+ return NULL;
}
#ifdef HAVE_GETGRGID_R
int status;
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index f1d59c0..5b96631 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -2047,37 +2047,9 @@ math_factorial(PyObject *module, PyObject *arg)
{
long x, two_valuation;
int overflow;
- PyObject *result, *odd_part, *pyint_form;
-
- 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);
- }
+ PyObject *result, *odd_part;
+ x = PyLong_AsLongAndOverflow(arg, &overflow);
if (x == -1 && PyErr_Occurred()) {
return NULL;
}
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index ddff283..59ac47d 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -13903,11 +13903,6 @@ static PyObject *
os_waitstatus_to_exitcode_impl(PyObject *module, PyObject *status_obj)
/*[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
int status = _PyLong_AsInt(status_obj);
if (status == -1 && PyErr_Occurred()) {
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 580ac0a..92c246e 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -5196,13 +5196,6 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds)
else
#endif
{
-
- if (PyFloat_Check(fdobj)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float");
- return -1;
- }
-
fd = PyLong_AsSocket_t(fdobj);
if (fd == (SOCKET_T)(-1) && PyErr_Occurred())
return -1;
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index fe27909..fd30649 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -287,37 +287,6 @@ zlib_compress_impl(PyObject *module, Py_buffer *data, int level)
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]
zlib.decompress
@@ -326,7 +295,7 @@ zlib.decompress
/
wbits: int(c_default="MAX_WBITS") = MAX_WBITS
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.
Returns a bytes object containing the uncompressed data.
@@ -335,7 +304,7 @@ Returns a bytes object containing the uncompressed data.
static PyObject *
zlib_decompress_impl(PyObject *module, Py_buffer *data, int wbits,
Py_ssize_t bufsize)
-/*[clinic end generated code: output=77c7e35111dc8c42 input=21960936208e9a5b]*/
+/*[clinic end generated code: output=77c7e35111dc8c42 input=a9ac17beff1f893f]*/
{
PyObject *RetVal = NULL;
Byte *ibuf;
@@ -756,7 +725,7 @@ zlib.Decompress.decompress
data: Py_buffer
The binary data to decompress.
/
- max_length: ssize_t = 0
+ max_length: Py_ssize_t = 0
The maximum allowable length of the decompressed data.
Unconsumed input data will be stored in
the unconsumed_tail attribute.
@@ -771,7 +740,7 @@ Call the flush() method to clear these buffers.
static PyObject *
zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data,
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;
Py_ssize_t ibuflen, obuflen = DEF_BUF_SIZE, hard_limit;
@@ -1113,7 +1082,7 @@ zlib_Decompress___deepcopy__(compobject *self, PyObject *memo)
/*[clinic input]
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.
/
@@ -1122,7 +1091,7 @@ Return a bytes object containing any remaining decompressed data.
static PyObject *
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;
Py_buffer data;
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 5b85b01..e819849 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1426,14 +1426,32 @@ PyNumber_Long(PyObject *o)
}
m = Py_TYPE(o)->tp_as_number;
if (m && m->nb_int) { /* This should include subclasses of int */
- result = _PyLong_FromNbInt(o);
- if (result != NULL && !PyLong_CheckExact(result)) {
- Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
+ /* Convert using the nb_int slot, which should return something
+ of exact type int. */
+ 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;
}
if (m && m->nb_index) {
- result = _PyLong_FromNbIndexOrNbInt(o);
+ result = PyNumber_Index(o);
if (result != NULL && !PyLong_CheckExact(result)) {
Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
}
@@ -1452,8 +1470,7 @@ PyNumber_Long(PyObject *o)
}
/* __trunc__ is specified to return an Integral type,
but int() needs to return an int. */
- m = Py_TYPE(result)->tp_as_number;
- if (m == NULL || (m->nb_index == NULL && m->nb_int == NULL)) {
+ if (!PyIndex_Check(result)) {
PyErr_Format(
PyExc_TypeError,
"__trunc__ returned non-Integral (type %.200s)",
@@ -1461,7 +1478,7 @@ PyNumber_Long(PyObject *o)
Py_DECREF(result);
return NULL;
}
- Py_SETREF(result, _PyLong_FromNbIndexOrNbInt(result));
+ Py_SETREF(result, PyNumber_Index(result));
if (result != NULL && !PyLong_CheckExact(result)) {
Py_SETREF(result, _PyLong_Copy((PyLongObject *)result));
}
diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h
index 35ba1ff..83b0d03 100644
--- a/Objects/clinic/bytearrayobject.c.h
+++ b/Objects/clinic/bytearrayobject.c.h
@@ -268,11 +268,6 @@ bytearray_replace(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t nar
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -617,11 +597,6 @@ bytearray_pop(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -896,11 +871,6 @@ bytearray_splitlines(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t
if (!noptargs) {
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]);
if (keepends == -1 && PyErr_Occurred()) {
goto exit;
@@ -1000,11 +970,6 @@ bytearray_hex(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t nargs,
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]);
if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit;
@@ -1058,11 +1023,6 @@ bytearray_reduce_ex(PyByteArrayObject *self, PyObject *const *args, Py_ssize_t n
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
proto = _PyLong_AsInt(args[0]);
if (proto == -1 && PyErr_Occurred()) {
goto exit;
@@ -1091,4 +1051,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_sizeof_impl(self);
}
-/*[clinic end generated code: output=b2919f76709e48dc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=920748990279fb9d input=a9049054013a1b77]*/
diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h
index 063a377..c4a2d0c 100644
--- a/Objects/clinic/bytesobject.c.h
+++ b/Objects/clinic/bytesobject.c.h
@@ -46,11 +46,6 @@ bytes_split(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
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;
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;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
@@ -715,11 +700,6 @@ bytes_splitlines(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, P
if (!noptargs) {
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]);
if (keepends == -1 && PyErr_Occurred()) {
goto exit;
@@ -819,11 +799,6 @@ bytes_hex(PyBytesObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
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]);
if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit;
@@ -834,4 +809,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=220388917d7bf751 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a0c31faea2671a8c input=a9049054013a1b77]*/
diff --git a/Objects/clinic/codeobject.c.h b/Objects/clinic/codeobject.c.h
index 1dd8227..aef505f 100644
--- a/Objects/clinic/codeobject.c.h
+++ b/Objects/clinic/codeobject.c.h
@@ -59,11 +59,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
goto skip_optional_kwonly;
}
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]);
if (co_argcount == -1 && PyErr_Occurred()) {
goto exit;
@@ -73,11 +68,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
}
}
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]);
if (co_posonlyargcount == -1 && PyErr_Occurred()) {
goto exit;
@@ -87,11 +77,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
}
}
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]);
if (co_kwonlyargcount == -1 && PyErr_Occurred()) {
goto exit;
@@ -101,11 +86,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
}
}
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]);
if (co_nlocals == -1 && PyErr_Occurred()) {
goto exit;
@@ -115,11 +95,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
}
}
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]);
if (co_stacksize == -1 && PyErr_Occurred()) {
goto exit;
@@ -129,11 +104,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
}
}
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]);
if (co_flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -143,11 +113,6 @@ code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObje
}
}
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]);
if (co_firstlineno == -1 && PyErr_Occurred()) {
goto exit;
@@ -253,4 +218,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=27fe34e82106b220 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f9f23e912a3955b9 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/listobject.c.h b/Objects/clinic/listobject.c.h
index ed137c9..82884a4 100644
--- a/Objects/clinic/listobject.c.h
+++ b/Objects/clinic/listobject.c.h
@@ -24,11 +24,6 @@ list_insert(PyListObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -128,11 +123,6 @@ list_pop(PyListObject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
reverse = _PyLong_AsInt(args[1]);
if (reverse == -1 && PyErr_Occurred()) {
goto exit;
@@ -367,4 +352,4 @@ list___reversed__(PyListObject *self, PyObject *Py_UNUSED(ignored))
{
return list___reversed___impl(self);
}
-/*[clinic end generated code: output=1ff61490c091d165 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=137db7b11196b581 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h
index 27e8dfe..d3d5c19 100644
--- a/Objects/clinic/longobject.c.h
+++ b/Objects/clinic/longobject.c.h
@@ -209,11 +209,6 @@ int_to_bytes(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -313,4 +308,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=77bc3b2615822cb8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=46d40c8aa6d420b7 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/memoryobject.c.h b/Objects/clinic/memoryobject.c.h
index 75ac201..8227f0e 100644
--- a/Objects/clinic/memoryobject.c.h
+++ b/Objects/clinic/memoryobject.c.h
@@ -56,11 +56,6 @@ memoryview_hex(PyMemoryViewObject *self, PyObject *const *args, Py_ssize_t nargs
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]);
if (bytes_per_sep == -1 && PyErr_Occurred()) {
goto exit;
@@ -71,4 +66,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=ee265a73f68b0077 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=91106ef704134b19 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/typeobject.c.h b/Objects/clinic/typeobject.c.h
index 357eb44..8c70d76 100644
--- a/Objects/clinic/typeobject.c.h
+++ b/Objects/clinic/typeobject.c.h
@@ -166,11 +166,6 @@ object___reduce_ex__(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
int protocol;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
protocol = _PyLong_AsInt(arg);
if (protocol == -1 && PyErr_Occurred()) {
goto exit;
@@ -248,4 +243,4 @@ object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return object___dir___impl(self);
}
-/*[clinic end generated code: output=7a6d272d282308f3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b4fb62939b08baf9 input=a9049054013a1b77]*/
diff --git a/Objects/clinic/unicodeobject.c.h b/Objects/clinic/unicodeobject.c.h
index cf81df4..2d81730 100644
--- a/Objects/clinic/unicodeobject.c.h
+++ b/Objects/clinic/unicodeobject.c.h
@@ -86,11 +86,6 @@ unicode_center(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("center", nargs, 1, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -224,11 +219,6 @@ unicode_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
if (!noptargs) {
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]);
if (tabsize == -1 && PyErr_Occurred()) {
goto exit;
@@ -530,11 +520,6 @@ unicode_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -730,11 +715,6 @@ unicode_replace(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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;
}
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -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) {
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]);
if (keepends == -1 && PyErr_Occurred()) {
goto exit;
@@ -1231,11 +1191,6 @@ unicode_zfill(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
Py_ssize_t width;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(arg);
@@ -1303,4 +1258,4 @@ unicode_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return unicode_sizeof_impl(self);
}
-/*[clinic end generated code: output=b91233f3722643be input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ea1aff10c743be14 input=a9049054013a1b77]*/
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 0ff0e80..a409948 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -119,123 +119,6 @@ long_normalize(PyLongObject *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.
Return NULL and set exception if we run out of memory. */
@@ -511,7 +394,7 @@ PyLong_AsLongAndOverflow(PyObject *vv, int *overflow)
v = (PyLongObject *)vv;
}
else {
- v = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(vv);
+ v = (PyLongObject *)PyNumber_Index(vv);
if (v == NULL)
return -1;
do_decref = 1;
@@ -791,7 +674,7 @@ PyLong_AsUnsignedLongMask(PyObject *op)
return _PyLong_AsUnsignedLongMask(op);
}
- lo = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(op);
+ lo = (PyLongObject *)PyNumber_Index(op);
if (lo == NULL)
return (unsigned long)-1;
@@ -1249,7 +1132,7 @@ PyLong_AsLongLong(PyObject *vv)
v = (PyLongObject *)vv;
}
else {
- v = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(vv);
+ v = (PyLongObject *)PyNumber_Index(vv);
if (v == NULL)
return -1;
do_decref = 1;
@@ -1364,7 +1247,7 @@ PyLong_AsUnsignedLongLongMask(PyObject *op)
return _PyLong_AsUnsignedLongLongMask(op);
}
- lo = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(op);
+ lo = (PyLongObject *)PyNumber_Index(op);
if (lo == NULL)
return (unsigned long long)-1;
@@ -1404,7 +1287,7 @@ PyLong_AsLongLongAndOverflow(PyObject *vv, int *overflow)
v = (PyLongObject *)vv;
}
else {
- v = (PyLongObject *)_PyLong_FromNbIndexOrNbInt(vv);
+ v = (PyLongObject *)PyNumber_Index(vv);
if (v == NULL)
return -1;
do_decref = 1;
diff --git a/Objects/stringlib/clinic/transmogrify.h.h b/Objects/stringlib/clinic/transmogrify.h.h
index 8a3a060..8dd7e6b 100644
--- a/Objects/stringlib/clinic/transmogrify.h.h
+++ b/Objects/stringlib/clinic/transmogrify.h.h
@@ -33,11 +33,6 @@ stringlib_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, Py
if (!noptargs) {
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]);
if (tabsize == -1 && PyErr_Occurred()) {
goto exit;
@@ -73,11 +68,6 @@ stringlib_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
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)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[0]);
@@ -252,11 +232,6 @@ stringlib_zfill(PyObject *self, PyObject *arg)
PyObject *return_value = NULL;
Py_ssize_t width;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(arg);
@@ -274,4 +249,4 @@ stringlib_zfill(PyObject *self, PyObject *arg)
exit:
return return_value;
}
-/*[clinic end generated code: output=15be047aef999b4e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=cd5ecdbf1d9e849a input=a9049054013a1b77]*/
diff --git a/PC/clinic/msvcrtmodule.c.h b/PC/clinic/msvcrtmodule.c.h
index 180c3e5..9701e8a 100644
--- a/PC/clinic/msvcrtmodule.c.h
+++ b/PC/clinic/msvcrtmodule.c.h
@@ -53,29 +53,14 @@ msvcrt_locking(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("locking", nargs, 3, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
nbytes = PyLong_AsLong(args[2]);
if (nbytes == -1 && PyErr_Occurred()) {
goto exit;
@@ -114,20 +99,10 @@ msvcrt_setmode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("setmode", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -201,11 +176,6 @@ msvcrt_get_osfhandle(PyObject *module, PyObject *arg)
int fd;
void *_return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -561,20 +531,10 @@ msvcrt_CrtSetReportMode(PyObject *module, PyObject *const *args, Py_ssize_t narg
if (!_PyArg_CheckPositional("CrtSetReportMode", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
type = _PyLong_AsInt(args[0]);
if (type == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -614,11 +574,6 @@ msvcrt_set_error_mode(PyObject *module, PyObject *arg)
int mode;
long _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(arg);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -653,11 +608,6 @@ msvcrt_SetErrorMode(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
unsigned int mode;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = (unsigned int)PyLong_AsUnsignedLongMask(arg);
if (mode == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -679,4 +629,4 @@ exit:
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
#define 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]*/
diff --git a/PC/clinic/winreg.c.h b/PC/clinic/winreg.c.h
index b7af185..5f37fcd 100644
--- a/PC/clinic/winreg.c.h
+++ b/PC/clinic/winreg.c.h
@@ -435,11 +435,6 @@ winreg_EnumKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!clinic_HKEY_converter(args[0], &key)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
index = _PyLong_AsInt(args[1]);
if (index == -1 && PyErr_Occurred()) {
goto exit;
@@ -493,11 +488,6 @@ winreg_EnumValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!clinic_HKEY_converter(args[0], &key)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
index = _PyLong_AsInt(args[1]);
if (index == -1 && PyErr_Occurred()) {
goto exit;
@@ -1121,4 +1111,4 @@ winreg_QueryReflectionKey(PyObject *module, PyObject *arg)
exit:
return return_value;
}
-/*[clinic end generated code: output=015afbbd690eb59d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f4f996d40d06f14c input=a9049054013a1b77]*/
diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h
index b37db4c..c545899 100644
--- a/PC/clinic/winsound.c.h
+++ b/PC/clinic/winsound.c.h
@@ -34,11 +34,6 @@ winsound_PlaySound(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
goto exit;
}
sound = args[0];
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -81,20 +76,10 @@ winsound_Beep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
frequency = _PyLong_AsInt(args[0]);
if (frequency == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
duration = _PyLong_AsInt(args[1]);
if (duration == -1 && PyErr_Occurred()) {
goto exit;
@@ -136,11 +121,6 @@ winsound_MessageBeep(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
if (!noptargs) {
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]);
if (type == -1 && PyErr_Occurred()) {
goto exit;
@@ -151,4 +131,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=28d1cd033282723d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=16b3c1a96861cd3a input=a9049054013a1b77]*/
diff --git a/Python/clinic/_warnings.c.h b/Python/clinic/_warnings.c.h
index 67ab0e3..80ed2ae 100644
--- a/Python/clinic/_warnings.c.h
+++ b/Python/clinic/_warnings.c.h
@@ -43,11 +43,6 @@ warnings_warn(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
}
}
if (args[2]) {
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index(args[2]);
@@ -71,4 +66,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=b7bb54c73b5433ec input=a9049054013a1b77]*/
+/*[clinic end generated code: output=484e5ffe94edf0f0 input=a9049054013a1b77]*/
diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h
index d15af1f..377afde 100644
--- a/Python/clinic/bltinmodule.c.h
+++ b/Python/clinic/bltinmodule.c.h
@@ -134,11 +134,6 @@ builtin_chr(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int i;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
i = _PyLong_AsInt(arg);
if (i == -1 && PyErr_Occurred()) {
goto exit;
@@ -216,11 +211,6 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
goto skip_optional_pos;
}
if (args[3]) {
- if (PyFloat_Check(args[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[3]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -230,11 +220,6 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
}
}
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]);
if (dont_inherit == -1 && PyErr_Occurred()) {
goto exit;
@@ -244,11 +229,6 @@ builtin_compile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObj
}
}
if (args[5]) {
- if (PyFloat_Check(args[5])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
optimize = _PyLong_AsInt(args[5]);
if (optimize == -1 && PyErr_Occurred()) {
goto exit;
@@ -261,11 +241,6 @@ skip_optional_pos:
if (!noptargs) {
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]);
if (feature_version == -1 && PyErr_Occurred()) {
goto exit;
@@ -855,4 +830,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=29686a89b739d600 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=780fd9712ec6a6db input=a9049054013a1b77]*/
diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h
index e4867f3..4e013cc 100644
--- a/Python/clinic/import.c.h
+++ b/Python/clinic/import.c.h
@@ -420,11 +420,6 @@ _imp_source_hash(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
key = PyLong_AsLong(args[0]);
if (key == -1 && PyErr_Occurred()) {
goto exit;
@@ -454,4 +449,4 @@ exit:
#ifndef _IMP_EXEC_DYNAMIC_METHODDEF
#define _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]*/
diff --git a/Python/clinic/marshal.c.h b/Python/clinic/marshal.c.h
index 05d4830..f80d5ef 100644
--- a/Python/clinic/marshal.c.h
+++ b/Python/clinic/marshal.c.h
@@ -42,11 +42,6 @@ marshal_dump(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 3) {
goto skip_optional;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
version = _PyLong_AsInt(args[2]);
if (version == -1 && PyErr_Occurred()) {
goto exit;
@@ -111,11 +106,6 @@ marshal_dumps(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 2) {
goto skip_optional;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
version = _PyLong_AsInt(args[1]);
if (version == -1 && PyErr_Occurred()) {
goto exit;
@@ -165,4 +155,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=a859dabe8b0afeb6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=68b78f38bfe0c06d input=a9049054013a1b77]*/
diff --git a/Python/clinic/sysmodule.c.h b/Python/clinic/sysmodule.c.h
index 4615eba..c1a9a2d 100644
--- a/Python/clinic/sysmodule.c.h
+++ b/Python/clinic/sysmodule.c.h
@@ -372,11 +372,6 @@ sys_setrecursionlimit(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int new_limit;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
new_limit = _PyLong_AsInt(arg);
if (new_limit == -1 && PyErr_Occurred()) {
goto exit;
@@ -417,11 +412,6 @@ sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args,
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
depth = _PyLong_AsInt(args[0]);
if (depth == -1 && PyErr_Occurred()) {
goto exit;
@@ -590,11 +580,6 @@ sys_setdlopenflags(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int new_val;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
new_val = _PyLong_AsInt(arg);
if (new_val == -1 && PyErr_Occurred()) {
goto exit;
@@ -650,11 +635,6 @@ sys_mdebug(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
int flag;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flag = _PyLong_AsInt(arg);
if (flag == -1 && PyErr_Occurred()) {
goto exit;
@@ -790,11 +770,6 @@ sys__getframe(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (nargs < 1) {
goto skip_optional;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
depth = _PyLong_AsInt(args[0]);
if (depth == -1 && PyErr_Occurred()) {
goto exit;
@@ -970,4 +945,4 @@ sys_getandroidapilevel(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef SYS_GETANDROIDAPILEVEL_METHODDEF
#define SYS_GETANDROIDAPILEVEL_METHODDEF
#endif /* !defined(SYS_GETANDROIDAPILEVEL_METHODDEF) */
-/*[clinic end generated code: output=39eb34a01fb9a919 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=87baa3357293ea65 input=a9049054013a1b77]*/
diff --git a/Python/clinic/traceback.c.h b/Python/clinic/traceback.c.h
index 04daf2a..404a0c4 100644
--- a/Python/clinic/traceback.c.h
+++ b/Python/clinic/traceback.c.h
@@ -36,20 +36,10 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
goto exit;
}
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]);
if (tb_lasti == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(fastargs[3])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
tb_lineno = _PyLong_AsInt(fastargs[3]);
if (tb_lineno == -1 && PyErr_Occurred()) {
goto exit;
@@ -59,4 +49,4 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=3def6c06248feed8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=403778d7af5ebef9 input=a9049054013a1b77]*/
diff --git a/Python/getargs.c b/Python/getargs.c
index 7742428..63afae2 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -643,22 +643,6 @@ converterr(const char *expected, PyObject *arg, char *msgbuf, size_t bufsize)
#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,
or a string with a message describing the failure. The message is
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 */
char *p = va_arg(*p_va, char *);
- long ival;
- if (float_argument_error(arg))
- RETURN_ERR_OCCURRED;
- ival = PyLong_AsLong(arg);
+ long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
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
values allowed */
char *p = va_arg(*p_va, char *);
- long ival;
- if (float_argument_error(arg))
- RETURN_ERR_OCCURRED;
- ival = PyLong_AsUnsignedLongMask(arg);
- if (ival == -1 && PyErr_Occurred())
+ unsigned long ival = PyLong_AsUnsignedLongMask(arg);
+ if (ival == (unsigned long)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
else
*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 */
short *p = va_arg(*p_va, short *);
- long ival;
- if (float_argument_error(arg))
- RETURN_ERR_OCCURRED;
- ival = PyLong_AsLong(arg);
+ long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
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
unsigned allowed */
unsigned short *p = va_arg(*p_va, unsigned short *);
- long ival;
- if (float_argument_error(arg))
- RETURN_ERR_OCCURRED;
- ival = PyLong_AsUnsignedLongMask(arg);
- if (ival == -1 && PyErr_Occurred())
+ unsigned long ival = PyLong_AsUnsignedLongMask(arg);
+ if (ival == (unsigned long)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
else
*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 */
int *p = va_arg(*p_va, int *);
- long ival;
- if (float_argument_error(arg))
- RETURN_ERR_OCCURRED;
- ival = PyLong_AsLong(arg);
+ long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
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
unsigned allowed */
unsigned int *p = va_arg(*p_va, unsigned int *);
- unsigned int ival;
- if (float_argument_error(arg))
- RETURN_ERR_OCCURRED;
- ival = (unsigned int)PyLong_AsUnsignedLongMask(arg);
- if (ival == (unsigned int)-1 && PyErr_Occurred())
+ unsigned long ival = PyLong_AsUnsignedLongMask(arg);
+ if (ival == (unsigned long)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
else
- *p = ival;
+ *p = (unsigned int) ival;
break;
}
@@ -818,8 +784,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
PyObject *iobj;
Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *);
Py_ssize_t ival = -1;
- if (float_argument_error(arg))
- RETURN_ERR_OCCURRED;
iobj = PyNumber_Index(arg);
if (iobj != NULL) {
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 */
long *p = va_arg(*p_va, long *);
- long ival;
- if (float_argument_error(arg))
- RETURN_ERR_OCCURRED;
- ival = PyLong_AsLong(arg);
+ long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
else
@@ -856,10 +817,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'L': {/* long long */
long long *p = va_arg( *p_va, long long * );
- long long ival;
- if (float_argument_error(arg))
- RETURN_ERR_OCCURRED;
- ival = PyLong_AsLongLong(arg);
+ long long ival = PyLong_AsLongLong(arg);
if (ival == (long long)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
else
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index b07ffdd..0f40e06 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -2736,11 +2736,6 @@ class bool_converter(CConverter):
# XXX PyFloat_Check can be removed after the end of the
# deprecation in _PyLong_FromNbIndexOrNbInt.
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{paramname} = _PyLong_AsInt({argname});
if ({paramname} == -1 && PyErr_Occurred()) {{{{
goto exit;
@@ -2821,11 +2816,6 @@ class unsigned_char_converter(CConverter):
def parse_arg(self, argname, displayname):
if self.format_unit == 'b':
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{{{{
long ival = PyLong_AsLong({argname});
if (ival == -1 && PyErr_Occurred()) {{{{
@@ -2848,14 +2838,9 @@ class unsigned_char_converter(CConverter):
""".format(argname=argname, paramname=self.name)
elif self.format_unit == 'B':
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{{{{
- long ival = PyLong_AsUnsignedLongMask({argname});
- if (ival == -1 && PyErr_Occurred()) {{{{
+ unsigned long ival = PyLong_AsUnsignedLongMask({argname});
+ if (ival == (unsigned long)-1 && PyErr_Occurred()) {{{{
goto exit;
}}}}
else {{{{
@@ -2876,11 +2861,6 @@ class short_converter(CConverter):
def parse_arg(self, argname, displayname):
if self.format_unit == 'h':
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{{{{
long ival = PyLong_AsLong({argname});
if (ival == -1 && PyErr_Occurred()) {{{{
@@ -2917,11 +2897,6 @@ class unsigned_short_converter(CConverter):
def parse_arg(self, argname, displayname):
if self.format_unit == 'H':
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{paramname} = (unsigned short)PyLong_AsUnsignedLongMask({argname});
if ({paramname} == (unsigned short)-1 && PyErr_Occurred()) {{{{
goto exit;
@@ -2947,11 +2922,6 @@ class int_converter(CConverter):
def parse_arg(self, argname, displayname):
if self.format_unit == 'i':
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{paramname} = _PyLong_AsInt({argname});
if ({paramname} == -1 && PyErr_Occurred()) {{{{
goto exit;
@@ -2989,11 +2959,6 @@ class unsigned_int_converter(CConverter):
def parse_arg(self, argname, displayname):
if self.format_unit == 'I':
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{paramname} = (unsigned int)PyLong_AsUnsignedLongMask({argname});
if ({paramname} == (unsigned int)-1 && PyErr_Occurred()) {{{{
goto exit;
@@ -3010,11 +2975,6 @@ class long_converter(CConverter):
def parse_arg(self, argname, displayname):
if self.format_unit == 'l':
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{paramname} = PyLong_AsLong({argname});
if ({paramname} == -1 && PyErr_Occurred()) {{{{
goto exit;
@@ -3054,11 +3014,6 @@ class long_long_converter(CConverter):
def parse_arg(self, argname, displayname):
if self.format_unit == 'L':
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{paramname} = PyLong_AsLongLong({argname});
if ({paramname} == -1 && PyErr_Occurred()) {{{{
goto exit;
@@ -3105,11 +3060,6 @@ class Py_ssize_t_converter(CConverter):
def parse_arg(self, argname, displayname):
if self.format_unit == 'n':
return """
- if (PyFloat_Check({argname})) {{{{
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }}}}
{{{{
Py_ssize_t ival = -1;
PyObject *iobj = PyNumber_Index({argname});