{"id":35543412,"url":"https://github.com/diofant/python-gmp","last_synced_at":"2026-02-20T09:10:08.021Z","repository":{"id":266044117,"uuid":"897203773","full_name":"diofant/python-gmp","owner":"diofant","description":"Safe Python bindings to the GNU GMP library","archived":false,"fork":false,"pushed_at":"2026-02-02T05:22:59.000Z","size":904,"stargazers_count":3,"open_issues_count":9,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-02T12:04:46.287Z","etag":null,"topics":["arbitrary-precision","bignum","gmp","multiple-precision","python"],"latest_commit_sha":null,"homepage":"https://python-gmp.readthedocs.io/en/latest/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diofant.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-02T08:14:52.000Z","updated_at":"2026-02-02T05:23:03.000Z","dependencies_parsed_at":"2024-12-02T09:28:00.942Z","dependency_job_id":"c13b5699-5f8b-4afc-902d-b0451b3efcec","html_url":"https://github.com/diofant/python-gmp","commit_stats":null,"previous_names":["diofant/python-gmp"],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/diofant/python-gmp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diofant%2Fpython-gmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diofant%2Fpython-gmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diofant%2Fpython-gmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diofant%2Fpython-gmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diofant","download_url":"https://codeload.github.com/diofant/python-gmp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diofant%2Fpython-gmp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29646653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T08:48:14.886Z","status":"ssl_error","status_checked_at":"2026-02-20T08:45:26.777Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arbitrary-precision","bignum","gmp","multiple-precision","python"],"created_at":"2026-01-04T05:53:58.885Z","updated_at":"2026-02-20T09:10:08.015Z","avatar_url":"https://github.com/diofant.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Python-GMP\n==========\n\nPython extension module, providing bindings to the GNU GMP via the `ZZ library\n\u003chttps://github.com/diofant/zz\u003e`_ (version 0.9.0 or later required).  This\nmodule shouldn't crash the interpreter.\n\nThe gmp can be used as a `gmpy2`_/`python-flint`_ replacement to provide\ninteger type (`mpz`_), compatible with Python's `int`_.  It also includes\nfunctions, compatible with the Python stdlib's submodule `math.integer\n\u003chttps://docs.python.org/3.15/library/math.integer.html\u003e`_.\n\nThis module requires Python 3.11 or later versions and has been tested with\nCPython 3.11 through 3.14, with PyPy3.11 7.3.20 and with GraalPy 25.0.\nFree-threading builds of the CPython are supported.\n\nReleases are available in the Python Package Index (PyPI) at\nhttps://pypi.org/project/python-gmp/.\n\n\nMotivation\n----------\n\nThe CPython (and most other Python implementations, like PyPy) is optimized to\nwork with small (machine-sized) integers.  Algorithms used here for big\nintegers usually aren't best known in the field.  Fortunately, it's possible to\nuse bindings (for example, the `gmpy2`_ package) to the GNU GMP, which aims to\nbe faster than any other bignum library for all operand sizes.\n\nBut such extension modules usually rely on default GMP's memory management and\ncan't recover from allocation failure.  So, it's easy to crash the Python\ninterpreter during the interactive session.  Following example with the gmpy2\nwill work if you set address space limit for the Python interpreter (e.g. by\n``prlimit`` command on Linux):\n\n.. code:: pycon\n\n   \u003e\u003e\u003e import gmpy2\n   \u003e\u003e\u003e gmpy2.__version__\n   '2.2.1'\n   \u003e\u003e\u003e z = gmpy2.mpz(29925959575501)\n   \u003e\u003e\u003e while True:  # this loop will crash interpter\n   ...     z = z*z\n   ...\n   GNU MP: Cannot allocate memory (size=46956584)\n   Aborted\n\nThe gmp module handles such errors correctly:\n\n.. code:: pycon\n\n   \u003e\u003e\u003e import gmp\n   \u003e\u003e\u003e z = gmp.mpz(29925959575501)\n   \u003e\u003e\u003e while True:\n   ...     z = z*z\n   ...\n   Traceback (most recent call last):\n     File \"\u003cpython-input-3\u003e\", line 2, in \u003cmodule\u003e\n       z = z*z\n           ~^~\n   MemoryError\n   \u003e\u003e\u003e # interpreter still works, all variables in\n   \u003e\u003e\u003e # the current scope are available,\n   \u003e\u003e\u003e z.bit_length()  # including pre-failure value of z\n   93882077\n\n\nWarning on --disable-alloca configure option\n--------------------------------------------\n\nYou should use the GNU GMP library, compiled with the '--disable-alloca'\nconfigure option to prevent using alloca() for temporary workspace allocation,\nor this module may crash the interpreter in case of a stack overflow.\n\n\n.. _gmpy2: https://pypi.org/project/gmpy2/\n.. _python-flint: https://pypi.org/project/python-flint/\n.. _mpz: https://python-gmp.readthedocs.io/en/latest/#gmp.mpz\n.. _int: https://docs.python.org/3/library/functions.html#int\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiofant%2Fpython-gmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiofant%2Fpython-gmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiofant%2Fpython-gmp/lists"}