mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
typing: Add more tests for TypeVar (#104571)
During the PEP 695 implementation at one point I made TypeVar.__name__ return garbage, and all of test_typing passed. So I decided to add a few more tests. In the process I discovered a minor incompatibility from the C implementation of TypeVar: empty constraints were returned as None instead of an empty tuple.
This commit is contained in:
parent
97db2f3e07
commit
26931944dd
3 changed files with 50 additions and 8 deletions
|
@ -271,7 +271,7 @@ typevar_constraints(typevarobject *self, void *Py_UNUSED(ignored))
|
|||
return Py_NewRef(self->constraints);
|
||||
}
|
||||
if (self->evaluate_constraints == NULL) {
|
||||
Py_RETURN_NONE;
|
||||
return PyTuple_New(0);
|
||||
}
|
||||
PyObject *constraints = PyObject_CallNoArgs(self->evaluate_constraints);
|
||||
self->constraints = Py_XNewRef(constraints);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue