Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5597,7 +5597,8 @@ def through_init(cls):
return cls, partial(cls.__init__, cls(1))

entry_points = [
through_new(enumerate), # the only non-test @vectorcall function
through_new(enumerate),
through_new(float),
through_new(ac_tester.VcNew),
through_new(ac_tester.VcNewBase),
through_new(ac_tester.VcKwOnly),
Expand Down
31 changes: 30 additions & 1 deletion Objects/clinic/floatobject.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 2 additions & 18 deletions Objects/floatobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,7 @@ static PyObject *
float_subtype_new(PyTypeObject *type, PyObject *x);

/*[clinic input]
@vectorcall
@classmethod
float.__new__ as float_new
x: object(c_default="NULL") = 0
Expand All @@ -1565,7 +1566,7 @@ Convert a string or number to a floating-point number, if possible.

static PyObject *
float_new_impl(PyTypeObject *type, PyObject *x)
/*[clinic end generated code: output=ccf1e8dc460ba6ba input=55909f888aa0c8a6]*/
/*[clinic end generated code: output=ccf1e8dc460ba6ba input=39b40d663c372a91]*/
{
if (type != &PyFloat_Type) {
if (x == NULL) {
Expand Down Expand Up @@ -1609,23 +1610,6 @@ float_subtype_new(PyTypeObject *type, PyObject *x)
return newobj;
}

static PyObject *
float_vectorcall(PyObject *type, PyObject *const *args,
size_t nargsf, PyObject *kwnames)
{
if (!_PyArg_NoKwnames("float", kwnames)) {
return NULL;
}

Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
if (!_PyArg_CheckPositional("float", nargs, 0, 1)) {
return NULL;
}

PyObject *x = nargs >= 1 ? args[0] : NULL;
return float_new_impl(_PyType_CAST(type), x);
}


/*[clinic input]
@classmethod
Expand Down
Loading