[issue26974] Crash in Decimal.from_float

2016-07-23 Thread Stefan Krah
Changes by Stefan Krah : -- stage: commit review -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailin

[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Stefan Krah
Stefan Krah added the comment: I'm leaving this open in case anyone wants to do something about the Python version. I tend to agree with Raymond: It is impractical to "fix" all such constructs in the Python version, unless one consistently uses a style like: float.as_integer_ratio(float.__

[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Stefan Krah
Stefan Krah added the comment: Also, IMO the whole capsule mechanism would be broken if function pointers in dynamic libs could just be invalidated due to reloading. -- ___ Python tracker _

[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Stefan Krah
Stefan Krah added the comment: These are builtin static types. Even with non-builtin static types, the address of the type should always be the same. C-extensions aren't reloaded. -- ___ Python tracker ___

[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Couldn't keeping references in static variables cause problems in subinterpreters? -- ___ Python tracker ___

[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Roundup Robot
Roundup Robot added the comment: New changeset f8cb955efd6a by Stefan Krah in branch '3.5': Issue #26974: Fix segfault in the presence of absurd subclassing. Proactively https://hg.python.org/cpython/rev/f8cb955efd6a -- nosy: +python-dev ___ Python tr

[issue26974] Crash in Decimal.from_float

2016-07-16 Thread Stefan Krah
Stefan Krah added the comment: The approaches look good, but for clarity I want to replace all method calls that should never be overridden by the plain C functions of their corresponding static types. I have no opinion about the Python version. The diff also "fixes" #26975 for the C version,

[issue26974] Crash in Decimal.from_float

2016-07-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: My preference is to leave the Python implementation of from_float() as-is. Pure Python code is not obligated to defend itself against bizarre code. The C code however is obliged to not segfault. -- ___ Python t

[issue26974] Crash in Decimal.from_float

2016-07-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Ping. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue26974] Crash in Decimal.from_float

2016-06-21 Thread Stefan Krah
Stefan Krah added the comment: I'll look at it soon -- I just don't have much time right now. -- assignee: -> skrah ___ Python tracker ___ __

[issue26974] Crash in Decimal.from_float

2016-06-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Stefan? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue26974] Crash in Decimal.from_float

2016-05-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Actually the part of the second patch for Python implementation not always works correctly due to a bug (issue26983). We should either first fix issue26983 or use more complicated code. -- ___ Python tracker

[issue26974] Crash in Decimal.from_float

2016-05-09 Thread Mark Dickinson
Mark Dickinson added the comment: [Serhiy, on the second patch] > Disadvantages are that this changes behavior ignoring overriding > as_integer_ratio() and __abs__() and slightly slows down Python > implementation. None of those seem like big issues to me. Certainly we shouldn't care too much

[issue26974] Crash in Decimal.from_float

2016-05-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The second patch converts an instance of float subclass to exact float. Disadvantages are that this changes behavior ignoring overriding as_integer_ratio() and __abs__() and slightly slows down Python implementation. Advantages are that this fixes also issue

[issue26974] Crash in Decimal.from_float

2016-05-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here are two alternative patches that fix the crash. The first patch adds checks for as_integer_ratio() result. The only disadvantage is that error messages are quite arbitrary and differ from error messages in Python version. -- keywords: +patch Ad

[issue26974] Crash in Decimal.from_float

2016-05-07 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Following example causes a segmentation fault. from decimal import Decimal class BadFloat(float): def as_integer_ratio(self): return 1 def __abs__(self): return self Decimal.from_float(BadFloat(1.2)) -- components: Extension