Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-123961: move PyCursesError in _cursesmodule.c to a global state variable #124729

Merged
merged 39 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3148d86
Introduce module's state and logic.
picnixz Sep 28, 2024
75bd7b6
Store exception in the module's state.
picnixz Sep 28, 2024
b295919
Rename `curses_destructor` to `_curses_capi_destructor`
picnixz Sep 28, 2024
1665f38
Introduce macros for initialization checks.
picnixz Sep 28, 2024
2a1e13a
Update C API functions
picnixz Sep 28, 2024
9e29bd5
Update macros checking the functions being called.
picnixz Sep 28, 2024
e1cab2f
Update `PyCursesCheckERR` to use the module's state
picnixz Sep 28, 2024
5f28eb8
Add `PyCursesCheckERR_FromSelf` to prepare when the type is a heap type.
picnixz Sep 28, 2024
bcbbdd4
Update Function Prototype Macros.
picnixz Sep 28, 2024
faf4e87
Update Function Body Macros.
picnixz Sep 28, 2024
885c94c
Update `PyCursesCheckERR` usage for Window methods
picnixz Sep 28, 2024
da98de4
Update `PyCursesCheckERR` usage for module's methods
picnixz Sep 28, 2024
65c5f60
Update global references to `PyCursesError`
picnixz Sep 28, 2024
e3e1131
Make `PyCursesWindow_Type` a heap type.
picnixz Sep 28, 2024
9617f50
Correct calls to `PyCursesWindow_New`
picnixz Sep 28, 2024
1db7bea
Do not expose `PyCursesWindow_Check` when compiling `_cursesmodule.c`
picnixz Sep 28, 2024
4c207d3
Finalize multi-phase initialization for `curses`.
picnixz Sep 28, 2024
228348c
Remove redundant cast to `PyObject *`.
picnixz Sep 28, 2024
b8b0751
reduce diff (remove some PEP-7 changes)
picnixz Sep 28, 2024
83fab15
reduce diff (remove some PEP-7 changes)
picnixz Sep 28, 2024
9ff69e4
Revert "Finalize multi-phase initialization for `curses`."
picnixz Sep 28, 2024
13bd868
Revert "Introduce module's state and logic."
picnixz Sep 28, 2024
f32dee9
Revert "Make `PyCursesWindow_Type` a heap type."
picnixz Sep 28, 2024
fd38850
address Victor's review
picnixz Sep 28, 2024
e70175c
Revert "Remove redundant cast to `PyObject *`."
picnixz Sep 28, 2024
676d1ce
reduce diff
picnixz Sep 28, 2024
8a60d53
reduce diff
picnixz Sep 28, 2024
e0dfc4a
fix globals
picnixz Sep 28, 2024
e596924
fix globals
picnixz Sep 28, 2024
fc9dacb
rename the state fields
picnixz Sep 29, 2024
f548f4b
Introduce macros for initialization checks.
picnixz Sep 29, 2024
3e5c37c
Update C API functions
picnixz Sep 29, 2024
b94438f
Improve macros to use module's state when possible
picnixz Sep 29, 2024
a4edf7e
Merge branch 'curses/multiphase-module-123961' of github.com:picnixz/…
picnixz Sep 29, 2024
b987499
Make use of module's state whenever possible.
picnixz Sep 29, 2024
e8d9d66
Make use of module's state whenever possible.
picnixz Sep 29, 2024
b02e860
remove unused function for now
picnixz Sep 29, 2024
439a63f
address Victor's review
picnixz Sep 29, 2024
3936143
fix test
picnixz Sep 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Include/py_curses.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ typedef struct {
char *encoding;
} PyCursesWindowObject;

#define PyCursesWindow_Check(v) Py_IS_TYPE((v), &PyCursesWindow_Type)

#define PyCurses_CAPSULE_NAME "_curses._C_API"


Expand All @@ -99,6 +97,8 @@ static void **PyCurses_API;
#define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;}
#define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;}

#define PyCursesWindow_Check(v) Py_IS_TYPE((v), &PyCursesWindow_Type)

#define import_curses() \
PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1);

Expand Down
Loading
Loading