Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Isolate the _curses extension module #101714

Closed as not planned
Closed as not planned
@erlend-aasland

Description

@erlend-aasland

Feature or enhancement

Isolate the_curses extension module. This means turning most global variables into module state variables.

Globals in the_curses extension module:

NameC typeNotes
PyCursesVersionconst char[]Hard-coded C string; can remain a global
PyCursesError PyObject * 
initialised_setuptermintTells whethersetupterm() has been called to initialiseterminfo
initialisedintTells whetherinitscr() has been called to initialise curses
initialisedcolorsintTells whetherstart_color() has been called to initialise color usage
screen_encodingint
PyCursesWindow_TypePyTypeObject *Must convert to heap type
ModDictPyObject *

There is also a capsule with a C API. I'm not sure if this needs special handling wrt.PEP-489, but the _curses C API exposes three of the global variables1 directly. That said, those three variables are all guards for curses specific initialisation; it may make sense to keep these variables global; I don't know yet. The capsule C API also uses the _curses exception object (curses.error). Altering or removing the _curses C API is a breaking change and must follow the deprecation cycle ofPEP-387.

Apart from the capsule C API issues, converting the remaining global variables to module state variables seem to be an easy task; most of them are used in either module functions or class methods. We can store the state in thePyCursesWindow_Type object for easy access and minimal churn.

Pitch

This is needed in order to support a per-interpreter GIL.

Previous discussion

https://github.com/ericsnowcurrently/multi-core-python/wiki/0-The-Plan

Linked PRs

Footnotes

  1. initialised_setupterm,initialisedcolors, andinitialised

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp