Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue31680

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Expose curses library name and version on Python level
Type:enhancementStage:resolved
Components:Extension ModulesVersions:Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: serhiy.storchakaNosy List: serhiy.storchaka, terry.reedy, twouters, vstinner
Priority:normalKeywords:patch

Created on2017-10-03 19:39 byserhiy.storchaka, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 4217mergedserhiy.storchaka,2017-11-01 13:47
Messages (10)
msg303640 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-10-03 19:39
The name and the version of the curses library are needed for work around bugs in old versions or skip tests on platforms that provide broken curses library (like OpenBSD providing ncurses 5.7).The curses and _curses modules provide the attribute "version" (= b'2.2'), but this is just a version of the module.
msg303644 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2017-10-03 19:41
How can we get the ncurses version?
msg303645 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2017-10-03 19:44
On Fedora 26, /usr/include/ncurses/curses.h contains:---/* These are defined only in curses.h, and are used for conditional compiles */#define NCURSES_VERSION_MAJOR 6#define NCURSES_VERSION_MINOR 0#define NCURSES_VERSION_PATCH 20170212/* This is defined in more than one ncurses header, for identification */#undef  NCURSES_VERSION#define NCURSES_VERSION "6.0"/* * Identify the mouse encoding version. */#define NCURSES_MOUSE_VERSION 2---You want to expose such versions? Do you know if there are "curses" implementations different than GNU ncurses?https://www.gnu.org/software/ncurses/I'm asking to know how other implementations expose their versions.
msg303646 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2017-10-03 19:45
> The name and the version of the curses library are needed for work around bugs in old versions or skip tests on platforms that provide broken curses library (like OpenBSD providing ncurses 5.7).If there are known issues depending on the ncurses version, it may help to export this version in the test.pythoninfo utility. Do you have an example of known bug? Do we already skip tests depending on the ncurses version?
msg303654 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-10-03 21:54
Yes, this is what I meant. The version should be exposed as a tuple (major, minor, patch) or as a special named tuple. I don't know what to do with other implementations. NCURSES_VERSION_MAJOR is not a part of standard. One solution -- set the version to (0, 0, 0) for unknown implementations. Or expose ncurses version as optional ncurses_version, and expose versions for other known implementations with different names.A known bug isissue15037. We still don't skip tests depending on the ncurses version because there is no easy way to determine the ncurses version in Python.
msg303657 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2017-10-03 22:51
I suggest:curses._NCURSES_VERSION_INFO = (6, 0, 20170212)curses._NCURSES_VERSION = "6.0"curses._NCURSES_MOUSE_VERSION = 2Similar example, the readline module uses:    PyModule_AddIntConstant(m, "_READLINE_VERSION", RL_READLINE_VERSION);    PyModule_AddIntConstant(m, "_READLINE_RUNTIME_VERSION", rl_readline_version);    PyModule_AddStringConstant(m, "_READLINE_LIBRARY_VERSION", rl_library_version);readline has two famous implementations: GNU readline and editline. editline reuses GNU readline constants, but the string mentions "editline". Example on macOS El Capitain (test.pythoninfo output):readline._READLINE_LIBRARY_VERSION: EditLine wrapperreadline._READLINE_RUNTIME_VERSION: 0x402readline._READLINE_VERSION: 0x402http://buildbot.python.org/all/builders/x86-64%20El%20Capitan%203.x/builds/871/steps/pythoninfo/logs/stdioI'm not sure that it's useful to make versions public. I suggest to start with private versions, since we only plan to use them in tests right now.
msg303845 -(view)Author: Terry J. Reedy (terry.reedy)*(Python committer)Date: 2017-10-06 19:13
pythoninfo seems like the right place.  It is publicly readable.  We just reserved the right to change it in any release as needed.  (This actually is useful to other users also as long as they know.)#15037 was originally filed for 3.4 and is currently marked for 3.6.  Backporting this to 3.6 will allow a 3.6 fix for#15037.
msg303846 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-10-06 19:38
No need to backport this to 3.6. The test in 3.6 can be skipped on OpenBSD, independently from the ncurses version.
msg305381 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-11-01 13:51
PR 4217 adds a named tuple curses.ncurses_version containing the three components of the ncurses library version: major, minor, and patch.>>> curses.ncurses_versioncurses.ncurses_version(major=6, minor=0, patch=20160625)Other curses implementation don't provide a version programmically.
msg328896 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2018-10-30 11:22
New changesetb232df9197a19e78d0e2a751e56e0e62547354ec by Serhiy Storchaka in branch 'master':bpo-31680: Add curses.ncurses_version. (GH-4217)https://github.com/python/cpython/commit/b232df9197a19e78d0e2a751e56e0e62547354ec
History
DateUserActionArgs
2022-04-11 14:58:53adminsetgithub: 75861
2018-10-30 11:23:21serhiy.storchakasetpull_requests: -pull_request7410
2018-10-30 11:23:08serhiy.storchakasetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.8, - Python 3.7
2018-10-30 11:22:46serhiy.storchakasetmessages: +msg328896
2018-06-19 19:18:47vstinnersetpull_requests: +pull_request7410
2017-11-01 13:51:09serhiy.storchakasetassignee:serhiy.storchaka
messages: +msg305381
2017-11-01 13:47:04serhiy.storchakasetkeywords: +patch
stage: patch review
pull_requests: +pull_request4185
2017-10-06 19:38:54serhiy.storchakasetmessages: +msg303846
2017-10-06 19:13:14terry.reedysetnosy: +terry.reedy
messages: +msg303845
2017-10-03 22:51:23vstinnersetmessages: +msg303657
2017-10-03 21:54:35serhiy.storchakasetmessages: +msg303654
2017-10-03 19:45:23vstinnersetmessages: +msg303646
2017-10-03 19:44:04vstinnersetmessages: +msg303645
2017-10-03 19:41:26vstinnersetnosy: +vstinner
messages: +msg303644
2017-10-03 19:39:02serhiy.storchakacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp