Skip to content

Commit a643c09

Browse files
committed
followup
1 parent d444103 commit a643c09

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

Lib/test/test_typing.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,9 @@ def test_bound(self):
13181318
self.assertIs(Ts_bound.__bound__, int)
13191319
Ts_tuple_bound = TypeVarTuple('Ts_tuple_bound', bound=(int, str))
13201320
self.assertEqual(Ts_tuple_bound.__bound__, (int, str))
1321+
obj = object()
1322+
Ts_object = TypeVarTuple('Ts_object', bound=obj)
1323+
self.assertIs(Ts_object.__bound__, obj)
13211324
Ts_no_bound = TypeVarTuple('Ts_no_bound')
13221325
self.assertIsNone(Ts_no_bound.__bound__)
13231326

@@ -10541,8 +10544,11 @@ def test_paramspec_bound(self):
1054110544
self.assertEqual(P.__bound__, [int, str])
1054210545
P2 = ParamSpec('P2', bound=(int, str))
1054310546
self.assertEqual(P2.__bound__, (int, str))
10544-
P3 = ParamSpec('P3')
10545-
self.assertIs(P3.__bound__, None)
10547+
obj = object()
10548+
P3 = ParamSpec('P3', bound=obj)
10549+
self.assertIs(P3.__bound__, obj)
10550+
P4 = ParamSpec('P4')
10551+
self.assertIs(P4.__bound__, None)
1054610552

1054710553
def test_paramspec_gets_copied(self):
1054810554
# bpo-46581

Objects/typevarobject.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,6 @@ paramspec_new_impl(PyTypeObject *type, PyObject *name, PyObject *bound,
13421342
}
13431343
PyObject *module = caller();
13441344
if (module == NULL) {
1345-
Py_XDECREF(bound);
13461345
return NULL;
13471346
}
13481347
PyObject *ps = (PyObject *)paramspec_alloc(
@@ -1627,12 +1626,8 @@ typevartuple_impl(PyTypeObject *type, PyObject *name, PyObject *bound,
16271626
PyErr_SetString(PyExc_ValueError, "Variance cannot be specified with infer_variance.");
16281627
return NULL;
16291628
}
1630-
if (Py_IsNone(bound)) {
1631-
bound = NULL;
1632-
}
16331629
PyObject *module = caller();
16341630
if (module == NULL) {
1635-
Py_XDECREF(bound);
16361631
return NULL;
16371632
}
16381633
PyObject *result = (PyObject *)typevartuple_alloc(

0 commit comments

Comments
 (0)