Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ Dictionary Objects
``len(p)`` on a dictionary.


.. c:function:: Py_ssize_t PyDict_GET_SIZE(PyObject *p)

Similar to :c:func:`PyDict_Size`, but without error checking.


.. c:function:: int PyDict_Next(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue)

Iterate over all key-value pairs in the dictionary *p*. The
Expand Down
17 changes: 17 additions & 0 deletions Doc/c-api/float.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ Floating-Point Objects
Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`.


.. c:macro:: Py_RETURN_NAN

Return :data:`math.nan` from a function.

On most platforms, this is equivalent to ``return PyFloat_FromDouble(NAN)``.


.. c:macro:: Py_RETURN_INF(sign)

Return :data:`math.inf` or :data:`-math.inf <math.inf>` from a function,
depending on the sign of *sign*.

On most platforms, this is equivalent to the following::

return PyFloat_FromDouble(copysign(INFINITY, sign));


Pack and Unpack functions
-------------------------

Expand Down
4 changes: 3 additions & 1 deletion Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,9 @@ Parser defaults
>>> parser.parse_args(['736'])
Namespace(bar=42, baz='badger', foo=736)

Note that parser-level defaults always override argument-level defaults::
Note that defaults can be set at both the parser level using :meth:`set_defaults`
and at the argument level using :meth:`add_argument`. If both are called for the
same argument, the last default set for an argument is used::

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', default='bar')
Expand Down
1 change: 0 additions & 1 deletion Doc/library/curses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,6 @@ The :mod:`curses` module defines the following data members:


.. data:: version
.. data:: __version__

A bytes object representing the current version of the module.

Expand Down
55 changes: 0 additions & 55 deletions PC/winreg.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,19 +425,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 @@ -513,48 +500,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