Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 592f2d6

Browse files
committed
_PySys_Init(): When setting up sys.version_info, use #if/#elif.../#endif
instead of four #if/#endif blocks. This shortens the code and improves readability.
1 parent 0625777 commit 592f2d6

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

Python/sysmodule.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,11 @@ _PySys_Init(void)
420420
*/
421421
#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_ALPHA
422422
s = "alpha";
423-
#endif
424-
#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_BETA
423+
#elif PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_BETA
425424
s = "beta";
426-
#endif
427-
#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_GAMMA
425+
#elif PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_GAMMA
428426
s = "candidate";
429-
#endif
430-
#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL
427+
#elif PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL
431428
s = "final";
432429
#endif
433430
PyDict_SetItemString(sysdict, "version_info",

0 commit comments

Comments
 (0)