mirror of
https://github.com/python/cpython.git
synced 2025-08-26 19:55:24 +00:00
gh-91827: Add method info_pathlevel() in tkinter (GH-91829)
This commit is contained in:
parent
d707d073be
commit
15dbe8570f
8 changed files with 75 additions and 23 deletions
|
@ -101,15 +101,7 @@ def get_tk_patchlevel():
|
|||
global _tk_patchlevel
|
||||
if _tk_patchlevel is None:
|
||||
tcl = tkinter.Tcl()
|
||||
patchlevel = tcl.call('info', 'patchlevel')
|
||||
m = re.fullmatch(r'(\d+)\.(\d+)([ab.])(\d+)', patchlevel)
|
||||
major, minor, releaselevel, serial = m.groups()
|
||||
major, minor, serial = int(major), int(minor), int(serial)
|
||||
releaselevel = {'a': 'alpha', 'b': 'beta', '.': 'final'}[releaselevel]
|
||||
if releaselevel == 'final':
|
||||
_tk_patchlevel = major, minor, serial, releaselevel, 0
|
||||
else:
|
||||
_tk_patchlevel = major, minor, 0, releaselevel, serial
|
||||
_tk_patchlevel = tcl.info_patchlevel()
|
||||
return _tk_patchlevel
|
||||
|
||||
units = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue