diff --git a/Cython/Build/IpythonMagic.py b/Cython/Build/IpythonMagic.py index c4921d42b5fbd90953a6003cdfc3b081b82fcb3f..4a9f0c3d1a1639c4c0747c7e39f251235fbd41a4 100644 --- a/Cython/Build/IpythonMagic.py +++ b/Cython/Build/IpythonMagic.py @@ -419,12 +419,11 @@ class CythonMagics(Magics): quiet=quiet, annotate=args.annotate, force=True, + language_level=min(3, sys.version_info[0]), ) if args.language_level is not None: assert args.language_level in (2, 3) opts['language_level'] = args.language_level - elif sys.version_info[0] >= 3: - opts['language_level'] = 3 return cythonize([extension], **opts) except CompileError: return None