yeptris 0.6.5.4-aarch64-linux → 0.6.7.1-aarch64-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/lib/yeptris/ffi.rb +12 -15
- data/lib/yeptris/json.rb +5 -2
- data/lib/yeptris/native.so +0 -0
- data/lib/yeptris/psych.rb +76 -3
- data/lib/yeptris.rb +27 -7
- data/libyeptris.so +0 -0
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2698d9b9eb57a88b828e8a395bcd51fa7037c3fa16bb056348f2c507abfad68b
|
|
4
|
+
data.tar.gz: '08c7947f3a5bc0c1878aee5fc6cb3565be31f55b2f43d3ea165a50adac0b384e'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27e37a028e8af437ff1057aa18b1ae5d99466ede0cf1f2507f91b97be15404f4c51153fdce77b79b09aab77a5aa62a8c79e1872ef4d3a7bdce623a67d71b0314
|
|
7
|
+
data.tar.gz: a01384b2cc548e1f488bd4f2f0c805a27b434b4aa42ee56596d83e690a792a4a3e5f2d9225464291b558ab57288d8cf3aaf46dfce491160b022dce4f9df561e0
|
data/lib/yeptris/ffi.rb
CHANGED
|
@@ -28,17 +28,6 @@ module Yeptris
|
|
|
28
28
|
MSG
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
# :c_free (:free, line ~240) must resolve against the C runtime.
|
|
32
|
-
# Linux/macOS fall through to the process symbol table, but
|
|
33
|
-
# Windows has no such fallback — without LIBC attached the
|
|
34
|
-
# ffi.rb load DIED at that attach (leaving every later constant
|
|
35
|
-
# undefined: the mingw gem's missing NODE_* / #318).
|
|
36
|
-
begin
|
|
37
|
-
ffi_lib FFI::Library::LIBC
|
|
38
|
-
rescue StandardError
|
|
39
|
-
# no LIBC handle: the c_free attach below surfaces the failure
|
|
40
|
-
# exactly where it used to, on non-Windows platforms only
|
|
41
|
-
end
|
|
42
31
|
|
|
43
32
|
typedef :pointer, :yeptris_document
|
|
44
33
|
typedef :pointer, :yeptris_node
|
|
@@ -242,9 +231,17 @@ module Yeptris
|
|
|
242
231
|
end
|
|
243
232
|
|
|
244
233
|
# Owned char* results (serialize*): one reader, freed exactly once.
|
|
245
|
-
# The
|
|
246
|
-
#
|
|
247
|
-
|
|
234
|
+
# The release goes through yeptris_free (libyeptris's own
|
|
235
|
+
# allocator-matching free) because ffi's :free attach has no
|
|
236
|
+
# Windows process-symbol fallback — libyeptris.dll doesn't export
|
|
237
|
+
# libc free, so resolving :free against it fails on Windows.
|
|
238
|
+
begin
|
|
239
|
+
attach_function :yeptris_free, [:pointer], :void
|
|
240
|
+
rescue ::FFI::NotFoundError
|
|
241
|
+
# libyeptris < v0.6.6: POSIX resolves :free through the process
|
|
242
|
+
# symbol table, so the direct libc attach still works there.
|
|
243
|
+
attach_function :yeptris_free, :free, [:pointer], :void
|
|
244
|
+
end
|
|
248
245
|
|
|
249
246
|
module Owned
|
|
250
247
|
module_function
|
|
@@ -261,7 +258,7 @@ module Yeptris
|
|
|
261
258
|
else
|
|
262
259
|
ptr.read_string.force_encoding(Encoding::UTF_8)
|
|
263
260
|
end
|
|
264
|
-
::Yeptris::FFI.
|
|
261
|
+
::Yeptris::FFI.yeptris_free(ptr)
|
|
265
262
|
s
|
|
266
263
|
end
|
|
267
264
|
end
|
data/lib/yeptris/json.rb
CHANGED
|
@@ -71,7 +71,7 @@ module Yeptris
|
|
|
71
71
|
return s unless s.include?("\\")
|
|
72
72
|
|
|
73
73
|
b = s.b
|
|
74
|
-
out =
|
|
74
|
+
out = String.new(encoding: Encoding::BINARY)
|
|
75
75
|
i = 0
|
|
76
76
|
n = b.bytesize
|
|
77
77
|
while i < n
|
|
@@ -154,7 +154,10 @@ module Yeptris
|
|
|
154
154
|
stack.pop
|
|
155
155
|
key_sets&.pop
|
|
156
156
|
when T_STR
|
|
157
|
-
|
|
157
|
+
# empty-string literals are frozen+shared since Ruby 3.4
|
|
158
|
+
# (and `+""` binds after the method chain anyway), so the
|
|
159
|
+
# fresh copy must come from the encoding call itself
|
|
160
|
+
text = lens[i] == 0 ? String.new(encoding: Encoding::UTF_8) : decode_span(src, offs[i], lens[i])
|
|
158
161
|
if pending_key.nil? && !stack.empty? && stack.last.is_a?(Hash)
|
|
159
162
|
if key_sets && key_sets.last.key?(text)
|
|
160
163
|
raise ParseError, %(duplicate key "#{text}" in JSON object)
|
data/lib/yeptris/native.so
CHANGED
|
Binary file
|
data/lib/yeptris/psych.rb
CHANGED
|
@@ -4,6 +4,11 @@ require "date"
|
|
|
4
4
|
require "time"
|
|
5
5
|
require "set"
|
|
6
6
|
|
|
7
|
+
# Self-sufficient (the #95 yaml.rb fix, same class): the standalone
|
|
8
|
+
# require "yeptris/psych" must register the Document/FFI machinery —
|
|
9
|
+
# consumers load this face directly under the drop-in.
|
|
10
|
+
require "yeptris"
|
|
11
|
+
|
|
7
12
|
# The Psych drop-in namespace (TODO.impl/15 phase C).
|
|
8
13
|
#
|
|
9
14
|
# `require "yeptris/psych"` loads this namespace WITHOUT touching the
|
|
@@ -130,7 +135,7 @@ module Yeptris
|
|
|
130
135
|
# Psych 5: load is safe — plain data structures only. Tagged
|
|
131
136
|
# nodes raise DisallowedClass unless their class is permitted
|
|
132
137
|
# (Date/Time/Symbol are built in; they are plain data here).
|
|
133
|
-
def load(yaml, permitted_classes: [], aliases: false, **)
|
|
138
|
+
def load(yaml, permitted_classes: [::Date, ::Time], aliases: false, **)
|
|
134
139
|
safe_load(yaml, permitted_classes: permitted_classes, aliases: aliases)
|
|
135
140
|
end
|
|
136
141
|
|
|
@@ -144,10 +149,78 @@ module Yeptris
|
|
|
144
149
|
Visitors::ToRuby.visit(tree.children.first)
|
|
145
150
|
end
|
|
146
151
|
|
|
147
|
-
def safe_load(yaml, permitted_classes: [], aliases: false, **)
|
|
152
|
+
def safe_load(yaml, permitted_classes: [::Date, ::Time], aliases: false, **)
|
|
153
|
+
doc = Yeptris::Document.parse(yaml, schema: :compat_11)
|
|
154
|
+
begin
|
|
155
|
+
force_utf8_scalars(walk_safe(doc.root(0), permitted_classes, aliases))
|
|
156
|
+
ensure
|
|
157
|
+
doc.free
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# A YAML stream is a Unicode character stream: stdlib psych tags
|
|
162
|
+
# non-ASCII scalars UTF-8 even when the input String is BINARY
|
|
163
|
+
# (#135). ASCII-only values keep their (binary) encoding — a
|
|
164
|
+
# re-tag would be observable there and stdlib does not either.
|
|
165
|
+
def force_utf8_scalars(obj)
|
|
166
|
+
case obj
|
|
167
|
+
when ::String
|
|
168
|
+
obj.force_encoding(::Encoding::UTF_8) if obj.encoding == ::Encoding::ASCII_8BIT && !obj.ascii_only?
|
|
169
|
+
obj
|
|
170
|
+
when ::Hash
|
|
171
|
+
obj.each { |k, v| force_utf8_scalars(k); force_utf8_scalars(v) }
|
|
172
|
+
when ::Array
|
|
173
|
+
obj.each { |v| force_utf8_scalars(v) }
|
|
174
|
+
else
|
|
175
|
+
obj
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# stdlib's file-level faces (#135): BOM-tolerant UTF-8 reads with
|
|
180
|
+
# the fallback contract (load_file path, fallback: false default).
|
|
181
|
+
def load_file(path, fallback: false, **kwargs)
|
|
182
|
+
File.open(path, "r:bom|utf-8") { |f| load(f, **kwargs) }
|
|
183
|
+
rescue Errno::ENOENT
|
|
184
|
+
raise unless fallback
|
|
185
|
+
|
|
186
|
+
false
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def safe_load_file(path, fallback: false, **kwargs)
|
|
190
|
+
File.open(path, "r:bom|utf-8") { |f| safe_load(f, **kwargs) }
|
|
191
|
+
rescue Errno::ENOENT
|
|
192
|
+
raise unless fallback
|
|
193
|
+
|
|
194
|
+
false
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def unsafe_load_file(path, fallback: false, **kwargs)
|
|
198
|
+
File.open(path, "r:bom|utf-8") { |f| unsafe_load(f, **kwargs) }
|
|
199
|
+
rescue Errno::ENOENT
|
|
200
|
+
raise unless fallback
|
|
201
|
+
|
|
202
|
+
false
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def parse_file(path, **kwargs)
|
|
206
|
+
File.open(path, "r:bom|utf-8") { |f| parse(f, **kwargs) }
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
# stdlib's deprecated safe/dump split — same output here (every
|
|
212
|
+
# value this loader produces is safe data)
|
|
213
|
+
def safe_dump(obj, io = nil, options = {})
|
|
214
|
+
::Yeptris::Psych.dump(obj, io, options)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def load_stream(yaml, **kwargs)
|
|
218
|
+
# materialize each document's root directly — the stream
|
|
219
|
+
# children share one C document, so their handles would all
|
|
220
|
+
# resolve to the first document's tree
|
|
148
221
|
doc = Yeptris::Document.parse(yaml, schema: :compat_11)
|
|
149
222
|
begin
|
|
150
|
-
|
|
223
|
+
(0...doc.document_count).map { |i| doc.root(i).to_ruby }
|
|
151
224
|
ensure
|
|
152
225
|
doc.free
|
|
153
226
|
end
|
data/lib/yeptris.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Yeptris
|
|
4
4
|
# The gem's version lives in the parent namespace's file — the last
|
|
5
5
|
# internal require (yeptris/version) retired with it.
|
|
6
|
-
VERSION = "0.6.
|
|
6
|
+
VERSION = "0.6.7.1".freeze
|
|
7
7
|
# The error hierarchy lives in THIS file (the parent namespace's
|
|
8
8
|
# own file): nested constants do not trigger a parent-constant
|
|
9
9
|
# autoload, and the law forbids internal requires — defining the
|
|
@@ -44,14 +44,15 @@ module Yeptris
|
|
|
44
44
|
autoload :ValueML, "yeptris/valueml"
|
|
45
45
|
autoload :Psych, "yeptris/psych"
|
|
46
46
|
autoload :Schema, "yeptris/schema"
|
|
47
|
-
|
|
48
|
-
# The safe_load error names, aliased at the top level so consumers
|
|
49
|
-
# writing rescues need no nesting knowledge (issue #73's naming
|
|
50
|
-
# note): Yeptris::DisallowedClass is Yeptris::Psych::DisallowedClass.
|
|
51
|
-
DisallowedClass = Psych::DisallowedClass
|
|
52
|
-
AliasesError = Psych::AliasesError
|
|
53
47
|
end
|
|
54
48
|
|
|
49
|
+
# NOTE (the #318 poisoned-process class): the Psych error-name aliases
|
|
50
|
+
# live BELOW the ffi require — reading Psych here would trigger the
|
|
51
|
+
# psych autoload BEFORE the native library resolves, and a mid-load
|
|
52
|
+
# ffi failure under a drop-in rebind left ::Psych rebound against a
|
|
53
|
+
# half-initialized FFI module (every to_yaml in the process died).
|
|
54
|
+
# With this order an ffi failure is a clean, loud require failure.
|
|
55
|
+
|
|
55
56
|
# Eager native-library resolution (leptris-ruby lesson): fail at
|
|
56
57
|
# require time, not at first parse. The ffi require MUST come after
|
|
57
58
|
# the autoload registrations — ffi.rb opens module Yeptris, and
|
|
@@ -67,6 +68,25 @@ rescue LoadError => e
|
|
|
67
68
|
MSG
|
|
68
69
|
end
|
|
69
70
|
|
|
71
|
+
|
|
72
|
+
# The safe_load error names, aliased at the top level so consumers
|
|
73
|
+
# writing rescues need no nesting knowledge (issue #73's naming
|
|
74
|
+
# note): Yeptris::DisallowedClass is Yeptris::Psych::DisallowedClass.
|
|
75
|
+
# LAZY (const_missing): a standalone require "yeptris/psych" loads
|
|
76
|
+
# yeptris.rb MID-psych — an eager alias here would re-enter the
|
|
77
|
+
# half-loaded psych.rb through the autoload and NameError. At first
|
|
78
|
+
# touch psych is complete in every load order.
|
|
79
|
+
module Yeptris
|
|
80
|
+
def self.const_missing(name)
|
|
81
|
+
case name
|
|
82
|
+
when :DisallowedClass, :AliasesError
|
|
83
|
+
const_set(name, Psych.const_get(name))
|
|
84
|
+
else
|
|
85
|
+
super
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
70
90
|
# Optional C-API materializer (TODO.restructure/22): fused visit →
|
|
71
91
|
# Ruby objects via the Ruby C API. Feature-detected — LoadError leaves
|
|
72
92
|
# the FFI ladder (Marshal → columns → records) as the sole path.
|
data/libyeptris.so
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yeptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.7.1
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-09-18 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: ffi
|
|
@@ -64,6 +65,7 @@ metadata:
|
|
|
64
65
|
homepage_uri: https://github.com/leptris/yeptris
|
|
65
66
|
source_code_uri: https://github.com/leptris/yeptris
|
|
66
67
|
changelog_uri: https://github.com/leptris/yeptris/releases
|
|
68
|
+
post_install_message:
|
|
67
69
|
rdoc_options: []
|
|
68
70
|
require_paths:
|
|
69
71
|
- lib
|
|
@@ -78,7 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
78
80
|
- !ruby/object:Gem::Version
|
|
79
81
|
version: '0'
|
|
80
82
|
requirements: []
|
|
81
|
-
rubygems_version:
|
|
83
|
+
rubygems_version: 3.5.22
|
|
84
|
+
signing_key:
|
|
82
85
|
specification_version: 4
|
|
83
86
|
summary: 'The YAML counterpart of libleptris: ultra-performance YAML 1.2 for Ruby'
|
|
84
87
|
test_files: []
|