Why am I getting a segmentation error when using modulo in a Python interpreter?

MacBook-Air:~ sgarza62$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 1 % 10
1
>>> 10 % 1
Segmentation fault: 11

Also happens with modular operations such as 1 % 1and 2 % 2.

Running Mac OS 10.9.2 on this computer.

+4
source share
1 answer

This has nothing to do with the modulo operation. The interactive interpreter will be divided into each 2nd command invoked .

An OS update of 10.9 (Mavericks) caused instability in some versions of Python. To fix this problem, download and run the patch through the terminal:

>>> curl -O http://bugs.python.org/file32324/patch_readline_issue_18458.sh
>>> openssl sha1 patch_readline_issue_18458.sh
>>> sh ./patch_readline_issue_18458.sh

Python , Mavericks. https://www.python.org/downloads/

Hyperboreus .

+1

Source: https://habr.com/ru/post/1535984/


All Articles