# 1. Get the source however you like
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
tar xfz ruby-2.1.1.tar.gz
cd ruby-2.1.1
# 2. Apply this patch! This is the interesting part.
curl https://gist.githubusercontent.com/henrik/10880288/raw/fe228cf0524873c992fa5c31b1173537dca76a2c/patch.diff | patch -p0
# 3. Build it however you like
# …
make install
Last active
August 29, 2015 13:59
-
-
Save henrik/10880288 to your computer and use it in GitHub Desktop.
Ruby 2.1.1 BigDecimal patch backported from https://bugs.ruby-lang.org/issues/9657#note-8 - https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/45015/diff/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: ext/bigdecimal/bigdecimal.c | |
=================================================================== | |
--- ext/bigdecimal/bigdecimal.c (revision 45014) | |
+++ ext/bigdecimal/bigdecimal.c (revision 45015) | |
@@ -2467,9 +2467,11 @@ | |
static VALUE | |
BigDecimal_initialize(int argc, VALUE *argv, VALUE self) | |
{ | |
+ ENTER(1); | |
Real *pv = rb_check_typeddata(self, &BigDecimal_data_type); | |
- Real *x = BigDecimal_new(argc, argv); | |
+ Real *x; | |
+ GUARD_OBJ(x, BigDecimal_new(argc, argv)); | |
if (ToValue(x)) { | |
pv = VpCopy(pv, x); | |
} | |
@@ -2548,7 +2550,10 @@ | |
static VALUE | |
BigDecimal_global_new(int argc, VALUE *argv, VALUE self) | |
{ | |
- Real *pv = BigDecimal_new(argc, argv); | |
+ ENTER(1); | |
+ Real *pv; | |
+ | |
+ GUARD_OBJ(pv, BigDecimal_new(argc, argv)); | |
if (ToValue(pv)) pv = VpCopy(NULL, pv); | |
pv->obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, pv); | |
return pv->obj; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment