FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-140916: Remove unused codes in winreg.c by aisk · Pull Request #140934 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
55 changes: 0 additions & 55 deletions PC/winreg.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -399,19 +399,6 @@ static PyType_Spec pyhkey_type_spec = {
/************************************************************************
The public PyHKEY API (well, not public yet :-)
************************************************************************/
PyObject *
PyHKEY_New(PyObject *m, HKEY hInit)
{
winreg_state *st = _PyModule_GetState(m);
PyHKEYObject *key = PyObject_GC_New(PyHKEYObject, st->PyHKEY_Type);
if (key == NULL) {
return NULL;
}
key->hkey = hInit;
PyObject_GC_Track(key);
return (PyObject *)key;
}

BOOL
PyHKEY_Close(winreg_state *st, PyObject *ob_handle)
{
Expand Down Expand Up @@ -487,48 +474,6 @@ PyHKEY_FromHKEY(winreg_state *st, HKEY h)
}


/************************************************************************
The module methods
************************************************************************/
BOOL
PyWinObject_CloseHKEY(winreg_state *st, PyObject *obHandle)
{
BOOL ok;
if (PyHKEY_Check(st, obHandle)) {
ok = PyHKEY_Close(st, obHandle);
}
#if SIZEOF_LONG >= SIZEOF_HKEY
else if (PyLong_Check(obHandle)) {
long rc;
Py_BEGIN_ALLOW_THREADS
rc = RegCloseKey((HKEY)PyLong_AsLong(obHandle));
Py_END_ALLOW_THREADS
ok = (rc == ERROR_SUCCESS);
if (!ok)
PyErr_SetFromWindowsErrWithFunction(rc, "RegCloseKey");
}
#else
else if (PyLong_Check(obHandle)) {
long rc;
HKEY hkey = (HKEY)PyLong_AsVoidPtr(obHandle);
Py_BEGIN_ALLOW_THREADS
rc = RegCloseKey(hkey);
Py_END_ALLOW_THREADS
ok = (rc == ERROR_SUCCESS);
if (!ok)
PyErr_SetFromWindowsErrWithFunction(rc, "RegCloseKey");
}
#endif
else {
PyErr_SetString(
PyExc_TypeError,
"A handle must be a HKEY object or an integer");
return FALSE;
}
return ok;
}


/*
Private Helper functions for the registry interfaces

Expand Down
Loading

Back | FazBrowse Home | New Git URL