Is it possible to use language level 2 with python 3.12?

13 views
Skip to first unread message

Idan Ahal

unread,
Aug 4, 2025, 1:28:16 PMAug 4
to cython-users
Is setting
#cython:    language_level = 2
still compatible with the latest Cython and Python 3.12?

I couldn't find an answer on the web and would be happy for some clarification. 

Oscar Benjamin

unread,
Aug 4, 2025, 4:00:26 PMAug 4
to cython...@googlegroups.com
Have you tried it?

If you have some existing code that needs language level 2 then just
try it. If you don't have such existing code then I recommend setting
language_level = 3.

--
Oscar

Idan Ahal

unread,
Aug 5, 2025, 10:55:56 PMAug 5
to cython-users

I'm scarred of not edge cases like missing micros for example. 
ב-יום שני, 4 באוגוסט 2025 בשעה 23:00:26 UTC+3, oscar.j....@gmail.com כתב/ה:

David Woods

unread,
Aug 6, 2025, 3:15:57 AMAug 6
to cython...@googlegroups.com
I'm not sure what a "missing micro" is.

However, language_level=2 does still work. The one thing you'll find is that `"abc"` is a Py3 string rather than bytes. So it isn't a perfect Python 2 emulator.

For new code, I'm not sure why you'd choose to use language_level=2 though

Reply all
Reply to author
Forward
0 new messages