Skip to content

curses for windows (alternative patch) #47138

Closed as not planned
Closed as not planned

Description

@techtonik
mannequin
BPO 2889
Nosy @loewis, @pfmoore, @jkloth, @Trundle, @ipatrol, @ulfalizer, @madebr
Files
  • curses_win_port.patch.txt
  • curses_win_compile.bat
  • python-pdcurses.patch
  • python-pdcurses-2.patch
  • python-pdcurses-3.patch
  • pdcurses-changes.patch: Changes to Lib/test/test_curses.py Modules/_cursesmodule.c PC/mkstemp.c PC/pyconfig.h PCbuild/_curses.vcproj PCbuild/_curses_panel.vcproj PCbuild/pcbuild.sln PCbuild/pdcurses.vcproj PCbuild/pythoncore.vcproj
  • pdcurses.patch: pdcurses source
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2008-05-16.06:38:26.189>
    labels = ['extension-modules', 'type-feature', 'OS-windows']
    title = 'curses for windows (alternative patch)'
    updated_at = <Date 2021-04-05.14:37:31.276>
    user = 'https://bugs.python.org/techtonik'

    bugs.python.org fields:

    activity = <Date 2021-04-05.14:37:31.276>
    actor = 'jkloth'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules', 'Windows']
    creation = <Date 2008-05-16.06:38:26.189>
    creator = 'techtonik'
    dependencies = []
    files = ['10339', '10340', '12862', '13282', '15171', '20492', '20493']
    hgrepos = []
    issue_num = 2889
    keywords = ['patch']
    message_count = 23.0
    messages = ['66920', '67288', '80554', '82781', '83365', '94309', '114011', '114013', '114370', '114399', '114740', '114770', '114778', '116224', '126887', '128191', '185746', '222640', '236384', '237855', '237857', '349089', '375683']
    nosy_count = 16.0
    nosy_names = ['loewis', 'paul.moore', 'techtonik', 'jkloth', 'rpetrov', 'zhirsch', 'Trundle', 'cgohlke', 'jmb', 'ipatrol', 'Prasun Ratn', 'christoph.baumgartner', 'Taylor.Marks', 'Mario Figueiredo', 'ulfalizer', 'maarten']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue2889'
    versions = ['Python 3.3']

    Activity

    1. techtonik commented on May 16, 2008

      techtonikmannequin
      MannequinAuthor

      Make curses available on Windows by using PDCurses library. Alternative
      patch for bpo-1005895 using current trunk.

      Attached .bat file is used to compile it under MinGW, but I'd be glad to
      know how to integrate the patch into Python build system.

      PDCurses includes support for mouse functions compatible with ncurses,
      but to turn it on if requires to define NCURSES_MOUSE_VERSION to 2
      before <curses.h> is included. I am not familiar with configure.* stuff,
      so I've just pasted required definitions into _cursesmodule.c
      With attached .bat file it works by external definition.

      Some functions, such as initterm are not available on Windows platform
      and were defined out.

      I hope that curses module will be included in next Python 2.6

    2. loewis commented on May 24, 2008

      loewismannequin
      Mannequin

      The patch, in its current form, is incomplete. Can you please provide:

      a) a VS 2008 project file, which builds both the curses module and the
      pdcurses library, fetching the sources for that from ../../pdcurses (or
      some such); the project file should be structured similar to all the
      other project files in PCbuild
      b) a patch to PCbuild/readme.txt, with instructions on how to build the
      extension

    3. zhirsch commented on Jan 26, 2009

      zhirschmannequin
      Mannequin

      Here's a patch against the head of trunk that adds vcproj files for
      _curses and _curses_panel, modifies (slightly) the test suite and
      _cursesmodule.c (again, slightly) to get Python to work with pdcurses on
      windows. I also added a blurb to PCbuild\readme.txt.

      With this, test_curses.py passes and I'm able to run all the curses
      demos that come with Python's source.

    4. akuchling commented on Feb 26, 2009

      @akuchling
      Contributor

      I can't say anything about the Windows build aspects. Some observations
      about the curses/test_curses changes:

      • test_curses: I'd be happier to see the 'if' statement as sys.platform
        != 'win32' and (not term or term == 'unknown') -- easier to read.

      • test_curses: does putp() make PDCurses crash, or is it not available?
        If the latter, I'd prefer to see 'if hasattr(curses, "putp"): <putp
        test>'. Same for the tparm() test.

      • Given that you include term.h and IRIX included term.h, I wonder if we
        should make _cursesmodule.c include term.h on all platforms that have
        it, and then fix the resulting breakage claimed by the comment (if any).

      • Is setupterm() a no-up on Windows? Maybe the function just shouldn't
        be defined on Windows, then, so that user code can check for the
        function's existence.

    5. zhirsch commented on Mar 9, 2009

      zhirschmannequin
      Mannequin
      • test_curses: I'd be happier to see the 'if' statement as sys.platform
        != 'win32' and (not term or term == 'unknown') -- easier to read.

      OK, fixed.

      • test_curses: does putp() make PDCurses crash, or is it not available?
        If the latter, I'd prefer to see 'if hasattr(curses, "putp"): <putp
        test>'. Same for the tparm() test.

      They're stubs in pdcurses that always return an error. I'm not sure
      which is better in this case -- make them available through the curses
      module but always raise an exception on Windows, or make them
      unavailable and have it be an AttributeError if something tries to call
      them on Windows.

      • Given that you include term.h and IRIX included term.h, I wonder if we
        should make _cursesmodule.c include term.h on all platforms that have
        it, and then fix the resulting breakage claimed by the comment (if any).

      Yea, it was actually really easy to resolve the conflicts. I've done
      that, and tested the result on Linux and OS X 10.4.

      • Is setupterm() a no-up on Windows? Maybe the function just shouldn't
        be defined on Windows, then, so that user code can check for the
        function's existence.

      PDCurses does the same thing for setupterm as it does for putp/tparm
      (and a number of other unsupported functions) -- always returns an
      error. However, the curses module keeps track of whether it's been
      initialized based on whether setupterm has been called, so I think it
      makes sense to keep setupterm available but not call PDCurses's
      setupterm function on Windows.

    6. jmb commented on Oct 21, 2009

      jmbmannequin
      Mannequin

      I've built a package for python 2.6 using a slightly modified version of
      this patch. I've uploaded it here: http://jeberger.free.fr/python/

      I'm attaching my version of the patch here. I had to make two
      modifications for it to work:

      • Change all references to _ISPAD into _PAD (obviously this needs to be
        done better since what I did will break the ncurses compatibility);
      • Change "(long) (n << 8)" into "COLOR_PAIR (n)". This should be
        compatible between curses implementations.

      With this package, I've been able to run the Mercurial "crecord"
      extension on Windows.

    7. ipatrol commented on Aug 15, 2010

      ipatrolmannequin
      Mannequin

      Any progress yat?

    8. loewis commented on Aug 15, 2010

      loewismannequin
      Mannequin

      It can't go into 2.x anymore.

    9. BreamoreBoy commented on Aug 19, 2010

      BreamoreBoymannequin
      Mannequin

      Brian or Tim any interest in this?

    10. tjguk commented on Aug 19, 2010

      @tjguk
      Member

      I'll pick it up for the moment to shepherd it along because I'm reasonably keen to see a Windows curses in the stdlib. However, I'm no expert in curses and I don't promise to do anything immediate with it.

    11. self-assigned this
      on Aug 19, 2010
    12. rpetrov commented on Aug 23, 2010

      rpetrovmannequin
      Mannequin

      -1 for PDCurses

    13. 14 remaining items

    14. erlend-aasland commented on May 20, 2022

      @erlend-aasland
      Contributor

      @pfmoore:

      Unless someone is going to step up and do all of that (and keep it maintained until it gets merged, which probably won't be till 3.6) and there's one of the core devs willing to support the code going forward once its committed, then I think closing this as "won't fix" and referring to the external packages is the best solution.

      +1

      Also, the windows-curses package seems to be fairly up to date for those who want to use PDCurses on Windows.

    15. added
      pendingThe issue will be closed if no feedback is provided
      on May 20, 2022
    16. AA-Turner commented on May 28, 2022

      @AA-Turner
      Member

      Closing as windows-curses exists, and per Paul & Erlend. If someone would like to do the work to implement curses on windows, we could re-open this issue or discuss in a new one (referencing 3.12+ rather than 3.6!)

      A

    17. Repository owner moved this from Features to Done in Curses issueson May 28, 2022
    18. removed
      pendingThe issue will be closed if no feedback is provided
      on May 28, 2022
    19. irvinren commented on Nov 24, 2023

      @irvinren

      Closing as windows-curses exists, and per Paul & Erlend. If someone would like to do the work to implement curses on windows, we could re-open this issue or discuss in a new one (referencing 3.12+ rather than 3.6!)

      A

      Closing as windows-curses exists, and per Paul & Erlend. If someone would like to do the work to implement curses on windows, we could re-open this issue or discuss in a new one (referencing 3.12+ rather than 3.6!)

      A

      Windows-curses quit silently on Cpython3.12. is it possible to reopen this issue?

    20. irvinren commented on Dec 1, 2023

      @irvinren

      @AA-Turner
      windows-curses stopped active development and looking for another maintainer, is it possible to reopen this issue?
      zephyrproject-rtos/windows-curses#50 (comment)

    21. erlend-aasland commented on Dec 4, 2023

      @erlend-aasland
      Contributor

      See also #40725.

    22. irvinren commented on Dec 4, 2023

      @irvinren

      See also #40725.

      that one seems not for MSVC compiler. Could I directly try this patch?

    23. erlend-aasland commented on Dec 4, 2023

      @erlend-aasland
      Contributor

      that one seems not for MSVC compiler. Could I directly try this patch?

      I'm not sure which patch you are referring to, but I'd expect all the attached files both in this issue and #40725 to be seriously outdated; I would not expect any of these to merge cleanly into main, and even if they would merge "cleanishly", I would not expect them to compile. Any attempt at getting this ball rolling again would have to start by either adapting one of the outdated patches to work with the current C API, or by writing the extension module from scratch.

    24. cgohlke commented on Dec 5, 2023

      @cgohlke
    25. ashm-dev commented on Nov 13, 2025

      @ashm-dev
      Contributor

      Ping. Is this issue still relevant?

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions