cpython/Modules
Mark Dickinson 73934b9da0
bpo-36887: add math.isqrt (GH-13244)
* Add math.isqrt function computing the integer square root.

* Code cleanup: remove redundant comments, rename some variables.

* Tighten up code a bit more; use Py_XDECREF to simplify error handling.

* Update Modules/mathmodule.c

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>

* Update Modules/mathmodule.c

Use real argument clinic type instead of an alias

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>

* Add proof sketch

* Updates from review.

* Correct and expand documentation.

* Fix bad reference handling on error; make some variables block-local; other tidying.

* Style and consistency fixes.

* Add missing error check; don't try to DECREF a NULL a

* Simplify some error returns.

* Another two test cases:

- clarify that floats are rejected even if they happen to be
  squares of small integers
- TypeError beats ValueError for a negative float

* Documentation and markup improvements; thanks Serhiy for the suggestions!

* Cleaner Misc/NEWS entry wording.

* Clean up (with one fix) to the algorithm explanation and proof.
2019-05-18 12:29:50 +01:00
..
_blake2 bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058) 2019-03-14 10:32:22 +02:00
_ctypes bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375) 2019-05-17 10:13:03 +03:00
_decimal bpo-36793: Remove unneeded __str__ definitions. (GH-13081) 2019-05-06 22:29:40 +03:00
_io bpo-36748: optimize TextIOWrapper.write() for ASCII string (GH-13002) 2019-05-16 15:03:20 +09:00
_multiprocessing bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058) 2019-03-14 10:32:22 +02:00
_sha3 closes bpo-35643: Fix a SyntaxWarning: invalid escape sequence in Modules/_sha3/cleanup.py (GH-11411) 2019-01-02 11:26:57 -08:00
_sqlite bpo-30262: Don't expose private objects in sqlite3 (GH-1440) 2019-05-09 21:05:45 +03:00
_xxtestfuzz Avoid UB in test selection macro. (#3407) 2017-09-06 18:00:47 -07:00
cjkcodecs bpo-35194: cjkcodec: check the encoded value is not truncated (GH-10432) 2019-03-29 16:48:47 +09:00
clinic bpo-36887: add math.isqrt (GH-13244) 2019-05-18 12:29:50 +01:00
expat bpo-31374: expat doesn't include <pyconfig.h> on Windows (GH-11079) 2018-12-10 16:06:18 +01:00
README
Setup bpo-36635: Add _testinternalcapi module (GH-12841) 2019-04-18 11:37:26 +02:00
_abc.c fix _abc.c compile error on Cygwin (GH-8445) 2019-02-24 10:30:14 +09:00
_asynciomodule.c asyncio: PendingDeprecationWarning -> DeprecationWarning (GH-12494) 2019-03-22 04:07:32 -07:00
_bisectmodule.c bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749) 2018-11-27 13:27:31 +02:00
_bz2module.c bpo-33138: Change standard error message for non-pickleable and non-copyable types. (GH-6239) 2018-10-31 02:28:07 +02:00
_codecsmodule.c bpo-36297: remove "unicode_internal" codec (GH-12342) 2019-03-18 15:44:11 +09:00
_collectionsmodule.c bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264) 2019-03-13 22:59:55 +02:00
_contextvarsmodule.c bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473) 2018-09-21 15:33:56 -04:00
_cryptmodule.c bpo-28503: Use crypt_r() when available instead of crypt() (GH-11373) 2018-12-30 15:42:32 -08:00
_csv.c Change WriterObj.writeline to WriterObj.write (GH-12344) 2019-05-14 06:45:14 -07:00
_curses_panel.c bpo-35810: Incref heap-allocated types in PyObject_Init (GH-11661) 2019-03-27 12:52:18 +01:00
_cursesmodule.c bpo-33029: Fix signatures of getter and setter functions. (GH-10746) 2018-11-27 19:34:35 +02:00
_datetimemodule.c bpo-36004: Add date.fromisocalendar (GH-11888) 2019-04-29 15:22:03 +02:00
_dbmmodule.c bpo-33106: change dbm key deletion error for readonly file from KeyError to dbm.error (#6295) 2018-12-12 20:46:55 +08:00
_elementtree.c bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375) 2019-05-17 10:13:03 +03:00
_functoolsmodule.c bpo-36650: Fix handling of empty keyword args in C version of lru_cache. (GH-12881) 2019-04-20 07:20:44 -10:00
_gdbmmodule.c bpo-8677: use PY_SSIZE_T_CLEAN in Modules/_gdbmodule.c (GH-12464) 2019-03-20 19:01:55 +09:00
_hashopenssl.c bpo-36209: Fix typo on hashlib error message (GH-12194) 2019-03-06 15:35:35 +01:00
_heapqmodule.c bpo-34797: Convert heapq to the argument clinic (GH-9560) 2018-09-28 12:39:43 -07:00
_json.c bpo-36793: Remove unneeded __str__ definitions. (GH-13081) 2019-05-06 22:29:40 +03:00
_localemodule.c bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264) 2019-03-13 22:59:55 +02:00
_lsprof.c bpo-36575: lsprof: Use _PyTime_GetPerfCounter() (GH-8378) 2019-04-11 19:11:46 +09:00
_lzmamodule.c bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264) 2019-03-13 22:59:55 +02:00
_math.c
_math.h
_opcode.c bpo-32455: Add jump parameter to dis.stack_effect(). (GH-6610) 2018-09-18 09:54:26 +03:00
_operator.c bpo-35582: Inline arguments tuple unpacking in handwritten code. (GH-11524) 2019-01-12 08:25:41 +02:00
_pickle.c bpo-35900: Enable custom reduction callback registration in _pickle (GH-12499) 2019-05-08 23:08:25 +02:00
_posixsubprocess.c bpo-35550: Fix incorrect Solaris define guards (GH-11275) 2018-12-30 18:16:40 -08:00
_queuemodule.c bpo-35081: Make some _PyGC macros internal (GH-10507) 2018-11-13 12:52:18 +01:00
_randommodule.c closes bpo-35991: Fix a potential double free in Modules/_randommodule.c. (GH-11849) 2019-02-13 23:43:17 -08:00
_scproxy.c closes bpo-31903: Release the GIL when calling into SystemConfiguration (GH-4178) 2018-09-11 16:14:00 -07:00
_sre.c bpo-36251: Fix format strings used in match_repr() and stdprinter_repr(). (GH-12252) 2019-03-10 12:29:14 +02:00
_ssl.c bpo-35926: Add support for OpenSSL 1.1.1b on Windows (GH-11779) 2019-05-15 15:38:55 -07:00
_ssl_data.h
_stat.c
_struct.c bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112) 2019-02-25 17:59:46 +02:00
_testbuffer.c bpo-33029: Fix signatures of getter and setter functions. (GH-10746) 2018-11-27 19:34:35 +02:00
_testcapimodule.c bpo-36782: Created C API wrappers and added missing tests for functions in the PyDateTimeAPI. (#13088) 2019-05-17 22:28:42 +02:00
_testimportmultiple.c
_testinternalcapi.c bpo-36635: Add _testinternalcapi module (GH-12841) 2019-04-18 11:37:26 +02:00
_testmultiphase.c bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112) 2019-02-25 17:59:46 +02:00
_threadmodule.c bpo-36084: Add native thread ID to threading.Thread objects (GH-11993) 2019-05-12 19:08:24 +02:00
_tkinter.c bpo-35810: Incref heap-allocated types in PyObject_Init (GH-11661) 2019-03-27 12:52:18 +01:00
_tracemalloc.c bpo-29564:_PyMem_DumpTraceback() suggests enabling tracemalloc (GH-10510) 2018-11-13 15:14:58 +01:00
_uuidmodule.c bpo-32493: Fix uuid.uuid1() on FreeBSD. (GH-7099) 2018-05-25 00:45:09 +02:00
_weakref.c bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
_winapi.c bpo-36387: Refactor getenvironment() in _winapi.c. (GH-12482) 2019-03-28 16:01:34 +02:00
_xxsubinterpretersmodule.c bpo-36594: Fix incorrect use of %p in format strings (GH-12769) 2019-05-06 12:56:50 -04:00
addrinfo.h
arraymodule.c bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375) 2019-05-17 10:13:03 +03:00
atexitmodule.c bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749) 2018-11-27 13:27:31 +02:00
audioop.c bpo-33781: audioop: enhance rounding double as int (GH-7447) 2018-06-06 15:50:50 +02:00
binascii.c bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264) 2019-03-13 22:59:55 +02:00
cmathmodule.c bpo-36908: 'This module is always available' isn't helpful. (#13297) 2019-05-17 15:29:13 +05:30
config.c.in rename _imp initialization function to follow conventions (#5432) 2018-01-29 11:33:57 -08:00
errnomodule.c
faulthandler.c bpo-36763: Add _PyInitError functions (GH-13395) 2019-05-17 23:54:00 +02:00
fcntlmodule.c bpo-35189: Retry fnctl calls on EINTR (GH-10413) 2018-11-23 16:46:12 +01:00
gc_weakref.txt
gcmodule.c bpo-36710: Add runtime parameter in gcmodule.c (GH-12958) 2019-04-26 02:32:01 +02:00
getaddrinfo.c bpo-32241: Add the const qualifire to declarations of umodifiable strings. (#4748) 2017-12-12 13:55:04 +02:00
getbuildinfo.c bpo-27593: Get SCM build info from git instead of hg. (#446) 2017-03-04 00:19:55 -05:00
getnameinfo.c
getpath.c bpo-36763: Add _PyInitError functions (GH-13395) 2019-05-17 23:54:00 +02:00
grpmodule.c bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165) 2018-12-05 21:10:18 +02:00
hashlib.h bpo-31370: Remove support for threads-less builds (#3385) 2017-09-07 18:56:24 +02:00
hashtable.c bpo-36594: Fix incorrect use of %p in format strings (GH-12769) 2019-05-06 12:56:50 -04:00
hashtable.h
itertoolsmodule.c bpo-36430: Fix a possible reference leak in itertools.count(). (GH-12551) 2019-03-26 08:05:29 +02:00
ld_so_aix.in Issue #10656: Fix out-of-tree building on AIX 2016-11-20 07:56:37 +00:00
main.c bpo-36763: _Py_RunMain() doesn't call Py_Exit() anymore (GH-13390) 2019-05-17 23:05:29 +02:00
makesetup closes bpo-34212: Build core extension modules with Py_BUILD_CORE_BUILTIN. (GH-8712) 2018-11-26 20:21:31 -06:00
makexp_aix
mathmodule.c bpo-36887: add math.isqrt (GH-13244) 2019-05-18 12:29:50 +01:00
md5module.c bpo-20216: Correct docstrings of digest() methods in hashlib. (GH-9873) 2018-10-19 20:42:53 +03:00
mmapmodule.c bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375) 2019-05-17 10:13:03 +03:00
nismodule.c bpo-35356: Fix a possible reference leak in nis.maps(). (GH-10808) 2018-11-30 09:40:16 +02:00
ossaudiodev.c bpo-34740: Get rid of tp_getattro in ossaudiodev.oss_audio_device. (GH-9421) 2018-10-04 10:42:06 +03:00
overlapped.c bpo-33895: Relase GIL while calling functions that acquire Windows loader lock (GH-7789) 2019-02-02 09:16:42 -08:00
parsermodule.c fix warnings by adding more const (GH-12924) 2019-04-23 20:39:37 +09:00
posixmodule.c bpo-36728: Remove PyEval_ReInitThreads() from C API (GH-13241) 2019-05-13 12:35:37 +02:00
posixmodule.h bpo-33441: Make the sigset_t converter available in other modules. (GH-6720) 2018-05-08 07:48:50 +03:00
pwdmodule.c bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165) 2018-12-05 21:10:18 +02:00
pyexpat.c bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112) 2019-02-25 17:59:46 +02:00
readline.c bpo-35441: Remove dead and buggy code related to PyList_SetItem(). (GH-11033) 2018-12-08 16:16:55 +02:00
resource.c bpo-34674: Assume unistd.h exists on Unix. (GH-9290) 2018-09-13 21:57:31 -07:00
rotatingtree.c
rotatingtree.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
selectmodule.c bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112) 2019-02-25 17:59:46 +02:00
sha1module.c bpo-20216: Correct docstrings of digest() methods in hashlib. (GH-9873) 2018-10-19 20:42:53 +03:00
sha256module.c bpo-20216: Correct docstrings of digest() methods in hashlib. (GH-9873) 2018-10-19 20:42:53 +03:00
sha512module.c bpo-20216: Correct docstrings of digest() methods in hashlib. (GH-9873) 2018-10-19 20:42:53 +03:00
signalmodule.c bpo-36710: Add 'ceval' local variable to ceval.c (GH-12934) 2019-05-10 23:39:09 +02:00
socketmodule.c bpo-29515: add missing socket.IPPROTO_* constants on Windows (GH-12183) 2019-03-28 15:20:30 +01:00
socketmodule.h bpo-31425: Expose AF_QIPCRTR in socket module (GH-3706) 2018-09-26 16:47:52 +03:00
spwdmodule.c [security] bpo-13617: Reject embedded null characters in wchar* strings. (#2302) 2017-06-28 08:30:06 +03:00
sre.h bpo-25054, bpo-1647489: Added support of splitting on zerowidth patterns. (#4471) 2017-12-04 14:29:05 +02:00
sre_constants.h bpo-31690: Allow the inline flags "a", "L", and "u" to be used as group flags for RE. (#3885) 2017-10-24 23:31:42 +03:00
sre_lib.h bpo-34294: re module, fix wrong capturing groups in rare cases. (GH-11546) 2019-02-18 15:26:37 +02:00
symtablemodule.c bpo-34983: Expose symtable.Symbol.is_nonlocal() in the symtable module (GH-9872) 2018-10-20 01:46:00 +01:00
syslogmodule.c bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749) 2018-11-27 13:27:31 +02:00
termios.c Fix a possible "double decref" in termios.tcgetattr(). (GH-10194) 2018-10-29 06:55:20 +02:00
testcapi_long.h
timemodule.c bpo-36895: remove time.clock() as per removal notice. (GH-13270) 2019-05-12 18:34:44 -07:00
tkappinit.c
tkinter.h
unicodedata.c bpo-36642: make unicodedata const (GH-12855) 2019-04-17 08:40:34 +09:00
unicodedata_db.h closes bpo-36861: Update Unicode database to 12.1.0. (GH-13214) 2019-05-08 20:59:35 -07:00
unicodename_db.h closes bpo-36861: Update Unicode database to 12.1.0. (GH-13214) 2019-05-08 20:59:35 -07:00
winreparse.h bpo-31512: Add non-elevated symlink support for Windows (GH-3652) 2019-04-09 11:19:46 -07:00
xxlimited.c bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112) 2019-02-25 17:59:46 +02:00
xxmodule.c bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112) 2019-02-25 17:59:46 +02:00
xxsubtype.c bpo-33029: Fix signatures of getter and setter functions. (GH-10746) 2018-11-27 19:34:35 +02:00
zlibmodule.c bpo-36048: Use __index__() instead of __int__() for implicit conversion if available. (GH-11952) 2019-02-25 17:57:58 +02:00

README

Source files for standard library extension modules,
and former extension modules that are now builtin modules.