Skip to content

PrecLimit not restored on exception #404

@tompng

Description

@tompng

Some method internally calls pl = VpSetPrecLimit(0) and restores PrecLimit with VpSetPrecLimit(pl).
But when an exception is raised, PrecLimit is not restored.

BigDecimal.limit(3)
BigDecimal.mode(BigDecimal::EXCEPTION_ALL, true)

begin
  BigDecimal(1) / BigDecimal::NAN
  BigDecimal(1).add(Object.new, 1)
  BigDecimal(1).sub(Object.new, 1)
  BigDecimal(1).mult(BigDecimal::NAN, 1)
  BigDecimal(1).mult(Object.new, 1)
  BigDecimal(1).div(BigDecimal::NAN, 1)
  BigDecimal(1).div(Object.new, 1)
rescue
end

BigDecimal.limit # Should be 3, got 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions