teptris 0.3.6.1-arm-linux → 0.3.6.2-arm-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/teptris_ext/materialize.c +58 -20
- data/lib/teptris/3.3/teptris_ext.so +0 -0
- data/lib/teptris/3.4/teptris_ext.so +0 -0
- data/lib/teptris/4.0/teptris_ext.so +0 -0
- data/lib/teptris/version.rb +1 -1
- data/sig/teptris.rbs +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 11e80640d43eac358602e5863fc081fee3862b2e8d6ce575683992d16bee1b6a
|
|
4
|
+
data.tar.gz: 6ac80d460f6d9628148605237a78776f09c5c6b2fd8ac4d84c83fc57f29c1033
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7a721ef73fb6d6530ba2a554a6b31b7882aea4f13fa7d01661f679ebce52772b50a82edd741695bbaec3f074cbb890556ece9a4c6e8d99564e794b13522e6e5
|
|
7
|
+
data.tar.gz: ebd0beddc5188a48678c52cac165119cad643c5bb1a28214afa09240878bb162e07e90d9a6d35f3454e9b3792a82f4f70fd163dee3cc0608125a679a37ea01c2
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
#define FMT_FORBID_DATE 4
|
|
11
11
|
|
|
12
12
|
static VALUE eParseError, eError, cDate, cDoc;
|
|
13
|
+
/* rb_raise's varargs formatting segfaults in its format dispatch on
|
|
14
|
+
* windows x64-mingw-ucrt ruby 4.0 (diag #158/#160: the identical raise
|
|
15
|
+
* crashes across PGO on/off while direct exception construction runs
|
|
16
|
+
* clean, and every rb_exc_new site has always been fine) — build the
|
|
17
|
+
* message with snprintf and raise via rb_exc_new. */
|
|
18
|
+
static void raise_teptris(const char *msg) {
|
|
19
|
+
rb_exc_raise(rb_exc_new(eError, msg, (long)strlen(msg)));
|
|
20
|
+
}
|
|
13
21
|
|
|
14
22
|
/* civil date -> days since epoch (Hinnant, inverse of the dump side) */
|
|
15
23
|
static int64_t days_from_civil(int32_t y, uint8_t m, uint8_t d) {
|
|
@@ -223,14 +231,14 @@ static VALUE obj_from_node(const teptris_node *n, unsigned flags,
|
|
|
223
231
|
if (flags & FMT_STRING_DATES) return dt_string(&d, kind);
|
|
224
232
|
if (kind == TEPTRIS_DATETIME_OFFSET || kind == TEPTRIS_DATETIME_LOCAL) {
|
|
225
233
|
if (flags & FMT_FORBID_TIME)
|
|
226
|
-
|
|
227
|
-
|
|
234
|
+
raise_teptris("value materializes Time, which is not in "
|
|
235
|
+
"permitted_classes (use datetime_policy: :string)");
|
|
228
236
|
return time_from_dt(&d, kind == TEPTRIS_DATETIME_OFFSET);
|
|
229
237
|
}
|
|
230
238
|
if (kind == TEPTRIS_DATE_LOCAL) {
|
|
231
239
|
if (flags & FMT_FORBID_DATE)
|
|
232
|
-
|
|
233
|
-
|
|
240
|
+
raise_teptris("value materializes Date, which is not in "
|
|
241
|
+
"permitted_classes (use datetime_policy: :string)");
|
|
234
242
|
return rb_funcall(cDate, rb_intern("new"), 3,
|
|
235
243
|
INT2FIX(d.year), INT2FIX(d.month), INT2FIX(d.day));
|
|
236
244
|
}
|
|
@@ -365,11 +373,15 @@ static VALUE ext_version(VALUE self) {
|
|
|
365
373
|
|
|
366
374
|
static ID id_utc_offset, id_to_s, id_to_i, id_nsec;
|
|
367
375
|
|
|
376
|
+
|
|
368
377
|
static void dump_check(teptris_status st) {
|
|
369
378
|
if (st == TEPTRIS_OK) return;
|
|
370
379
|
if (st == TEPTRIS_ERR_ALLOC)
|
|
371
|
-
|
|
372
|
-
|
|
380
|
+
raise_teptris("out of memory while dumping");
|
|
381
|
+
char msg[128];
|
|
382
|
+
snprintf(msg, sizeof msg, "cannot dump value (%s)",
|
|
383
|
+
teptris_status_string(st));
|
|
384
|
+
raise_teptris(msg);
|
|
373
385
|
}
|
|
374
386
|
|
|
375
387
|
/* days since 1970-01-01 -> proleptic-Gregorian y/m/d (Hinnant) */
|
|
@@ -444,7 +456,9 @@ static void dump_scalar(teptris_builder *b, const char *key, size_t klen,
|
|
|
444
456
|
TEPTRIS_DATE_LOCAL, &dt));
|
|
445
457
|
return;
|
|
446
458
|
}
|
|
447
|
-
|
|
459
|
+
char msg[192];
|
|
460
|
+
snprintf(msg, sizeof msg, "cannot dump %s", rb_obj_classname(v));
|
|
461
|
+
raise_teptris(msg);
|
|
448
462
|
}
|
|
449
463
|
}
|
|
450
464
|
|
|
@@ -506,21 +520,28 @@ static VALUE dump_with(VALUE obj,
|
|
|
506
520
|
rb_obj_classname(obj));
|
|
507
521
|
teptris_builder *b = teptris_builder_new();
|
|
508
522
|
if (b == NULL)
|
|
509
|
-
|
|
523
|
+
raise_teptris("out of memory while dumping");
|
|
510
524
|
rb_hash_foreach(obj, table_each, (VALUE)b);
|
|
511
525
|
teptris_document *doc = NULL;
|
|
512
526
|
teptris_status st = teptris_builder_finish(b, &doc);
|
|
513
527
|
if (st != TEPTRIS_OK) {
|
|
514
528
|
teptris_builder_free(b);
|
|
515
|
-
|
|
529
|
+
char msg[128];
|
|
530
|
+
snprintf(msg, sizeof msg, "cannot dump (%s)",
|
|
531
|
+
teptris_status_string(st));
|
|
532
|
+
raise_teptris(msg);
|
|
516
533
|
}
|
|
517
534
|
char *buf = NULL;
|
|
518
535
|
size_t len = 0;
|
|
519
536
|
st = emit(doc, &buf, &len);
|
|
520
537
|
teptris_document_free(doc);
|
|
521
538
|
teptris_builder_free(b); /* doc already transferred/freed */
|
|
522
|
-
if (st != TEPTRIS_OK)
|
|
523
|
-
|
|
539
|
+
if (st != TEPTRIS_OK) {
|
|
540
|
+
char msg[128];
|
|
541
|
+
snprintf(msg, sizeof msg, "dump failed (%s)",
|
|
542
|
+
teptris_status_string(st));
|
|
543
|
+
raise_teptris(msg);
|
|
544
|
+
}
|
|
524
545
|
VALUE out = rb_enc_str_new(buf, (long)len, rb_utf8_encoding());
|
|
525
546
|
free(buf);
|
|
526
547
|
return out;
|
|
@@ -734,7 +755,7 @@ static VALUE ext_plan_build(VALUE self, VALUE rows, VALUE first_row)
|
|
|
734
755
|
long nrows = RARRAY_LEN(rows);
|
|
735
756
|
long nplans = RARRAY_LEN(first_row) - 1;
|
|
736
757
|
if (nplans < 1 || nrows < 1) {
|
|
737
|
-
|
|
758
|
+
raise_teptris("plan needs >= 1 plan and >= 1 row");
|
|
738
759
|
}
|
|
739
760
|
teptris_plan_row *crows = calloc((size_t)nrows, sizeof(*crows));
|
|
740
761
|
/* bytes-vs-count: this must be (nplans+1) * sizeof(uint32_t) — the
|
|
@@ -744,7 +765,7 @@ static VALUE ext_plan_build(VALUE self, VALUE rows, VALUE first_row)
|
|
|
744
765
|
if (crows == NULL || cfirst == NULL) {
|
|
745
766
|
free(crows);
|
|
746
767
|
free(cfirst);
|
|
747
|
-
|
|
768
|
+
raise_teptris("out of memory building plan");
|
|
748
769
|
}
|
|
749
770
|
for (long i = 0; i < nrows; i++) {
|
|
750
771
|
VALUE row = rb_ary_entry(rows, i);
|
|
@@ -765,7 +786,9 @@ static VALUE ext_plan_build(VALUE self, VALUE rows, VALUE first_row)
|
|
|
765
786
|
free(crows);
|
|
766
787
|
free(cfirst);
|
|
767
788
|
if (plan == NULL) {
|
|
768
|
-
|
|
789
|
+
char msg[96];
|
|
790
|
+
snprintf(msg, sizeof msg, "invalid plan spec (status %d)", (int)st);
|
|
791
|
+
raise_teptris(msg);
|
|
769
792
|
}
|
|
770
793
|
return TypedData_Wrap_Struct(rb_cObject, &plan_type, plan);
|
|
771
794
|
}
|
|
@@ -790,7 +813,9 @@ static VALUE ext_plan_emit(VALUE self, VALUE rb_plan, VALUE toml)
|
|
|
790
813
|
teptris_plan_walk(plan, teptris_document_root(doc), &st);
|
|
791
814
|
if (res == NULL) {
|
|
792
815
|
teptris_document_free(doc);
|
|
793
|
-
|
|
816
|
+
char msg[96];
|
|
817
|
+
snprintf(msg, sizeof msg, "plan walk failed (status %d)", (int)st);
|
|
818
|
+
raise_teptris(msg);
|
|
794
819
|
}
|
|
795
820
|
VALUE out = asm_rows(plan, res, 0);
|
|
796
821
|
teptris_plan_result_free(res);
|
|
@@ -926,7 +951,7 @@ static VALUE lazy_each(VALUE self) {
|
|
|
926
951
|
break;
|
|
927
952
|
}
|
|
928
953
|
default:
|
|
929
|
-
|
|
954
|
+
raise_teptris("scalar node has nothing to iterate");
|
|
930
955
|
}
|
|
931
956
|
return self;
|
|
932
957
|
}
|
|
@@ -957,7 +982,7 @@ static VALUE lazy_get(VALUE self, VALUE key) {
|
|
|
957
982
|
break;
|
|
958
983
|
}
|
|
959
984
|
default:
|
|
960
|
-
|
|
985
|
+
raise_teptris("scalar node is not subscriptable");
|
|
961
986
|
}
|
|
962
987
|
if (child == NULL) return Qnil;
|
|
963
988
|
return lazy_wrap(v->owner, child);
|
|
@@ -1071,7 +1096,12 @@ static VALUE ext_load_lazy_batch(VALUE self, VALUE strings) {
|
|
|
1071
1096
|
long n = RARRAY_LEN(strings);
|
|
1072
1097
|
if (n == 0) return rb_ary_new();
|
|
1073
1098
|
batch_scratch *s = batch_scratch_alloc(n);
|
|
1074
|
-
if (s == NULL)
|
|
1099
|
+
if (s == NULL) {
|
|
1100
|
+
char msg[96];
|
|
1101
|
+
snprintf(msg, sizeof msg,
|
|
1102
|
+
"out of memory batching %ld documents", n);
|
|
1103
|
+
raise_teptris(msg);
|
|
1104
|
+
}
|
|
1075
1105
|
/* the batch parse is pure C: pin every input (one tmp lock per
|
|
1076
1106
|
* string - repeated objects dup; frozen strings cannot take the
|
|
1077
1107
|
* lock, yet compaction can move them) and release the GVL for the
|
|
@@ -1223,7 +1253,12 @@ static VALUE ext_load_batch(int argc, VALUE *argv, VALUE self) {
|
|
|
1223
1253
|
if (n == 0) return rb_ary_new();
|
|
1224
1254
|
unsigned flags = flags_from_opts(opts);
|
|
1225
1255
|
batch_scratch *s = batch_scratch_alloc(n);
|
|
1226
|
-
if (s == NULL)
|
|
1256
|
+
if (s == NULL) {
|
|
1257
|
+
char msg[96];
|
|
1258
|
+
snprintf(msg, sizeof msg,
|
|
1259
|
+
"out of memory batching %ld documents", n);
|
|
1260
|
+
raise_teptris(msg);
|
|
1261
|
+
}
|
|
1227
1262
|
for (long i = 0; i < n; i++) {
|
|
1228
1263
|
VALUE str = rb_ary_entry(strings, i);
|
|
1229
1264
|
StringValue(str);
|
|
@@ -1235,7 +1270,10 @@ static VALUE ext_load_batch(int argc, VALUE *argv, VALUE self) {
|
|
|
1235
1270
|
s->docs, s->statuses);
|
|
1236
1271
|
if (batch != TEPTRIS_OK) {
|
|
1237
1272
|
batch_scratch_free(s);
|
|
1238
|
-
|
|
1273
|
+
char msg[96];
|
|
1274
|
+
snprintf(msg, sizeof msg, "batch parse failed (status %d)",
|
|
1275
|
+
(int)batch);
|
|
1276
|
+
raise_teptris(msg);
|
|
1239
1277
|
}
|
|
1240
1278
|
long first_fail = -1;
|
|
1241
1279
|
for (long i = 0; i < n; i++) {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/teptris/version.rb
CHANGED
data/sig/teptris.rbs
CHANGED
|
@@ -51,10 +51,6 @@ module Teptris
|
|
|
51
51
|
|
|
52
52
|
def self.dump: (untyped obj) -> String
|
|
53
53
|
|
|
54
|
-
def self.load_doc: (String toml) -> untyped
|
|
55
|
-
|
|
56
|
-
def self.dump_doc: (untyped doc) -> String
|
|
57
|
-
|
|
58
54
|
def self.dump_json_natural: (untyped obj) -> String
|
|
59
55
|
|
|
60
56
|
def self.engine_version: () -> String
|
|
@@ -128,6 +124,10 @@ module TeptrisExt
|
|
|
128
124
|
|
|
129
125
|
def self.load_lazy_batch: (Array[String] tomls) -> Array[LazyValue]
|
|
130
126
|
|
|
127
|
+
def self.load_doc: (String toml) -> untyped
|
|
128
|
+
|
|
129
|
+
def self.dump_doc: (untyped doc) -> String
|
|
130
|
+
|
|
131
131
|
def self.dump: (untyped obj) -> String
|
|
132
132
|
|
|
133
133
|
def self.dump_json_natural: (untyped obj) -> String
|