Bug 1900764 - python-typeguard fails to build with Python 3.10: NameError: name 'Employee' is not defined
Summary: python-typeguard fails to build with Python 3.10: NameError: name 'Employee' ...
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: python-typeguard
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Christopher Brown
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1900767
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2020-11-23 16:49 UTC by Tomáš Hrnčiar
Modified: 2021-02-16 10:02 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github agronholm typeguard issues 164 0 None open Python 3.10 compatibility 2021-02-13 23:00:22 UTC

Description Tomáš Hrnčiar 2020-11-23 16:49:08 UTC
python-typeguard fails to build with Python 3.10.0a2.

=================================== FAILURES ===================================
____________________ TestCheckArgumentTypes.test_namedtuple ____________________
tests/test_typeguard.py:413: in test_namedtuple
    foo(Employee('bob', 1))
tests/test_typeguard.py:411: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'Employee' is not defined
_____________ TestCheckArgumentTypes.test_namedtuple_type_mismatch _____________
tests/test_typeguard.py:421: in test_namedtuple_type_mismatch
    pytest.raises(TypeError, foo, ('bob', 1)).\
tests/test_typeguard.py:419: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'Employee' is not defined
___________ TestCheckArgumentTypes.test_namedtuple_wrong_field_type ____________
tests/test_typeguard.py:431: in test_namedtuple_wrong_field_type
    pytest.raises(TypeError, foo, Employee(2, 1)).\
tests/test_typeguard.py:429: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'Employee' is not defined
_____________ TestCheckArgumentTypes.test_typevar_constraints[int] _____________
tests/test_typeguard.py:468: in test_typevar_constraints
    foo(*values)
tests/test_typeguard.py:466: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
_____________ TestCheckArgumentTypes.test_typevar_constraints[str] _____________
tests/test_typeguard.py:468: in test_typevar_constraints
    foo(*values)
tests/test_typeguard.py:466: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
_______ TestCheckArgumentTypes.test_typevar_constraints_fail_typing_type _______
tests/test_typeguard.py:477: in test_typevar_constraints_fail_typing_type
    foo('aa', 'bb')
tests/test_typeguard.py:474: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
_____________ TestCheckArgumentTypes.test_typevar_constraints_fail _____________
tests/test_typeguard.py:485: in test_typevar_constraints_fail
    exc = pytest.raises(TypeError, foo, 2.5, 'aa')
tests/test_typeguard.py:483: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
__________________ TestCheckArgumentTypes.test_typevar_bound ___________________
tests/test_typeguard.py:495: in test_typevar_bound
    foo(Child(), Child())
tests/test_typeguard.py:493: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
________________ TestCheckArgumentTypes.test_typevar_bound_fail ________________
tests/test_typeguard.py:503: in test_typevar_bound_fail
    exc = pytest.raises(TypeError, foo, Parent(), Parent())
tests/test_typeguard.py:501: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
______________ TestCheckArgumentTypes.test_typevar_invariant_fail ______________
tests/test_typeguard.py:513: in test_typevar_invariant_fail
    exc = pytest.raises(TypeError, foo, 2, 3.6)
tests/test_typeguard.py:511: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
________________ TestCheckArgumentTypes.test_typevar_covariant _________________
tests/test_typeguard.py:522: in test_typevar_covariant
    foo(Parent(), Child())
tests/test_typeguard.py:520: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
______________ TestCheckArgumentTypes.test_typevar_covariant_fail ______________
tests/test_typeguard.py:530: in test_typevar_covariant_fail
    exc = pytest.raises(TypeError, foo, Child(), Parent())
tests/test_typeguard.py:528: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
______________ TestCheckArgumentTypes.test_typevar_contravariant _______________
tests/test_typeguard.py:540: in test_typevar_contravariant
    foo(Child(), Parent())
tests/test_typeguard.py:538: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
____________ TestCheckArgumentTypes.test_typevar_contravariant_fail ____________
tests/test_typeguard.py:548: in test_typevar_contravariant_fail
    exc = pytest.raises(TypeError, foo, Parent(), Child())
tests/test_typeguard.py:546: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
_____________________ TestCheckArgumentTypes.test_generic ______________________
tests/test_typeguard.py:652: in test_generic
    foo(FooGeneric[str]())
tests/test_typeguard.py:650: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'FooGeneric' is not defined
_____________________ TestCheckArgumentTypes.test_newtype ______________________
tests/test_typeguard.py:666: in test_newtype
    assert foo(1) == 42
tests/test_typeguard.py:663: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'myint' is not defined
________ TestTypeChecker.test_forward_ref_policy_resolution_fails[warn] ________
tests/test_typeguard.py:1434: in test_forward_ref_policy_resolution_fails
    unresolvable_annotation({})
tests/test_typeguard.py:1428: in unresolvable_annotation
    def unresolvable_annotation(x: 'OrderedDict'):  # noqa
typeguard/__init__.py:1074: in __call__
    memo = self._call_memos[frame] = _CallMemo(
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'OrderedDict' is not defined
_______ TestTypeChecker.test_forward_ref_policy_resolution_fails[guess] ________
tests/test_typeguard.py:1434: in test_forward_ref_policy_resolution_fails
    unresolvable_annotation({})
tests/test_typeguard.py:1428: in unresolvable_annotation
    def unresolvable_annotation(x: 'OrderedDict'):  # noqa
typeguard/__init__.py:1074: in __call__
    memo = self._call_memos[frame] = _CallMemo(
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'OrderedDict' is not defined
________________ TestTypeChecker.test_forward_ref_policy_guess _________________
tests/test_typeguard.py:1449: in test_forward_ref_policy_guess
    unresolvable_annotation(collections.OrderedDict())
tests/test_typeguard.py:1444: in unresolvable_annotation
    def unresolvable_annotation(x: 'OrderedDict'):  # noqa
typeguard/__init__.py:1074: in __call__
    memo = self._call_memos[frame] = _CallMemo(
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1438: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:258: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:519: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'OrderedDict' is not defined
=============================== warnings summary ===============================
tests/test_typeguard.py::TestTypeChecker::test_forward_ref_policy_resolution_fails[warn]
tests/test_typeguard.py::TestTypeChecker::test_forward_ref_policy_resolution_fails[guess]
tests/test_typeguard.py::TestTypeChecker::test_forward_ref_policy_guess
  /builddir/build/BUILD/typeguard-2.10.0/typeguard/__init__.py:1041: UserWarning: the system profiling hook has changed unexpectedly
    warn('the system profiling hook has changed unexpectedly')

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
XFAIL tests/test_typeguard.py::TestTypeChecked::test_typed_dict[missing_y_ok]
  Fails due to upstream bug BPO-42059
XFAIL tests/test_typeguard.py::TestTypeChecked::test_typed_dict[wrong_x]
  Fails due to upstream bug BPO-42059
============ 19 failed, 211 passed, 2 xfailed, 3 warnings in 3.55s =============
error: Bad exit status from /var/tmp/rpm-tmp.8TL2tv (%check)
    Bad exit status from /var/tmp/rpm-tmp.8TL2tv (%check)

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01777609-python-typeguard/

For all our attempts to build python-typeguard with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-typeguard/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Christopher Brown 2021-01-04 00:26:54 UTC
Given that we are ~10 months from Python 3.10 and F35, this is low priority and tbh probably a little early to be raising bugs against packages for.

I've raised an issue upstream but don't expect to see much attention against Alpha builds of software.

Comment 2 Tomáš Hrnčiar 2021-01-04 08:48:58 UTC
Hello, 

thank you for reporting this in upstream. 
We are rebuilding all relevant Fedora packages with Python 3.10 in COPR[1] as preparation for F35 (the change is already accepted, see [2]). 
It's important to do it in advance so we are able to influence upstream development of Python. 

[1] https://copr.fedorainfracloud.org/coprs/g/python/python3.10/packages/ 
[2] https://fedoraproject.org/wiki/Changes/Python3.10

Comment 3 Miro Hrončok 2021-01-04 09:59:21 UTC
The following packages require python3-typeguard:

python-TestSlide-0:2.6.4-1.fc34.src
python-tenacity-0:6.3.1-1.fc34.src
python3-TestSlide-0:2.6.4-1.fc34.noarch

By deciding to deprioritize this, we cannot check if they work with Python 3.10.
Once we update Python in Fedora, packages that don't build won't be installable.

This stack is pretty small, so indeed, this is not a high prio. But please beware that we will update rawhide to Python 3.10 in May, which is in 5 months, not 10. The schedule is at https://fedoraproject.org/wiki/Changes/Python3.10#Important_dates_and_plan

Comment 4 Ben Cotton 2021-02-09 15:27:52 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 5 Christopher Brown 2021-02-13 23:17:45 UTC
This is blocked waiting for typing package to be fixed.


"Problem: package python3-typing-extensions-3.7.4.3-2.fc34.noarch requires python(abi) = 3.9, but none of the providers can be installed"

Comment 6 Miro Hrončok 2021-02-13 23:55:19 UTC
I've built python3-typing-extensions in copr. This is now unblocked. Thanks for letting us know.

Comment 7 Tomáš Hrnčiar 2021-02-15 14:15:23 UTC
Even with python3-typing-extensions being unblocked the error is still present.

https://download.copr.fedorainfracloud.org/results/@python/python3.10/fedora-rawhide-x86_64/01966389-python-typeguard/builder-live.log.gz

=================================== FAILURES ===================================
____________________ TestCheckArgumentTypes.test_namedtuple ____________________
tests/test_typeguard.py:413: in test_namedtuple
    foo(Employee('bob', 1))
tests/test_typeguard.py:411: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'Employee' is not defined
_____________ TestCheckArgumentTypes.test_namedtuple_type_mismatch _____________
tests/test_typeguard.py:421: in test_namedtuple_type_mismatch
    pytest.raises(TypeError, foo, ('bob', 1)).\
tests/test_typeguard.py:419: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'Employee' is not defined
___________ TestCheckArgumentTypes.test_namedtuple_wrong_field_type ____________
tests/test_typeguard.py:431: in test_namedtuple_wrong_field_type
    pytest.raises(TypeError, foo, Employee(2, 1)).\
tests/test_typeguard.py:429: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'Employee' is not defined
_____________ TestCheckArgumentTypes.test_typevar_constraints[int] _____________
tests/test_typeguard.py:468: in test_typevar_constraints
    foo(*values)
tests/test_typeguard.py:466: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
_____________ TestCheckArgumentTypes.test_typevar_constraints[str] _____________
tests/test_typeguard.py:468: in test_typevar_constraints
    foo(*values)
tests/test_typeguard.py:466: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
_______ TestCheckArgumentTypes.test_typevar_constraints_fail_typing_type _______
tests/test_typeguard.py:477: in test_typevar_constraints_fail_typing_type
    foo('aa', 'bb')
tests/test_typeguard.py:474: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
_____________ TestCheckArgumentTypes.test_typevar_constraints_fail _____________
tests/test_typeguard.py:485: in test_typevar_constraints_fail
    exc = pytest.raises(TypeError, foo, 2.5, 'aa')
tests/test_typeguard.py:483: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
__________________ TestCheckArgumentTypes.test_typevar_bound ___________________
tests/test_typeguard.py:495: in test_typevar_bound
    foo(Child(), Child())
tests/test_typeguard.py:493: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
________________ TestCheckArgumentTypes.test_typevar_bound_fail ________________
tests/test_typeguard.py:503: in test_typevar_bound_fail
    exc = pytest.raises(TypeError, foo, Parent(), Parent())
tests/test_typeguard.py:501: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
______________ TestCheckArgumentTypes.test_typevar_invariant_fail ______________
tests/test_typeguard.py:513: in test_typevar_invariant_fail
    exc = pytest.raises(TypeError, foo, 2, 3.6)
tests/test_typeguard.py:511: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
________________ TestCheckArgumentTypes.test_typevar_covariant _________________
tests/test_typeguard.py:522: in test_typevar_covariant
    foo(Parent(), Child())
tests/test_typeguard.py:520: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
______________ TestCheckArgumentTypes.test_typevar_covariant_fail ______________
tests/test_typeguard.py:530: in test_typevar_covariant_fail
    exc = pytest.raises(TypeError, foo, Child(), Parent())
tests/test_typeguard.py:528: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
______________ TestCheckArgumentTypes.test_typevar_contravariant _______________
tests/test_typeguard.py:540: in test_typevar_contravariant
    foo(Child(), Parent())
tests/test_typeguard.py:538: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
____________ TestCheckArgumentTypes.test_typevar_contravariant_fail ____________
tests/test_typeguard.py:548: in test_typevar_contravariant_fail
    exc = pytest.raises(TypeError, foo, Parent(), Child())
tests/test_typeguard.py:546: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'T' is not defined
_____________________ TestCheckArgumentTypes.test_generic ______________________
tests/test_typeguard.py:652: in test_generic
    foo(FooGeneric[str]())
tests/test_typeguard.py:650: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'FooGeneric' is not defined
_____________________ TestCheckArgumentTypes.test_newtype ______________________
tests/test_typeguard.py:666: in test_newtype
    assert foo(1) == 42
tests/test_typeguard.py:663: in foo
    assert check_argument_types()
typeguard/__init__.py:739: in check_argument_types
    memo = _CallMemo(func, frame.f_locals)
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'myint' is not defined
________ TestTypeChecker.test_forward_ref_policy_resolution_fails[warn] ________
tests/test_typeguard.py:1434: in test_forward_ref_policy_resolution_fails
    unresolvable_annotation({})
tests/test_typeguard.py:1428: in unresolvable_annotation
    def unresolvable_annotation(x: 'OrderedDict'):  # noqa
typeguard/__init__.py:1074: in __call__
    memo = self._call_memos[frame] = _CallMemo(
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'OrderedDict' is not defined
_______ TestTypeChecker.test_forward_ref_policy_resolution_fails[guess] ________
tests/test_typeguard.py:1434: in test_forward_ref_policy_resolution_fails
    unresolvable_annotation({})
tests/test_typeguard.py:1428: in unresolvable_annotation
    def unresolvable_annotation(x: 'OrderedDict'):  # noqa
typeguard/__init__.py:1074: in __call__
    memo = self._call_memos[frame] = _CallMemo(
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'OrderedDict' is not defined
________________ TestTypeChecker.test_forward_ref_policy_guess _________________
tests/test_typeguard.py:1449: in test_forward_ref_policy_guess
    unresolvable_annotation(collections.OrderedDict())
tests/test_typeguard.py:1444: in unresolvable_annotation
    def unresolvable_annotation(x: 'OrderedDict'):  # noqa
typeguard/__init__.py:1074: in __call__
    memo = self._call_memos[frame] = _CallMemo(
typeguard/__init__.py:122: in __init__
    hints = get_type_hints(func, localns=frame_locals)
/usr/lib64/python3.10/typing.py:1627: in get_type_hints
    value = _eval_type(value, globalns, localns)
/usr/lib64/python3.10/typing.py:305: in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
/usr/lib64/python3.10/typing.py:607: in _evaluate
    eval(self.__forward_code__, globalns, localns),
<string>:1: in <module>
    ???
E   NameError: name 'OrderedDict' is not defined
=============================== warnings summary ===============================
tests/test_typeguard.py::TestTypeChecker::test_forward_ref_policy_resolution_fails[warn]
tests/test_typeguard.py::TestTypeChecker::test_forward_ref_policy_resolution_fails[guess]
tests/test_typeguard.py::TestTypeChecker::test_forward_ref_policy_guess
  /builddir/build/BUILD/typeguard-2.10.0/typeguard/__init__.py:1041: UserWarning: the system profiling hook has changed unexpectedly
    warn('the system profiling hook has changed unexpectedly')

Comment 8 Christopher Brown 2021-02-15 14:19:30 UTC
(In reply to Tomáš Hrnčiar from comment #7)
> Even with python3-typing-extensions being unblocked the error is still
> present.

ok, thanks, have re-opened issue upstream.

Comment 9 Christopher Brown 2021-02-16 10:02:39 UTC
Upstream has replicated the error on 3.10 and is investigating.


Note You need to log in before you can comment on or make changes to this bug.